문제

I am trying to insert dynamic pages inside my fixeddocument in a loop

FixedPage page1 = new FixedPage(); 

but after first page it give error content is already a child of another control. Can you guide me how to add pages to your fixeddocument. How can I make an array of pages?

도움이 되었습니까?

해결책

Make sure that the line FixedPage page1 = new FixedPage(); is executed at the start of every loop, otherwise page1 will always point to the same page and you'll be trying to insert the same page into the document multiple times.

Your code should look like this

while( looping )
{
     FixedPage page1 = new FixedPage(); 
     myFixedDocument.Pages.Add(page1);
}

You should not ever be adding page1 to anything again until the variable has been reassigned to a new FixedPage.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top