Please provide Sample code for below

Hi Team,

I am using Aspose.Words in my application.
Could you please provide me with a sample code for below scenario:
I need to tick the below highlighted two options:
Keep with next
Page break before

Thank you.

Hi,

Could you please help with the above

Hi,

Thanks for your inquiry. Sure, you can achieve this using ParagraphFormat.KeepWithNext and ParagraphFormat.PageBreakBefore properties. For more options, please visit the following page:
https://reference.aspose.com/words/net/aspose.words/paragraphformat/

Best regards,