PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 10:13 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Feb 06, 2008 10:08 am 
Offline

Joined: Wed Feb 06, 2008 10:05 am
Posts: 4
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..


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 06, 2008 10:19 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 06, 2008 10:23 am 
Offline

Joined: Wed Feb 06, 2008 10:05 am
Posts: 4
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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 06, 2008 10:24 am 
Offline

Joined: Wed Feb 06, 2008 10:05 am
Posts: 4
P.s. how do you create a nested table? I don't see a "row.Cells[0].addTable()" command...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 06, 2008 10:57 am 
Offline

Joined: Wed Feb 06, 2008 10:05 am
Posts: 4
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.


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 192 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