PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Wed Nov 05, 2025 8:04 am

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  [ 3 posts ] 
Author Message
PostPosted: Mon Jan 21, 2013 3:42 pm 
Offline

Joined: Thu Jan 17, 2013 10:59 am
Posts: 4
I found out that changing the int rows (4th element) doesn't affect the rows of a table that will be rendered. Only if I put a number larger than the number of rows I get an exception. This makes sense, but why not to get less rows rendered in case that int rows is less than my rows?
public void SetEdge(int clm, int row, int clms, int rows, Edge edge, BorderStyle style, Unit width, Color clr);

I create the rows using the following loop

Code:
for (int rows = 0; rows < Table1_1.Count; rows++)
            {
                row = table_1.AddRow();
                row.HeadingFormat = true;
                row.Format.Alignment = ParagraphAlignment.Center;
                row.Format.Font.Name = "Arial";
                row.Format.Font.Size = 6;
                row.Format.Font.Bold = false;
                if (rows % 2 != 0)
                {
                    row.Shading.Color = TableBlue;
                }
                else
                {
                    row.Shading.Color = TableGray;
                }
                row.Cells[0].AddParagraph(Table1_1[rows]);
                row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                row.Cells[1].AddParagraph(Table1_2[rows]);
                row.Cells[1].Format.Alignment = ParagraphAlignment.Center;
            }

where
Code:
List<string> Table1_1 = new List<string>();

filled with 14 elements

Furthermore if I render a second table on another position in the page, the first table becomes as its last row the header of the second. Is this a known (or not) bug, or am I messing around with something?

I can provide the solution if there is interest.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 21, 2013 4:30 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Hi!
wittag wrote:
I found out that changing the int rows (4th element) doesn't affect the rows of a table that will be rendered.
A table will be rendered with all its row. You can remove rows later if you created too many.

SetEdge just sets a visible border around specific table cells. It's not intended to remove rows from your table.

In PDF there are no known problems with two tables.

When creating RTF, make sure you have a paragraph between two tables.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 22, 2013 7:30 am 
Offline

Joined: Thu Jan 17, 2013 10:59 am
Posts: 4
Hi,

it was my mistake, I declared
Code:
Row row = table_1.AddRow();

and then used it for the second table too.
The correct way is:
Code:
Row row_1 = table_1.AddRow();
Row row_2 = table_2.AddRow();


I put here the solution in case someone else has the same problem.

It needs sometime to get used to the many options this library has, but that's what I like, because I am able to create the document the way I want it.

Thanks for your help.


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

All times are UTC


Who is online

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