Getting error in page numbering

I am getting error in page numbering


we have a word template document, we are replacing ‘Keys’ (which are in template) with ‘values’
in some cases we re repeating Sections, Paragraphs based on condition.

after generating document the page numbers should not be repeat in proper way.

please help to solve this issue.

i am using the following code to append section, append repeating paragraph in section.

Section tempSection = ParaRepeat(Inputdoc, section);
//here we are appending section in a word docuement


private Section ParaRepeat(Document Inputdoc, Section section)
{
NodeCollection paragraphs = section.GetChildNodes(NodeType.Paragraph, true);
if (paragraphs.Count > 0)
{
var paraKeys = KyesSet.GetKeyValues(“RepeatedParaKey”);
for (int i = 0; i < paragraphs.Count; i++)
{
string paraText = paragraphs[i].Range.Text;
if (paraText.Contains("[Signatuer]")
{
Paragraph para = (Paragraph)paragraphs[i].Clone(true);
para.Range.Replace(new Regex(“Signature”), “Value”);//, false, true);
((Paragraph)paragraphs[i]).ParentNode.InsertAfter(para, paragraphs[i]);

((Paragraph)paragraphs[i]).Remove();

((Paragraph)paragraphs[i]).ParentNode.InsertAfter(para, paragraphs[i]);
((Paragraph)paragraphs[i]).Remove();

}

}

}
Section sec = section.Clone();
return sec;
}

Hi Sudheer,


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Aspose.Words generated output document which shows the undesired behavior.
  • Please create a standalone (runnable) console application that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issues and provide you more information.

Best regards,