質問

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