PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
Strange spacing after table in a cell https://forum.pdfsharp.net/viewtopic.php?f=2&t=3322 |
Page 1 of 1 |
Author: | Enra [ Mon Mar 14, 2016 2:24 pm ] | ||
Post subject: | Strange spacing after table in a cell | ||
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
|
Author: | Thomas Hoevel [ Mon Mar 14, 2016 2:45 pm ] |
Post subject: | Re: Strange spacing after table in a cell |
Hi! Check the height of your "innerFrame". |
Author: | Enra [ Mon Mar 14, 2016 3:17 pm ] |
Post subject: | Re: Strange spacing after table in a cell |
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"
|
Author: | Enra [ Mon Mar 14, 2016 3:41 pm ] |
Post subject: | Re: Strange spacing after table in a cell |
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! |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |