PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Paragraph on the left, table on the right?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=314
Page 1 of 1

Author:  Gilles [ Wed Feb 06, 2008 10:08 am ]
Post subject:  Paragraph on the left, table on the right?

I am trying to create a report, which requires me that there is a paragraph (5 lines) on the left, and a table that is next to that paragraph.

Is that possible using:
paragraph = section.Headers.Primary.AddParagraph();
(and)
table = section.Headers.Primary.AddTable();

and to reposition the table (how?), or do i have to create a nested table for that, with in the first column the paragraph and in the second column the nested table?

Bah, nested tables is not possible..

Author:  Thomas Hoevel [ Wed Feb 06, 2008 10:19 am ]
Post subject: 

I think that nested tables are the best solution with respect to automatic layout.

You could use a textframe for the paragraph and a normal table.
Or you could put the table into a textframe and use a normal paragraph.
Textframes work fine if you know the size of their contents.

If you know there are always 5 (or less) lines of text in the paragraph, then a textframe for the paragraph will work just fine.
You could encounter problems with a text of variable length however because you have to specify the size of the textframe.

To avoid overlap between textframe and table, you have to position the table accordingly.

Author:  Gilles [ Wed Feb 06, 2008 10:23 am ]
Post subject: 

Hi Thomas,

Thank you for your fast reply, this really helps a lot. Is there a way to position the table on the document? I have searched for it but i could not find a "left" or "top" position.

I ask this because the textframe has a left and so on property, but i can't position the table "next" to it, can i?

Author:  Gilles [ Wed Feb 06, 2008 10:24 am ]
Post subject: 

P.s. how do you create a nested table? I don't see a "row.Cells[0].addTable()" command...

Author:  Gilles [ Wed Feb 06, 2008 10:57 am ]
Post subject: 

I fixed it using:

table = section.Headers.Primary.AddTable();
column = table.AddColumn("18.5cm");
column = table.AddColumn("8cm");
row = table.AddRow();

...

paragraph = row.Cells[0].AddParagraph();

...

TextFrame textframe = row.Cells[1].AddTextFrame();
table = textframe.AddTable();

...

etc.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/