OriEng
OriEng

Reputation: 1573

Word add-in js getHtml() function not return all fully style

I write word add-in in JS using this API: https://dev.office.com/reference/add-ins/word/word-add-ins-reference-overview

When I use function body.getHtml() I get almost everything , but some style is missing ,for example table of content is not with style, and when I use body.insertHtml() all style of table of content is not exist.

I success to get all style with body.getOoxml() function but it's very very long when I compare it to the html and this is bug problem for me .

What could I do?

Thank you

Upvotes: 1

Views: 397

Answers (1)

Juan Balmori
Juan Balmori

Reputation: 5036

The issue here is that when you create a TOC what really happens in the doc is that we insert a special type of content control wrapping the TOC and we don't roundtrip it in docx-html conversions. In fact, if you save your TOCed document as HTML you will see that the style is lost in the resulting html. FWIW the links on the resulting HTML are functional.

That said, your only option as of now is to go OOXML. thx, Juan.

Upvotes: 1

Related Questions