Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Nov 28, 2022 6:52 pm

Hello!
I want to use Spire.Doc to convert an html to Word and I was wondering if it's possible to include css in my html in order to add page break into the word document result and also if I can use the page break inside: avoid css in order not to have my table cut in half?
Thanks a lot!

Dylou2795
 
Posts: 6
Joined: Mon Nov 28, 2022 6:49 pm

Tue Nov 29, 2022 8:07 am

Hi,

Thank you for your inquiry.
Yes, our Spire.Doc can recognize page breaks in css when converting Html to Word. In the meanwhile, we also provide method to insert page break. Please refer to this tutorial: Insert page break at a specified location.
Please refer to this tutorial to avoid css in order not to have the table cut in half: Prevent Page Breaks in Word Tables
If you have any issue, just feel free to contact us.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Wed Nov 30, 2022 7:20 pm

Hi Doris,
Thanks for your reply!
Yes I noticed but i was wondering if they were a css code that I can add into my HTML that will do it automatically without having the needs to do it in C#?
Let me know,
Thanks,

Dylou2795
 
Posts: 6
Joined: Mon Nov 28, 2022 6:49 pm

Thu Dec 01, 2022 8:39 am

Hello,

Thanks for your response.
For your issue, you could use <span><br clear=all style = 'page-break-before:always' ></span> to insert page break and our Spire.Doc can recognize it when converting Html to Word. As for preventing table from being cut in half, I tried “style=’page-break-inside: avoid;’” but it doesn't work in Microsoft Word. Our Spire.Doc follows the rules of Microsoft Word, so it can’t be recognized too. I suggest that you use the feature of our Spire.Doc to prevent page breaks in Word tables, this way is also efficient.
If you have any other issue, just feel free to contact us.

Sincerely
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Tue Dec 27, 2022 5:59 am

Hi,

Hope you are doing well!
Could you please let us know how is your issue going? Thanks in advance for your feedback and time.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc

cron