Page 1 of 1

WordprocessingMLPackage.load

PostPosted: Mon Sep 13, 2010 11:05 am
by bzha005
Hi Jason,

Currently WordprocessingMLPackage.load just accept File as it argument. In some cases, we need to passed in an inputstream, so should we have a signature which accept inputstream?

Re: WordprocessingMLPackage.load

PostPosted: Mon Sep 13, 2010 12:03 pm
by jason
The underlying LoadFromZipNG loads from an inputstream; you can use that directly.

OpcPackage.load is equally happy trying to load a package file (docx, pptx etc), or a so-called Flat OPC XML file.

The problem with adding an OpcPackage.load signature which accepts an input stream is that for consistency, this should also support a Flat OPC XML stream, which means sniffing the stream to determine which it is.

If you'd like to contribute the code, I'd be happy to add it. Otherwise, just use LoadFromZipNG's

Code: Select all
public OpcPackage get(InputStream is) throws Docx4JException


:-)

Re: WordprocessingMLPackage.load

PostPosted: Sun Sep 18, 2011 7:01 am
by aaymerich
Hi,

I've made a patch to load content(docx and xml) from inputstreams.

Regards
albert

Re: WordprocessingMLPackage.load

PostPosted: Tue Sep 20, 2011 11:35 pm
by jason
Thanks for this Albert; applied as http://www.docx4java.org/trac/docx4j/changeset/1667