PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Fri Jul 04, 2025 11:53 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue May 10, 2016 10:28 am 
Offline

Joined: Tue May 10, 2016 9:56 am
Posts: 2
Hello there.
I faced with a situtation when the table requires several pages to fit its content and in some cells text requires more area than the single album-oriented page allows.
If I use the table without HeadingFormat it's fine. The text is being splitted between pages (cell looks like it continues to another page).
But I have to use the HeadingFormat on each page where table has its rows... Is there a way to have the heading and splitting cells?
Right now the text in cell looks like:

Attachment:
pagebreak.png
pagebreak.png [ 4.57 KiB | Viewed 6921 times ]


Like that. It ends inpredictibly.

Declaration of my table:
Code:
_tableFeedbackContent = section.AddTable();
_tableFeedbackContent.AddColumn(sectionWidth / 5);
_tableFeedbackContent.AddColumn(sectionWidth / 5);
_tableFeedbackContent.AddColumn(sectionWidth / 5);
_tableFeedbackContent.AddColumn(sectionWidth / 5);
_tableFeedbackContent.AddColumn(sectionWidth / 5);
// Row header.
MDTables.Row contentRow = _tableFeedbackContent.AddRow();
contentRow.HeadingFormat = true;
contentRow.VerticalAlignment = MDTables.VerticalAlignment.Center;
contentRow.Format.LeftIndent = LeftIndent;
contentRow.Style = "Arial 8.5 Bold";
contentRow.Height = FeedbackContentTableHeaderHeight;
contentRow.Borders.Top.Width = DataTableFatBorderWidth;
contentRow.Borders.Bottom.Width = DataTableFatBorderWidth;
contentRow.Borders.Left.Width = DataTableFatBorderWidth;
contentRow.Borders.Right.Width = DataTableFatBorderWidth;
// Row space.
contentRow = _tableFeedbackContent.AddRow();
contentRow.KeepWith = 1;
contentRow.Shading.Color = _headerSpaceRowBackgroundColor;
contentRow.Cells[0].MergeRight = 4;
contentRow.Height = FeedbackContentTableHeaderHeight;
contentRow.Borders.Top.Width = DataTableFatBorderWidth;
contentRow.Borders.Bottom.Width = DataTableFatBorderWidth;
contentRow.Borders.Left.Width = DataTableFatBorderWidth;
contentRow.Borders.Right.Width = DataTableFatBorderWidth;


The row where I place texts in cells:
Code:
MDTables.Row row = _tableFeedbackContent.AddRow();
row.Height = DataTableContentRowHeight;
row.VerticalAlignment = MDTables.VerticalAlignment.Center;
row.Format.LeftIndent = LeftIndent;

row.Cells[0].Shading.Color = _companyNameCellBackgroundColor;
row.Cells[0].Format.LeftIndent = LeftIndent;


I've tried to find anything that would help but no luck. Maybe there is no such feature yet...


Top
 Profile  
Reply with quote  
PostPosted: Tue May 10, 2016 11:14 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3131
Location: Cologne, Germany
Hi!

I thought MigraDoc would never split cells across pages. But we always use tables with headers.

Will the table always start at the top of a page or will the position vary?

If I had to solve that issue, I would probably add a table without heading row to the document and finally use the technique of mixing PDFsharp and MigraDoc to draw a small table with the heading row onto each page where the table is.
This works with PDF only (you would not ask if you were generating RTF anyway).

See also:
http://www.pdfsharp.net/wiki/MixMigraDo ... ample.ashx

A much more simple workaround (with some restrictions):
Create a new section for the table, have the table start at the top of the page (without heading), create a small table for the heading and add this to the header of the section.
The page header (with the heading row) will be repeated on each page of the section.
Do you have other contents before or after the table?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue May 10, 2016 11:31 am 
Offline

Joined: Tue May 10, 2016 9:56 am
Posts: 2
Thomas Hoevel wrote:
Will the table always start at the top of a page or will the position vary?


No, there is another small table on the top. It has some specific information like logo, names, etc.
Even if the table starts from the top (what happens when the table cannot fit the rest of the page and is being moved to a next page) the cell will not fit the text completely (see the attached picture in the previous post).

Thomas Hoevel wrote:
If I had to solve that issue, I would probably add a table without heading row to the document and finally use the technique of mixing PDFsharp and MigraDoc to draw a small table with the heading row onto each page where the table is.

Well, if there is no other way I have to give it a try.

Thomas Hoevel wrote:
Create a new section .... will be repeated on each page of the section.

Will try it. Maybe it will work.

Thomas Hoevel wrote:
Do you have other contents before or after the table?

Only before the table starts. A table with general info: logo, names, etc.

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Tue May 10, 2016 12:29 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3131
Location: Cologne, Germany
Sections always start on a new page.

Using the section trick, you will have the small table on the first page and the large table starting at page 2.
Maybe not nice (*), but quickly implemented.

(*) It may look nicer if you can add more contents to the first page (larger logo, copyright, disclaimer, ...).

_________________
Regards
Thomas Hoevel
PDFsharp Team


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: No registered users and 6 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