System.out.println(inputfilepath);
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
// HTML exporter setup
AbstractHtmlExporter exporter = new HtmlExporterNG2();
// .. the HtmlSettings object
HtmlSettings htmlSettings = new HtmlSettings();
htmlSettings.setImageDirPath(inputfilepath + "_files");
htmlSettings.setImageTargetUri(inputfilepath.substring(inputfilepath.lastIndexOf("/")+1)
+ "_files");
// htmlSettings.setUserBodyTop("<H1>TOP!</H1>");
// htmlSettings.setUserBodyTail("<H1>TAIL!</H1>");
// Sample sdt tag handler (tag handlers insert specific
// html depending on the contents of an sdt's tag).
// This will only have an effect if the sdt tag contains
// the string @class=XXX
// SdtWriter.registerTagHandler("@class", new TagClass() );
// SdtWriter.registerTagHandler(Containerization.TAG_BORDERS, new TagSingleBox() );
// SdtWriter.registerTagHandler(Containerization.TAG_SHADING, new TagSingleBox() );
// exporter writes to a Result object.
OutputStream os;
if (save) {
os = new java.io.FileOutputStream(inputfilepath + ".html");
} else {
os = new ByteArrayOutputStream();
}
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(os);
// OK, do it
exporter.html(wordMLPackage, result, htmlSettings);
if (save) {
System.out.println("Saved: " + inputfilepath + ".html using " + exporter.getClass().getName() );
} else {
System.out.println( ((ByteArrayOutputStream)os).toString() );
}
}