PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 4:59 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Apr 18, 2016 1:40 pm 
Offline

Joined: Mon Apr 18, 2016 1:17 pm
Posts: 4
I have a situation where I need to nest three tables side-by-side in an outer table. There can be 1 - 3 nested tables in each row and each table is sized to be 1/3 the page width. I created an outer table with 3 columns and then use Row.Cells[cellIndex].Elements.AddTable(). This gets me most of the way there but for reasons I can't seem to figure out, the inner tables get indented to the right by what looks to be about a millimeter or so and so the inner tables do not line up properly with the left edge of the outer table.. I could not seem to find any indent or padding properties that were set to anything but zero so I'm at a loss as to how I get these inner tables to line up. It only looks like the leftmost nested table gets indented with the following two tables to the right of that being lined up directly to the right of the table before it. I've tried using TextFrame but then I have issues with page breaks and whatnot. Anyone have any ideas what I might be doing wrong to cause this slight indent? I'm relatively new to using MigraDoc so I may just be missing something simple. We had to switch to MigraDoc as a replacement for iTextSharp and now we're running into this issue. This forum website would not allow me to attach the PDF with a .pdf extension so I am attaching an image. Hopefully that helps

Attachment:
NestedTableIndent.png
NestedTableIndent.png [ 83.11 KiB | Viewed 5994 times ]


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 18, 2016 2:16 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!
jsRiptide wrote:
I could not seem to find any indent or padding properties that were set to anything but zero so I'm at a loss as to how I get these inner tables to line up.
Set them all to 0 even if they seem to be 0 in the debugger.
The values are null if you don't set them - and sometimes a non-zero default value will be used for those null values even though the debugger shows them as 0.
Most likely a property of the cells of the outer table.

jsRiptide wrote:
This forum website would not allow me to attach the PDF with a .pdf extension so I am attaching an image.
You can attach zipped PDF files, but I think the image is more helpful than a PDF.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 18, 2016 3:01 pm 
Offline

Joined: Mon Apr 18, 2016 1:17 pm
Posts: 4
NestedTableIndent2.png[/attachment]If I set the LeftIndent = 0 for the outer table (Table.Rows.LeftIndent = 0) it causes the row of the outer table that the tables are nested in to indent by the same amount. Setting LeftPadding and RightPadding for all columns in outer table to zero and BottomPadding and TopPadding for the row of the outer table to zero had no effect. I also tried setting LeftIndent = "-0.1cm" but that had no effect.

Attachment:
NestedTableIndent2.png
NestedTableIndent2.png [ 41.24 KiB | Viewed 5990 times ]


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 18, 2016 3:18 pm 
Offline

Joined: Mon Apr 18, 2016 1:17 pm
Posts: 4
If I set LeftIndent = -4 on the outer table, it shifts the outer table into the correct location (same location as if I don't set it at all). Setting the LeftIndent property of the inner table doesn't appear to have any effect.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 18, 2016 3:23 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Have you tried setting the LeftPadding of the Column of the outer table? It could be a column or table property you have to set, though it gets rendered with the cell.


You can set Table.Rows.LeftIndent for the inner tables, too. It can also be set to negative values.
The default value is negative to have text appear at the 0 position.
Table.Rows.LeftIndent has the same value, but it's not the problem - and setting it to negative values on the inner table would be a hack.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 18, 2016 3:40 pm 
Offline

Joined: Mon Apr 18, 2016 1:17 pm
Posts: 4
The magic combination of settings that seems to bring everything into alignment is to set LeftIndent on the outer table to -4 and to set the LeftPadding of the columns of the outer table to zero. I tried commenting out setting the LeftIndent after I got it to align but then that causes the outer table to get indented. Odd that it takes that specific combination to work correctly but I can live with that. Thanks so much for your help!

Attachment:
NestedTableIndent3.png
NestedTableIndent3.png [ 42.06 KiB | Viewed 5986 times ]


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 364 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