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

Free Support Forum - aspose.com

Keep Text With Table Header on Page Break in Word Document (C# .NET)

I am writing text (a table header) using the following code snippet:

Builder.InsertBreak(BreakType.LineBreak);

Builder.Font.Bold = true;
Builder.Writeln(SectionHeader);
Builder.Font.Bold = false;

var outerTable = Builder.StartTable();

I want the text that is written to the document (In the SectionHeader variable) to flow with the header on a page break. Is there any way to do that or do I just need to add a row in the table and style it so it still looks the same?

I’m using .Net and C# to generate the document.

Thanks

@smeddows,

Please compress the following resources into ZIP format and attach the .zip file here for testing:

  • A simplified source Word document
  • Aspose.Words generated output document showing the undesired behavior
  • Your expected Word file showing the desired output. You can create this file manually by using MS Word. It would be great if you please also list the complete steps that you performed in MS Word to create the expected file
  • Please also create a standalone simplified Console Application (source code without compilation errors) and attach it here for our reference. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will then start investigation into your particular issue and provide you code to achieve the same by using Aspose.Words.