PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Sat Jul 05, 2025 1:36 pm

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: Mon Mar 14, 2016 2:24 pm 
Offline

Joined: Mon Mar 14, 2016 8:46 am
Posts: 3
Hello @all,

i have a problem with a nested table: If I insert a table in a cell of an outer table, then appears a space below the inner table. The space is aprroxemately 3cm and expands the outer cell. If i remove the inner table, the cells of the outer table are only expandet to the absolutly required vertical space.

I can not find the reason, there are no paddings in the involved objects.

Testcode:

Code:
 
            var document = new Document();
            PageSetup pageSetup = document.DefaultPageSetup.Clone();
            pageSetup.Orientation = MigraDoc.DocumentObjectModel.Orientation.Landscape;
            MigraDoc.DocumentObjectModel.Section section = document.AddSection();


            var outerTable = section.AddTable();
            outerTable.Borders.Width = 0.25;
            outerTable.Borders.Style = BorderStyle.Single;
            outerTable.Borders.Color = MigraDoc.DocumentObjectModel.Colors.Black;
           
            var outerTableCol1 = outerTable.AddColumn("8cm");
            var outerTableCol2 = outerTable.AddColumn("8cm");
           

            var outerTableRow1 = outerTable.AddRow();
            outerTableRow1.Cells[0].AddParagraph("Some Content in Cell 1, Row1");


            var innerFrame = outerTableRow1.Cells[1].AddTextFrame();

            var innerTable = innerFrame.AddTable();
            var innerColum1 = innerTable.AddColumn("3cm");
            var innerColum2 = innerTable.AddColumn("3cm");

            var innerRow1 = innerTable.AddRow();
            innerRow1.Cells[0].AddParagraph("Hallo");
            innerRow1.Cells[1].AddParagraph("Welt");

            var innerRow2 = innerTable.AddRow();
            innerRow2.Cells[0].AddParagraph("Lala");
            innerRow2.Cells[1].AddParagraph("Lulu");

           
            innerTable.Borders.Width = 0.25;
            innerTable.Format.Font.Size = 9;
            innerTable.Borders.Color = MigraDoc.DocumentObjectModel.Colors.Red;


Attached you will find a screenshot of the document.

Thank you very much for your answer.

Arne


Attachments:
padding.gif
padding.gif [ 56.07 KiB | Viewed 5617 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2016 2:45 pm 
Offline
PDFsharp Guru
User avatar

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

Check the height of your "innerFrame".

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2016 3:17 pm 
Offline

Joined: Mon Mar 14, 2016 8:46 am
Posts: 3
Hi Thomas,

thank you for your answer.

The height and all other values (Margin, Width etc) of the innerFrame are 0. Also in the ddl file are no numerical values. (except the width of the table columns)

I open the document with the wpf-Viewer. Could it be a bug in the viewer-component?

best, Arne

[edit]
btw: I use MigraDoc Version 1.50.4000.0
[/edit]

the ddl:

Quote:
"\\document\r\n{\r\n \\styles\r\n {\r\n Heading1\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level1\r\n }\r\n }\r\n\r\n Heading2\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level2\r\n }\r\n }\r\n\r\n Heading3\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level3\r\n }\r\n }\r\n\r\n Heading4\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level4\r\n }\r\n }\r\n\r\n Heading5\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level5\r\n }\r\n }\r\n\r\n Heading6\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level6\r\n }\r\n }\r\n\r\n Heading7\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level7\r\n }\r\n }\r\n\r\n Heading8\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level8\r\n }\r\n }\r\n\r\n Heading9\r\n {\r\n ParagraphFormat\r\n {\r\n OutlineLevel = Level9\r\n }\r\n }\r\n\r\n InvalidStyleName\r\n {\r\n Font\r\n {\r\n Bold = true\r\n Underline = Dash\r\n Color = Lime\r\n }\r\n }\r\n }\r\n \\section\r\n {\r\n \\table\r\n [\r\n Borders\r\n {\r\n Style = Single\r\n Width = 0.25\r\n Color = Black\r\n }\r\n ]\r\n {\r\n \\columns\r\n {\r\n \\column\r\n [\r\n Width = \"8cm\"\r\n ]\r\n \\column\r\n [\r\n Width = \"8cm\"\r\n ]\r\n }\r\n \\rows\r\n {\r\n \\row\r\n {\r\n \\cell\r\n {\r\n Some Content in Cell 1, Row1\r\n }\r\n \\cell\r\n {\r\n \\textframe\r\n {\r\n \\table\r\n [\r\n Format\r\n {\r\n Font\r\n {\r\n Size = 9\r\n }\r\n }\r\n Borders\r\n {\r\n Width = 0.25\r\n Color = Red\r\n }\r\n ]\r\n {\r\n \\columns\r\n {\r\n \\column\r\n [\r\n Width = \"3cm\"\r\n ]\r\n \\column\r\n [\r\n Width = \"3cm\"\r\n ]\r\n }\r\n \\rows\r\n {\r\n \\row\r\n {\r\n \\cell\r\n {\r\n Hallo\r\n }\r\n \\cell\r\n {\r\n Welt\r\n }\r\n }\r\n \\row\r\n {\r\n \\cell\r\n {\r\n Lala\r\n }\r\n \\cell\r\n {\r\n Lulu\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2016 3:41 pm 
Offline

Joined: Mon Mar 14, 2016 8:46 am
Posts: 3
That's funny: If i explicit give the textframe a height, by

Code:
innerFrame.Height = "8mm";


it works. The space disapear.

But this only works in situations if height of the content is not auto-computed.

Better solutions are welcome! :)

thank you again!


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 43 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