How to change indentation in section headers and remove the extra spaces using .NET | HTML to DOCX Conversion

Aspose.zip (74.0 KB)
How do I change the indentation in section headers and remove the extra spaces before and after it? Also, how do I remove the x.x.x section numbers from the table of contents? I have tried
document.Styles[StyleIdentifier.Heading1].ParagraphFormat.SpaceAfterAuto = false;
document.Styles[StyleIdentifier.Heading1].ParagraphFormat.SpaceAfter = 0f;
document.Styles[StyleIdentifier.Heading1].ParagraphFormat.SpaceBeforeAuto = false;
document.Styles[StyleIdentifier.Heading1].ParagraphFormat.SpaceBefore = 0f;
document.Styles[StyleIdentifier.Heading1].ParagraphFormat.LeftIndent = 8f;
Didn’t do anything that I could see.
I have attached the codes and doc in the post.

@AnupKTarafder

Could you please ZIP and attach your expected output Word document? We will then provide you more information about your query.

Desired Formatting.zip (70.3 KB)
Sorry for the late reply. I have attached a doc with corrected formatting, margins, and border.
And I already found the switch for the table of contents to only include x.x section numbers and not x.x.x.

I have found a way to remove extra spaces before and after section headers by changing the margin of the tags in html. So that part is also fixed.
But, I forgot to mention another problem.
image.png (3.6 KB)
How do I stop this kind of forced page breaks? I have added “page-break-inside: avoid” to my html. But it doesn’t stop the page break. I need the section header and the table moved to the second page.
How can I do it?

@AnupKTarafder

You have attached the same document again. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input 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 manually create your expected Word document using Microsoft Word
  • 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.