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

Must clone row before adding, result is double rows
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3707
Page 1 of 1

Author:  MwBakker [ Thu Jan 04, 2018 4:45 pm ]
Post subject:  Must clone row before adding, result is double rows

Hello PDFSharp / Migradoc, happy new year!

I have a List<Row> with stored well-set rows before adding these to the table.

I want to manage this by simply:

Code:
foreach (Row tableRow in sysrows)
{
   //tableRow.Clone();
   table.Rows.Add(tableRow);
}



But this gives me the exception for not having cloned the row before adding it. When I do clone this row, I get double rows added to the table.

What must I do to have the specific row added once in this matter?

One of the Rows
Code:
 Row systemrow = new Row { BottomPadding = 5 };

Author:  TH-Soft [ Thu Jan 04, 2018 6:50 pm ]
Post subject:  Re: Must clone row before adding, result is double rows

Hi!
MwBakker wrote:
What must I do to have the specific row added once in this matter?
Could be a bug in MigraDoc. Hard to say with just those code snippets.

You say you get double rows. Maybe you try to add the rows twice.
Probably something wrong with the code your are not showing here.

A row created with "new Row()" should have no owner. You should be able to add it once to a table.

Maybe use the Issue Submission Template if you think there is a bug in MigraDoc.
See also:
viewtopic.php?f=2&t=832


The standard way of adding rows is this:
Code:
Row row = table.AddRow();

You can store the Row in a List<Row> for future references.
See also:
http://pdfsharp.net/wiki/HelloMigraDoc-sample.ashx

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