Render an react component on a word document

Suchismita Dhal 0 Reputation points
2023-04-03T04:20:34.9166667+00:00

My goal is to create a Word Add-in utilizing Yeoman and React, where I intend to display a React component on the Word document. I attempted to achieve this by defining a React element and inserting it into the Word document using the insertHtml function.

let block = <CustomComponent/>
const element = context.document.body.insertHtml(renderToString(block), 'End');

However, this method did not keep the JavaScript and CSS of the component. How can I accomplish this?

Microsoft 365 and Office Development Other
Microsoft 365 and Office Word For business Windows
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.