I am a very new user to docx4j. It's has great potential for allowing our users to author documents/articles in Word without having to touch an XML editor.
One problem that I need to solve is that I think I need a package: org.docx4j.convert.out.xml (similar to .....html) that will allow custom conversion from docx to our proprietary XML format.
I have been trying to use org.docx4j.convert.out.html.HtmlExporterNG2 with the sample class org.docx4j.samples.ConvertOutHtml and I have had some success but I need to save various calls in the stylesheet (docx2xhtml.xslt) to variables to later restyle.
Here is an example that I would need to rework:
- Code: Select all
<xsl:copy-of select="java:org.docx4j.model.images.WordXmlPictureE20.createHtmlImgE20(
$conversionContext,
$wpinline)" />
// changed to
<xsl:variable name="image" select="java:org.docx4j.model.images.WordXmlPictureE20.createHtmlImgE20(
$conversionContext,
$wpinline)" />
<xsl:varliable name="path" select="$image//@src"/>
<build custom tag here>
I guess I am looking for the best approach. If I am using it then great! But I don't think I am. Ideally I would love to beable to perhaps map word xml elements to our custom xml elements.
For example
- Code: Select all
w:p = Para
w:tbl = Table
w:drawing = StillImageExhibit
w:p[w:pPr/w:pStyle/@w:val = "ListParagraph'] = ListItem
or allow the user to pass in the tag they want to generate when converting w:p to Para.
I started to create org.docx4j.convert.out.xml locally but I didn't want to go to far before a posted something.
Thanks in advance.