Does DocumentBuilder.InsertHtml respect the HangingIndent setting?

Hi,

Does DocumentBuilder.InsertHtml respect the HangingIndent setting?

If not, is there a way to indent the content that is inserted with DocumentBuilder.InsertHtml?

Thanks.

Hi Joseph,

Thanks for your inquiry. Yes, DocumentBuilder.InsertHtml does respect the hanging indent setting. Please check the following code example and attached input and output documents.

Moreover, the ParagraphFormat.FirstLineIndent property is used to get or set the value (in points) for a first line or hanging indent. Please use a positive value to set a first-line indent, and use a negative value to set a hanging indent.

If you face any issue, please share your input HTML and expected output document here for our reference. We will then provide you more information about your query along with code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText(MyDir + "input.html"));
doc.Save(MyDir + "Out.docx");

Hi,

I tried inserting the following HTML, the text respects the hanging indents but the table does not.

This is a long line of text for testing text wrapping in word document. Peter Piper picked a peck of pickled peppers; A peck of pickled peppers Peter Piper picked; If Peter Piper picked a peck of pickled peppers, Where’s the peck of pickled peppers Peter Piper picked?

happy anniversary
joyous holidays

This is a long line of text for testing text wrapping in word document. Peter Piper picked a peck of pickled peppers; A peck of pickled peppers Peter Piper picked; If Peter Piper picked a peck of pickled peppers, Where’s the peck of pickled peppers Peter Piper picked?

Please see attached output.

Hi Joseph,

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 complete HTML.
  • 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’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.