MergeField Issue in Document Header

I am trying to generate word document in c#

I have declared mergeField in header section

after writing data and trying to insert paragraph in page

i am getting System.InvalidOperationException: Cannot insert the requested break outside of the main story.

Hi there,

Thanks for your inquiry. Yes, you can insert paragraph in the header/footer of document. It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document


As soon as you get these pieces of information to
us we’ll start our investigation into your issue.