Table border and caption issue for PDF generation in docx4j -


i'm having issue getting table caption , border output in pdf. i'm using docx4j 3.0.0 had same issue 2.8.1.

i have xhtml fragment generated tinymce. processing way docx4j wants it, , convert openxml using xhtmlimporterimpl. use marshaller docx format working , docx4j.topdf pdf format. works cases, italics, underline, bold, alignment, images, etc.

when comes table caption , border, works in docx format, not pdf format. excludes table these properties. think xhtml -> openxml working properly, docx4j.topdf not supporting these properties or something. tried searching web no luck. wondering if knew this.

the error is

java.lang.stringindexoutofboundsexception: string index out of range: 9 @ java.lang.string.substring(string.java:1907) @ org.apache.fop.fo.expr.propertytokenizer.nextcolor(propertytokenizer.java:239) @ org.apache.fop.fo.expr.propertytokenizer.next(propertytokenizer.java:175) @ org.apache.fop.fo.expr.propertyparser.parseproperty(propertyparser.java:118) @ org.apache.fop.fo.expr.propertyparser.parse(propertyparser.java:91) @ org.apache.fop.fo.properties.propertymaker.make(propertymaker.java:438) @ org.apache.fop.fo.propertylist.convertattributetoproperty(propertylist.java:413) @ org.apache.fop.fo.propertylist.addattributestolist(propertylist.java:321) @ org.apache.fop.fo.fobj.processnode(fobj.java:122) @ org.apache.fop.fo.flow.table.tablefobj.processnode(tablefobj.java:232) ... caused by: org.docx4j.openpackaging.exceptions.docx4jexception: exception exporting package @ org.docx4j.convert.out.common.abstractexporter.export(abstractexporter.java:79) @ org.docx4j.docx4j.tofo(docx4j.java:467) @ org.docx4j.docx4j.topdf(docx4j.java:477) 

the openxml looks table

<w:tbl> <w:tblpr> <w:tblw w:w="0" w:type="auto"/> <w:tblcellspacing w:w="20" w:type="dxa"/> <w:tblind w:w="115" w:type="dxa"/> <w:tblborders> <w:top w:val="inset" w:color="#000000" w:sz="8"/> <w:left w:val="inset" w:color="#000000" w:sz="8"/> <w:bottom w:val="inset" w:color="#000000" w:sz="8"/> <w:right w:val="inset" w:color="#000000" w:sz="8"/> <w:insideh w:val="none"/> <w:insidev w:val="none"/> </w:tblborders> </w:tblpr> <w:tblgrid> <w:gridcol w:w="1045"/> <w:gridcol w:w="903"/> </w:tblgrid> <w:tr> <w:tc> <w:tcpr> <w:tcw w:w="1045" w:type="dxa"/> <w:tcborders> <w:top w:val="outset" w:color="#000000" w:sz="8"/> <w:left w:val="outset" w:color="#000000" w:sz="8"/> <w:bottom w:val="outset" w:color="#000000" w:sz="8"/> <w:right w:val="outset" w:color="#000000" w:sz="8"/> </w:tcborders> </w:tcpr> <w:p> <w:ppr> <w:spacing w:after="0"/> <w:ind w:left="0"/> <w:jc w:val="left"/> </w:ppr> <w:r> <w:rpr> <w:b w:val="false"/> <w:i w:val="false"/> <w:color w:val="000000"/> <w:sz w:val="22"/> </w:rpr> <w:t>col 1</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcpr> <w:tcw w:w="903" w:type="dxa"/> <w:tcborders> <w:top w:val="outset" w:color="#000000" w:sz="8"/> <w:left w:val="outset" w:color="#000000" w:sz="8"/> <w:bottom w:val="outset" w:color="#000000" w:sz="8"/> <w:right w:val="outset" w:color="#000000" w:sz="8"/> </w:tcborders> </w:tcpr> <w:p> <w:ppr> <w:spacing w:after="0"/> <w:ind w:left="0"/> <w:jc w:val="left"/> </w:ppr> <w:r> <w:rpr> <w:b w:val="false"/> <w:i w:val="false"/> <w:color w:val="000000"/> <w:sz w:val="22"/> </w:rpr> <w:t>col2</w:t> </w:r> </w:p> </w:tc> </w:tr> <w:tr> <w:tc> <w:tcpr> <w:tcw w:w="1045" w:type="dxa"/> <w:tcborders> <w:top w:val="outset" w:color="#000000" w:sz="8"/> <w:left w:val="outset" w:color="#000000" w:sz="8"/> <w:bottom w:val="outset" w:color="#000000" w:sz="8"/> <w:right w:val="outset" w:color="#000000" w:sz="8"/> </w:tcborders> </w:tcpr> <w:p> <w:ppr> <w:spacing w:after="0"/> <w:ind w:left="0"/> <w:jc w:val="left"/> </w:ppr> <w:r> <w:rpr> <w:b w:val="false"/> <w:i w:val="false"/> <w:color w:val="000000"/> <w:sz w:val="22"/> </w:rpr> <w:t>row1</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcpr> <w:tcw w:w="903" w:type="dxa"/> <w:tcborders> <w:top w:val="outset" w:color="#000000" w:sz="8"/> <w:left w:val="outset" w:color="#000000" w:sz="8"/> <w:bottom w:val="outset" w:color="#000000" w:sz="8"/> <w:right w:val="outset" w:color="#000000" w:sz="8"/> </w:tcborders> </w:tcpr> <w:p> <w:ppr> <w:spacing w:after="0"/> <w:ind w:left="0"/> <w:jc w:val="left"/> </w:ppr> <w:r> <w:rpr> <w:b w:val="false"/> <w:i w:val="false"/> <w:color w:val="000000"/> <w:sz w:val="22"/> </w:rpr> <w:t>table</w:t> </w:r> </w:p> </w:tc> </w:tr> </w:tbl> 

i think there's bug default border color going in #000000 instead of 000000. there workaround pre-processing xhtml?

duplicates question http://www.docx4java.org/forums/pdf-output-f27/tabl-caption-and-border-issue-docx4j-3-0-0-t1763.html

i'll update both when answered


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -