Bug 63611 - Add/Remove Macros to/from XWPFDocument
Summary: Add/Remove Macros to/from XWPFDocument
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-25 12:42 UTC by Rabea Gransberger
Modified: 2019-07-25 12:42 UTC (History)
0 users



Attachments
Example Code DOCM/DOCX conversion (4.76 KB, text/plain)
2019-07-25 12:42 UTC, Rabea Gransberger
Details

Note You need to log in before you can comment on or make changes to this bug.
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.