简体   繁体   中英

How to Export HTML to Word Document with React js

Hello I have HTML data in my React App and want to export this in word document and download at button click event. can any one help to make this one please.

          let element = (
            <p  style={{fontSize: "10px", color:"#000"}}>
              Your investment in the maintenance package is just , billed directly to your credit card.
            </p>
           )

Need function to export this in.docx document

By clicking this button, the exportHTML() JavaScript function will be called. The HTML portion to be exported into a word document will be identified with the ID selector. The content of the DIV element specified with the id source-html is used to build the source of the HTML export in the JavaScript function.

By clicking this button, the exportHTML() JavaScript function will be called. The HTML portion to be exported into a word document will be identified with the ID selector. The content of the DIV element specified with the id source-html is used to build the source of the HTML export in the JavaScript function.

You can try using the Open XML SDK if you need to build Word documents on the fly. You may search for any libraries in JavaScript that allows creating Word documents like you could do using that SDK, see https://openxmldeveloper.org/ . For example, you may find the Creating OpenXML documents using JavaScript post helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM