PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 11, 2024 2:12 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Apr 09, 2011 1:15 pm 
Offline

Joined: Sat Apr 09, 2011 12:25 pm
Posts: 1
Hi,

I'm having a problem rendering tables wider than the page. From what I've read the table should automatically split and columns going off beyond the right page edge should be moved onto a new page. However, I can't get it to work. The columns won't break and I don't know what I'm doing wrong.
With this sample method I get a table going beyond the page edge:

Code:
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using MigraDoc.Rendering.Printing;
using PdfSharp.Pdf;

public void SimpleTableTest()
{
    int columnCount = 10;
    int rowCount = 10;
   
    Document document = new Document();
    document.DefaultPageSetup.HorizontalPageBreak = true;

    document.AddSection();

    Table table = new Table();
    table.Borders.Width = 0.5;
    table.Rows.Height = 20;

    for (int i = 0; i < columnCount; i++)
        table.AddColumn(Unit.FromCentimeter(2.5));

    Row headerRow = table.AddRow();
    headerRow.HeadingFormat = true;
    for (int i = 0; i < columnCount; i++)
        headerRow.Cells[i].AddParagraph("Column " + i);

    for (int i = 1; i < rowCount; i++)
    {
        Row row = table.AddRow();
        for (int j = 0; j < columnCount; j++)
            row.Cells[j].AddParagraph("value");
    }

    document.LastSection.Add(table);

    PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always);
    pdfRenderer.Document = document;
    pdfRenderer.RenderDocument();
    pdfRenderer.PdfDocument.Save("testTable.pdf");

    System.Diagnostics.Process.Start("testTable.pdf");
}


I am using MigraDoc 1.31 and .NET 3.5.

Any help will be very appreciated. Thanks
Anna


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 28, 2011 7:34 am 
Offline

Joined: Mon Jun 27, 2011 1:59 pm
Posts: 2
Hello

Did you get any solution for your problem, though im stuck in the same problem? i tried to read the source, but it doesn't seem to do much. I could only find

if (this.doHorizontalBreak)
{
CalcLastHeaderColumn();
CreateConnectedColumns();
}

in MigraDoc.Rendering.TableRenderer but as far as i see this canot be the logic. Is this feature really implemented for tables - do i miss something?

Regards, Klaus


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 28, 2011 8:32 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Bad news: with the current implementation of MigraDoc columns do not break onto a new page.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 13, 2011 4:21 pm 
Offline

Joined: Wed Jul 13, 2011 4:11 pm
Posts: 1
Hi all...

Is there any workaround for this?

This will be very helpfull for me..

Thanks a lot


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group