Bug 60912

Summary: Bullets font and color
Product: POI Reporter: pooja.dhannawat535
Component: HWPFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal CC: pooja.dhannawat535
Priority: P2    
Version: 3.15-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Extension of WordToHtmlConverter to avoid decimal font size issue. Details mentioned in comments

Description pooja.dhannawat535 2017-03-24 11:10:19 UTC
I am trying to convert one doc file to html. I am not able to get the bullet's exact font and color  in output html document. Kindly help me on how to figure this out.
Comment 1 pooja.dhannawat535 2017-05-29 07:09:07 UTC
Created attachment 35010 [details]
Extension of WordToHtmlConverter to avoid decimal font size issue. Details mentioned in comments

I am using below code to convert doc to html.

 HWPFDocumentCore wordDocument = WordToHtmlUtils.loadDoc(new File(inFilePath));

        WordToHtmlConverter wordToHtmlConverter = new CustomWordToHtmlConverter(
                new HtmlDocumentFacade(DocumentBuilderFactory.newInstance().newDocumentBuilder()
                        .newDocument()));
        wordToHtmlConverter.processDocument(wordDocument);
        Document htmlDocument = wordToHtmlConverter.getDocument();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DOMSource domSource = new DOMSource(htmlDocument);
        StreamResult streamResult = new StreamResult(out);

        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer serializer = tf.newTransformer();
        serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        serializer.setOutputProperty(OutputKeys.INDENT, "yes");
        serializer.setOutputProperty(OutputKeys.METHOD, "html");
        serializer.transform(domSource, streamResult);
        BufferedWriter out1 = new BufferedWriter
                (new OutputStreamWriter(new FileOutputStream(new File(outFilePath)),"UTF-8"));
        out1.write(out.toString());
        out1.close();

Conversion seems to ignore fonts with size decimal values. Let's say if in original doc font has size 11.5 it will be 11 in converted html. I have made changes in CustomWordToHtmlConverter.java file to avoid this. But I am not able to get size of a bullet and the color of bullet. Kindly help me to get this issue resolved
Comment 2 pooja.dhannawat535 2017-05-29 07:13:49 UTC
Comment on attachment 35010 [details]
Extension of WordToHtmlConverter to avoid decimal font size issue. Details mentioned in comments

I am trying to convert doc to html. If doc has font size 11.5 the converted output html will have 11 as size. It's avoiding decimal values. TO avoid this issue I have overridden few methods in WordToHtmlConverter class provided by poi. But I am not able to capture the font size of bullet and bullet colour. Output html doesn't have bullet when customised code is added, I'm not able to retain the colour of the bullet. Kindly provide me solution for this