Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InputStream is = null;
- ByteArrayOutputStream memoryStream=null;
- ContentReader oWORDContent=null;
- WordprocessingMLPackage wordMLPackage=null;
- try {
- memoryStream = new ByteArrayOutputStream();
- // Get the document from the repo
- NodeRef oNodeRef = new NodeRef("workspace","SpacesStore",docRef);
- oWORDContent = getReader(oNodeRef);
- // Get content into InputStream
- is = oWORDContent.getContentInputStream();
- try {
- wordMLPackage = WordprocessingMLPackage.load(is);
- //custom properties
- org.docx4j.openpackaging.parts.DocPropsCustomPart docPropsCustomPart = wordMLPackage.getDocPropsCustomPart();
- // DO things here regarding the properties...
- System.out.println("before save");
- // save to a memory stream
- wordMLPackage.save(memoryStream);
- System.out.println("after save");
- }
- catch (Docx4JException e) {
- System.out.println("error1" );
- } catch (Exception e) {
- System.out.println("error2" );
- }
- // do something here with bytearray... cant reach this
- }
- catch (IOException e)
- {
- System.out.println("error3");
- }
- catch(Exception e){
- System.out.println("error4");
- }
- finally
- {
- System.out.println("I reach this...");
- }
- I can load and get the properties of the document.
- debug info: I have an error but it doesnt seems to have to do with the save method, because I can reach "before save" after.
- ERROR [docx4j.jaxb.NamespacePrefixMapperUtils] [http-apr-8080-exec-9] name: com.sun.xml.internal.bind.namespacePrefixMapper value: org.docx4j.jaxb.NamespacePrefixMapperSunInternal@3332d32c .. trying RI.
- before save
- I reach this...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement