https://bz.apache.org/bugzilla/show_bug.cgi?id=60500

            Bug ID: 60500
           Summary: Incorrect rowspan attribute value when converting a
                    Word file containing a table with merged rows to HTML
           Product: POI
           Version: 3.15-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HWPF
          Assignee: dev@poi.apache.org
          Reporter: tbrie...@gmail.com
  Target Milestone: ---

Created attachment 34538
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34538&action=edit
Word file containing a table with merged rows

Hi,

The attached Word document contains a table with multiple merged rows and
columns. The following Java 8 code converts this document into HTML.

//----
FileInputStream fileInputStream = new FileInputStream(file); //
HWPFDocumentCore wordDocument = AbstractWordUtils.loadDoc(fileInputStream);
WordToHtmlConverter wordToHtmlConverter = new
WordToHtmlConverter(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);
out.close();

System.out.println(new String(out.toByteArray(), StandardCharsets.UTF_8));
//----

In the generated HTML (see attached HTML), the "td" element corresponding to
the lower right table cell contains a "rowspan" attribute with a value of "8"
but this value should be "9" according to the original table layout.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to