/** * Load a docx/pptx/xlsx from a File, where you know in advance what type (zip, compound, flat opc) * it is. Typically you'll cast the result to WordprocessingMLPackage or pptx/xlsx equivalent. * @since 6.0.0 */ public static OpcPackage load(final File inFile, Filetype type) throws Docx4JException { return OpcPackage.load(inFile); }
/** * Load a Docx Document from a File, assigning it an identifier for eventing * * @since 3.1.0 */ public static WordprocessingMLPackage load(PackageIdentifier pkgIdentifier, File inFile) throws Docx4JException { return (WordprocessingMLPackage)OpcPackage.load(pkgIdentifier, inFile); }
/** * Creates a <code>PresentationMLPackage</code> from an <code>InputStream</code>. * @param pptxInputStream an <code>InputStream</code> of a .pptx file * @return a <code>PresentationMLPackage</code> representing the .pptx file * @throws Docx4JException if an exception is encountered in processing */ public static PresentationMLPackage load(InputStream pptxInputStream) throws Docx4JException { return (PresentationMLPackage)OpcPackage.load(pptxInputStream); }
/** * Convenience method to create a WordprocessingMLPackage * or PresentationMLPackage * from an existing File (.docx/.docxm, .ppxtx or Flat OPC .xml). * * @param docxFile * The docx file */ public static OpcPackage load(final java.io.File docxFile) throws Docx4JException { return load(docxFile, ""); }
/** * Convenience method to create a WordprocessingMLPackage * from an existing File (.docx zip or .xml Flat OPC). * * @param docxFile * The docx file */ public static WordprocessingMLPackage load(java.io.File docxFile) throws Docx4JException { return (WordprocessingMLPackage)OpcPackage.load(docxFile); }
/** * Convenience method to create a WordprocessingMLPackage * or PresentationMLPackage * from an existing File (.docx/.docxm, .ppxtx or Flat OPC .xml). * * @param docxFile * The docx file * @since 3.1.0 */ public static OpcPackage load(PackageIdentifier pkgIdentifier, final java.io.File docxFile) throws Docx4JException { return load(pkgIdentifier, docxFile, null); }
/** * Convenience method to create a SpreadsheetMLPackage * from an existing File (.xlsx or .xml Flat OPC). * * @param xlsxFile * The xlsx file */ public static SpreadsheetMLPackage load(java.io.File xlsxFile) throws Docx4JException { return (SpreadsheetMLPackage)OpcPackage.load(xlsxFile); }
/** * Convenience method to create a WordprocessingMLPackage * from an existing stream(.docx zip or .xml Flat OPC). * * @param docxFile * The docx file */ public static WordprocessingMLPackage load(InputStream is) throws Docx4JException { return (WordprocessingMLPackage)OpcPackage.load(is); }
/** * Creates a <code>SpreadsheetMLPackage</code> from an <code>InputStream</code>. * @param xlsxInputStream an <code>InputStream</code> of an .xlsx file * @return a <code>PresentationMLPackage</code> representing the .xlsx file * @throws Docx4JException if an exception is encountered in processing */ public static SpreadsheetMLPackage load(InputStream xlsxInputStream) throws Docx4JException { return (SpreadsheetMLPackage)OpcPackage.load(xlsxInputStream); }
/** * Load a Docx Document from an InputStream, assigning it an identifier for eventing * * @since 3.1.0 */ public static WordprocessingMLPackage load(PackageIdentifier pkgIdentifier, InputStream inStream) throws Docx4JException { return (WordprocessingMLPackage)OpcPackage.load(pkgIdentifier, inStream); }
/** * Convenience method to create a PresentationMLPackage * from an existing File (.pptx or .xml Flat OPC). * * @param pptxFile * The pptx file */ public static PresentationMLPackage load(java.io.File pptxFile) throws Docx4JException { return (PresentationMLPackage)OpcPackage.load(pptxFile); }
/** * Convenience method to create a WordprocessingMLPackage * or PresentationMLPackage * from an inputstream (.docx/.docxm, .ppxtx or Flat OPC .xml). * It detects the convenient format inspecting two first bytes of stream (magic bytes). * For office 2007 'x' formats, these two bytes are 'PK' (same as zip file) * * @param inputStream * The docx file */ public static OpcPackage load(final InputStream inputStream) throws Docx4JException { return load(inputStream, ""); }
/** * convenience method to load a word2007 document * from an existing inputstream (.docx/.docxm, .ppxtx or Flat OPC .xml). * * @param is * @param docxFormat * @return * @throws Docx4JException * * @Since 2.8.0 */ public static OpcPackage load(final InputStream is, Filetype type) throws Docx4JException { return load(is, type, null); }
/** * convenience method to load a word2007 document * from an existing inputstream (.docx/.docxm, .ppxtx or Flat OPC .xml). * * @param is * @param docxFormat * @return * @throws Docx4JException * * @Since 2.8.0 */ public static OpcPackage load(final InputStream is, Filetype type, String password) throws Docx4JException { return load(null, is, type, password); }
/** * convenience method to load from a file, where you know the Filetype * (if it is Filetype.ZippedPackage, ZipFile will be used instead of ZipArchiveInputStream) * * @param is * @param docxFormat * @return * @throws Docx4JException * * @Since 6.0.0 */ public static OpcPackage load(final File file, Filetype type) throws Docx4JException { return load(file, type, null); }
/** * Convenience method to create a WordprocessingMLPackage * or PresentationMLPackage * from an inputstream (.docx/.docxm, .ppxtx or Flat OPC .xml). * It detects the convenient format inspecting two first bytes of stream (magic bytes). * For office 2007 'x' formats, these two bytes are 'PK' (same as zip file) * * @param inputStream * The docx file * * @since 3.1.0 */ public static OpcPackage load(PackageIdentifier pkgIdentifier, final InputStream inputStream) throws Docx4JException { return load(pkgIdentifier, inputStream, ""); }
public static GloxPackage load(java.io.File gloxFile) throws Docx4JException { return (GloxPackage)OpcPackage.load(gloxFile); }
/** * convenience method to load a word2007 document * from an existing inputstream (.docx/.docxm, .ppxtx or Flat OPC .xml). * Included for backwards compatibility * * @param is * @param docxFormat * @return * @throws Docx4JException */ @Deprecated public static OpcPackage load(final InputStream is, final boolean docxFormat) throws Docx4JException { return load(is); // check again, in case its a password protected compound file }
/** * @return * @throws Docx4JException * @since 3.0.0 */ public OpcPackage extractPackage() throws Docx4JException { return OpcPackage.load( BufferUtil.newInputStream(getBuffer())); }
/** @since 2.7.2 */ @Override public OpcPackage clone() { OpcPackage result = null; // Zip it up ByteArrayOutputStream baos = new ByteArrayOutputStream(); SaveToZipFile saver = new SaveToZipFile(this); try { saver.save(baos); result = load(new ByteArrayInputStream(baos.toByteArray())); } catch (Docx4JException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; }