We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Event on new page

Hi,
on a page (after a bookmark) I print a “caption” followed by content. Sometimes the content doesn’t fit on one page so a new page begins. In this case I need to print the “caption” again, immediately after the page break. How can I handle this?

Thanks,
Andi

@ikarussoft

Thanks for your inquiry. Could you please share some more detail about your query along with input and problematic output document here for testing? We will investigate the issue and provide you more information on it.

Hi,

thanks for you reply.

e.g.

// Move to Bookmark
documentBuilder.MoveToBookmark(“PrintTextHere”);
// Print the Caption
documentBuilder.WriteLn(caption);

/* what I need:
documentBuilder.OnPageBreak = () => { documentBuilder.WriteLn(caption); };
*/

// Print the Content
foreach (var line in content) /* List */
{
documentBuilder.WriteLn(line);
}

@ikarussoft

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

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi,
thank you very much for your effort.

In the folder Output of the zip you have

  • Output1.docx --> ok
  • Output2.docx --> missing “caption”
  • Output2 _ How_I_want_it.docx --> as it should be :slight_smile:

Aspose-Support.zip (8.3 MB)

@ikarussoft

Thanks for sharing the documents. In your case, we suggest you following solution.

  1. Please repeat row as header on subsequent pages.
  2. You need to create one main table that has two rows.
  3. Insert the text “Contracts” in the first row and add remaining tables in the second row.

Please refer to the following article.
Specifying Rows to Repeat on Subsequent Pages as Header Rows