public class Docx4J extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Docx4J.FindContentControlsVisitor |
Modifier and Type | Field and Description |
---|---|
static Boolean |
EXPORT_FO_DETECTED |
static int |
FLAG_BIND_BIND_XML
Insert the data of the xml in the content controls
Not needed, if the document will only be opened in Word
and not converted to other formats.
|
static int |
FLAG_BIND_INSERT_XML
inject the passed xml into the document
if you don't do this step, then the xml in
the document will be used.
|
static int |
FLAG_BIND_REMOVE_SDT
Remove the content controls of the document
|
static int |
FLAG_BIND_REMOVE_XML
Remove any xml parts from the document that
are used with the content controls.
|
static int |
FLAG_EXPORT_PREFER_NONXSL
If available export the document using a visitor
|
static int |
FLAG_EXPORT_PREFER_XSL
If available export the document using a xsl transformation
|
static int |
FLAG_NONE
No flags passed, do the default
|
static int |
FLAG_SAVE_ENCRYPTED_AGILE
Agile encryption: This is used by Word 2010, it uses an XML EncryptionInfo structure.
|
static int |
FLAG_SAVE_ENCRYPTED_BINARYRC4
RC4 is weak, so don't use it unless you have to for backwards compatibility purposes
(ie the applications to be used for reading your docx don't support anything better).
|
static int |
FLAG_SAVE_ENCRYPTED_STANDARD
Standard encryption: This approach uses a binary EncryptionInfo structure.
|
static int |
FLAG_SAVE_FLAT_XML
Save the document as a flat xml document
|
static int |
FLAG_SAVE_ZIP_FILE
Save the document in a zip container (default docx)
|
static String |
MIME_FO |
static String |
MIME_PDF |
protected static String |
NS_COMPONENTS |
protected static String |
NS_CONDITIONS |
protected static String |
NS_QUESTIONS |
protected static String |
NS_XPATHS |
protected static Set<String> |
PART_TO_REMOVE_SCHEMA_TYPES |
Constructor and Description |
---|
Docx4J() |
Modifier and Type | Method and Description |
---|---|
static void |
bind(WordprocessingMLPackage wmlPackage,
Answers answers,
int flags)
Bind the content controls of the passed document to the xml (here using optional standardised Answers format).
|
static void |
bind(WordprocessingMLPackage wmlPackage,
Document xmlDocument,
int flags)
Bind the content controls of the passed document to the xml.
|
static void |
bind(WordprocessingMLPackage wmlPackage,
Document xmlDocument,
int flags,
DocxFetcher docxFetcher)
Bind the content controls of the passed document to the xml.
|
static void |
bind(WordprocessingMLPackage wmlPackage,
Document xmlDocument,
int flags,
DocxFetcher docxFetcher,
XsltProvider xsltProvider,
String xsltFinisherfilename,
Map<String,Map<String,Object>> finisherParams)
Bind the content controls of the passed document to the xml, applying some formatting finishing touches
to the final docx.
|
static void |
bind(WordprocessingMLPackage wmlPackage,
InputStream xmlDocument,
int flags)
Bind the content controls of the passed document to the xml.
|
static void |
bind(WordprocessingMLPackage wmlPackage,
String xmlDocument,
int flags)
Bind the content controls of the passed document to the xml.
|
static WordprocessingMLPackage |
clone(WordprocessingMLPackage wmlPackage)
Duplicate the document
|
static FOSettings |
createFOSettings()
Create the configuration object for conversions that are done via xsl-fo
|
static HTMLSettings |
createHTMLSettings()
Create the configuration object for conversions to html
|
protected static String |
findXPathStorageItemIdInContentControls(WordprocessingMLPackage wmlPackage) |
protected static Exporter<FOSettings> |
getFOExporter(int flags) |
protected static Exporter<HTMLSettings> |
getHTMLExporter(int flags) |
protected static void |
insertXMLData(CustomXmlPart customXmlDataStoragePart,
Document xmlDocument) |
static WordprocessingMLPackage |
load(File inFile)
Load a Docx Document from a File
|
static OpcPackage |
load(File inFile,
Filetype type)
Load a docx/pptx/xlsx from a File, where you know in advance what type (zip, compound, flat opc)
it is.
|
static WordprocessingMLPackage |
load(InputStream inStream)
Load a Docx Document from an InputStream
|
static WordprocessingMLPackage |
load(PackageIdentifier pkgIdentifier,
File inFile)
Load a Docx Document from a File, assigning it an identifier for eventing
|
static WordprocessingMLPackage |
load(PackageIdentifier pkgIdentifier,
InputStream inStream)
Load a Docx Document from an InputStream, assigning it an identifier for eventing
|
static boolean |
pdfViaFO()
If the docx4j-export-fo project is present,
we'll use FO for PDF export.
|
protected static void |
removeDefinedCustomXmlParts(WordprocessingMLPackage wmlPackage,
String itemId) |
protected static void |
removeSDTs(WordprocessingMLPackage wmlPackage) |
static void |
save(WordprocessingMLPackage wmlPackage,
File outFile)
Save a Docx Document to a File.
|
static void |
save(WordprocessingMLPackage wmlPackage,
File outFile,
int flags)
Save a Docx Document to a File.
|
static void |
save(WordprocessingMLPackage wmlPackage,
File outFile,
int flags,
String password)
Save a Docx Document to a File.
|
static void |
save(WordprocessingMLPackage wmlPackage,
OutputStream outStream)
Save a Docx Document to an OutputStream using flag Docx4J.FLAG_SAVE_ZIP_FILE
|
static void |
save(WordprocessingMLPackage wmlPackage,
OutputStream outStream,
int flags)
Save a Docx Document to an OutputStream.
|
static void |
save(WordprocessingMLPackage wmlPackage,
OutputStream outStream,
int flags,
String password)
Save this pkg to an OutputStream.
|
static void |
setEventNotifier(net.engio.mbassy.bus.MBassador<Docx4jEvent> eventbus) |
static void |
toFO(FOSettings settings,
OutputStream outputStream,
int flags)
Convert the document via xsl-fo
|
static void |
toHTML(HTMLSettings settings,
OutputStream outputStream,
int flags)
Convert the document to HTML
|
static void |
toHTML(WordprocessingMLPackage wmlPackage,
String imageDirPath,
String imageTargetUri,
OutputStream outputStream)
Convert the document to HTML
|
static void |
toPDF(WordprocessingMLPackage wmlPackage,
OutputStream outputStream)
Convenience method to convert the document to PDF
|
public static final String MIME_PDF
public static final String MIME_FO
public static final int FLAG_NONE
public static final int FLAG_EXPORT_PREFER_XSL
public static final int FLAG_EXPORT_PREFER_NONXSL
public static Boolean EXPORT_FO_DETECTED
public static final int FLAG_SAVE_ZIP_FILE
public static final int FLAG_SAVE_FLAT_XML
public static final int FLAG_SAVE_ENCRYPTED_BINARYRC4
public static final int FLAG_SAVE_ENCRYPTED_STANDARD
public static final int FLAG_SAVE_ENCRYPTED_AGILE
public static final int FLAG_BIND_INSERT_XML
public static final int FLAG_BIND_BIND_XML
public static final int FLAG_BIND_REMOVE_SDT
public static final int FLAG_BIND_REMOVE_XML
protected static final String NS_CONDITIONS
protected static final String NS_XPATHS
protected static final String NS_QUESTIONS
protected static final String NS_COMPONENTS
public static boolean pdfViaFO()
public static void setEventNotifier(net.engio.mbassy.bus.MBassador<Docx4jEvent> eventbus)
public static OpcPackage load(File inFile, Filetype type) throws Docx4JException
Docx4JException
public static WordprocessingMLPackage load(File inFile) throws Docx4JException
Docx4JException
public static WordprocessingMLPackage load(PackageIdentifier pkgIdentifier, File inFile) throws Docx4JException
Docx4JException
public static WordprocessingMLPackage load(InputStream inStream) throws Docx4JException
Docx4JException
public static WordprocessingMLPackage load(PackageIdentifier pkgIdentifier, InputStream inStream) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, File outFile) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, File outFile, int flags) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, OutputStream outStream) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, OutputStream outStream, int flags) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, File outFile, int flags, String password) throws Docx4JException
Docx4JException
public static void save(WordprocessingMLPackage wmlPackage, OutputStream outStream, int flags, String password) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, String xmlDocument, int flags) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, InputStream xmlDocument, int flags) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, Answers answers, int flags) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags, DocxFetcher docxFetcher) throws Docx4JException
Docx4JException
public static void bind(WordprocessingMLPackage wmlPackage, Document xmlDocument, int flags, DocxFetcher docxFetcher, XsltProvider xsltProvider, String xsltFinisherfilename, Map<String,Map<String,Object>> finisherParams) throws Docx4JException
Docx4JException
protected static void insertXMLData(CustomXmlPart customXmlDataStoragePart, Document xmlDocument) throws Docx4JException
Docx4JException
protected static String findXPathStorageItemIdInContentControls(WordprocessingMLPackage wmlPackage)
protected static void removeSDTs(WordprocessingMLPackage wmlPackage) throws Docx4JException
Docx4JException
protected static void removeDefinedCustomXmlParts(WordprocessingMLPackage wmlPackage, String itemId)
public static WordprocessingMLPackage clone(WordprocessingMLPackage wmlPackage) throws Docx4JException
Docx4JException
public static FOSettings createFOSettings()
public static void toFO(FOSettings settings, OutputStream outputStream, int flags) throws Docx4JException
Docx4JException
public static void toPDF(WordprocessingMLPackage wmlPackage, OutputStream outputStream) throws Docx4JException
Docx4JException
protected static Exporter<FOSettings> getFOExporter(int flags) throws Docx4JException
Docx4JException
public static HTMLSettings createHTMLSettings()
public static void toHTML(HTMLSettings settings, OutputStream outputStream, int flags) throws Docx4JException
Docx4JException
public static void toHTML(WordprocessingMLPackage wmlPackage, String imageDirPath, String imageTargetUri, OutputStream outputStream) throws Docx4JException
Docx4JException
protected static Exporter<HTMLSettings> getHTMLExporter(int flags)
Copyright © 2007-2019. All Rights Reserved.