Hello!
I am trying to save docx to html converted data to many streams:
InputStream is = new FileInputStream(filePath + "dok1.docx");
ByteArrayOutputStream os = new ByteArrayOutputStream();
Document docx = new Document(is);
File imagesDirr = new File(filePath, "Images");
if (imagesDirr.exists()) imagesDirr.delete();
imagesDirr.mkdir();
HtmlSaveOptions optionss = new HtmlSaveOptions(SaveFormat.HTML);
optionss.setExportTextInputFormFieldAsText(true);
optionss.setImagesFolder(imagesDirr.getPath());
optionss.setExportHeadersFootersMode(ExportHeadersFootersMode.FIRST_PAGE_HEADER_FOOTER_PER_SECTION);
optionss.setDocumentSplitCriteria(DocumentSplitCriteria.SECTION_BREAK);
docx.save(os, optionss);
When I run code I have this error message for (1) line:
Exception in thread “main” java.lang.IllegalStateException: Document part file cannot be written. When saving the document either output file name should be specified or custom streams should be provided via DocumentPartSavingCallback. Please see documentation for details.
I read that I should set properties to save via DocumentPartSavingCallback (as in error message) but I have no idea how to do this.
Please help.