Bug 60912 - Bullets font and color
Summary: Bullets font and color
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.15-FINAL
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-24 11:10 UTC by pooja.dhannawat535
Modified: 2022-12-27 09:08 UTC (History)
1 user (show)



Attachments
Extension of WordToHtmlConverter to avoid decimal font size issue. Details mentioned in comments (12.90 KB, text/x-java)
2017-05-29 07:09 UTC, pooja.dhannawat535
Details

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 3 Dominik Stadler 2022-12-27 09:08:02 UTC
Unfortunately this is not easy to apply to the existing WordToHtmlConverter, we would need a patch rather than a new implementation to include this.