Free Support Forum - aspose.com

Heading style not applied from Merge Codes

Hello,

I have applied 'Heading style (Example - H2) in a MergeCode in word template, but after InsertHtml this Heading formatting is not applied to the content.

Similar behavior observed for ‘InsertHtml’ when I applied ‘Right Align’ on a MergeCode, but this formatting is not applied to the contents after ‘InsertHtml’

string content = “Sample Contents”;

Document newDoc = new Document();
DocumentBuilder dB = new DocumentBuilder(newDoc);

dB.InsertHtml(content);
MemoryStream mSteam = new MemoryStream();
newDoc.Save(mSteam, SaveFormat.Docx);

Regards,
Sam

@sams177,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please share some more detail about MergeCode.
  • Your input Word document if you are using any
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the ** expected output** Word file that shows the desired behavior.
  • In your shared code, you are simply inserting HTML into document. 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 and upload them.