Page 1 of 1

Retain the bullet form while converting from docx to html

PostPosted: Sun Aug 10, 2014 2:08 am
by prashant3jan
Need to Retain the bullet format while converting from docx to html
I am converting docx to html but all the bullets forms are being converted into round bullet format.
I want to retain the bullet form.
I am using word 2007 to create the docx file.
I am using docx4j to convert the docx file to html.
I am using internet explorer 8 to view the html file.
Pls help, I have tried everything and have failed.

Re: Retain the bullet form while converting from docx to htm

PostPosted: Sun Aug 10, 2014 10:04 am
by jason
What bullets does your source docx contain?

Re: Retain the bullet form while converting from docx to htm

PostPosted: Sun Aug 10, 2014 8:10 pm
by prashant3jan
jason wrote:What bullets does your source docx contain?

Hi Jason,
many thanks for replying.
My docx contains the flower bullet:
I am using the below code to set it to a particular bullet type but even that is not happening

public class ConvertOutHtml extends AbstractSample {
String getMyDir(){
return "docx/testfile.docx";
}
String getMyDir1(){
return "html/testfile.html";
}
public static void main(String[] args){
try{
ConvertOutHtml coh = new ConvertOutHtml();
String inputfilepath = coh.getMyDir();
String outputfilepath = coh.getMyDir1();
// Document loading (required)
InputStream is = new FileInputStream(new File("docx/testfile.docx"));
// Create a docx
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(is);
// HTML exporter setup (required)
// .. the HTMLSettings object
HtmlSettings htmlSettings = new HtmlSettings();
String userCSS = "html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, img, ol, ul, li, table, caption, tbody, tfoot, thead, tr, th, td " +
"{ margin: 0; padding: 0; border: 0;}" +
"body {line-height: 1;} "+"li{list-style:square;}";
htmlSettings.setUserCSS(userCSS);
OutputStream out = new FileOutputStream(outputfilepath);
AbstractHtmlExporter exporter = new HtmlExporterNG2();
StreamResult result = new StreamResult(out);
exporter.html(wordMLPackage, result, htmlSettings);
System.out.println("Saved: ");
}catch(InvalidFormatException ife){
ife.printStackTrace();
}catch(Docx4JException d4je){
d4je.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
}

}