We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML block inside the word document

Dear all,

what is the best way to put a HTML block inside a word document (e.g. inside a paragraph, section,…)?
I have used builder.insertHtml(“foo bar
Hello world!”);
but it creates a block for the whole part and a specific part cannot be selected or edited in MS Word…I have attached a picture which shows that.

Is it possible to put HTML block inside a paragraph and the block will be editable in the MS Word?

Thanks in advance,

Hi Marzieh,

Thanks for your inquiry. You may load the html into separate Aspose.Words Document and use DocumentBuilder.insertDocument method to insert this html document into content control. First you need to move the cursor into first child node of content control and then use insertDocument method. Hope this helps you.

Regarding issue with insertHtml method,please share following detail for investigation purposes.

  • Please attach your input Word documents.
  • Please

    create a standalone/runnable simple application that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.

it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Dear Tahir,

thanks for your response. I have found my solution.

Thanks a lot,

Hi Marzieh,

Thanks for your feedback. It is nice to hear from you that you have found the solution of your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.