This is a migrated thread and some comments may be shown as answers.

Calling .TableInsert in a loop = The document element is associated with another parent

2 Answers 389 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 14 Jul 2015, 03:00 AM

I am trying to create a multi-section PDF report and am getting this error when doing the second .InsertTable:

System.ArgumentException: The document element is associated with another parent.

Something like this:

var pdfDocument = new RadFixedDocument()
{
    DocumentInfo =
    {
        Title = packageTitle,
        Author = packageRunBy
    }
};
pdfDocument.Destinations.AddPageHorizontalFit();
var pdfEditor = new RadFixedDocumentEditor(pdfDocument);

foreach (var report in reports)
{

if (pdfDocument.Pages.Count > 0) pdfEditor.InsertSectionBreak();

var reportTable = new Table();

// Build the Table

pdfEditor.InsertTable(reportTable); // Errors here on the second time around the loop

}

2 Answers, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 14 Jul 2015, 11:38 PM
Oddly the error has gone away - It may have been related to some TextFragements or Blocks having blank values
0
Petya
Telerik team
answered on 16 Jul 2015, 02:11 PM
Hello Dan,

We're aware of a similar issue when the table needs to be split on several pages. As you presumed, it highly depends on the content of the document as it occurs due to wrong calculation of the table's height in the splitting logic.

Resolving this is in our backlog and you can track the team's progress here.

Regards,
Petya
Telerik
Tags
PdfProcessing
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Petya
Telerik team
Share this question
or