Bug 63611

Summary: Add/Remove Macros to/from XWPFDocument
Product: POI Reporter: Rabea Gransberger <rgransberger>
Component: XWPFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: 4.0.x-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Example Code DOCM/DOCX conversion

Description Rabea Gransberger 2019-07-25 12:42:10 UTC
Created attachment 36684 [details]
Example Code DOCM/DOCX conversion

Here is some example code to be able to add a macro from an existing docm document to an existing docx document and change the type to docm.

new DocumentConverter(docxFile).toDocm(macroDocmFile, outputDocmFile);

And also some code to remove the macro from a docm document and convert it to a docx document.

new DocumentConverter(docmFile).toDocx(outputDocxFile);

Tested with POI 4.1 (with ooxml-schema 1.4) and Word 2016.