添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This code works for some DOCX files, but it fails for others.
Example DOCX file failing: https://www.dropbox.com/s/460gn3sjwpurpsk/test.docx?dl=0

XWPF2XHTMLConverter.getInstance.convert(
  new FileInputStream("/tmp/in.docx"), 
  new FileOutputStream("/tmp/out.html"), 
  Options.getFrom( "DOCX" ))
Exception in thread "main" fr.opensagres.xdocreport.converter.XDocConverterException: fr.opensagres.poi.xwpf.converter.core.XWPFConverterException: org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: union value '#000000' does not match any members of 'ST_HexColor in namespace http://schemas.openxmlformats.org/wordprocessingml/2006/main'
	at fr.opensagres.xdocreport.converter.docx.poi.xhtml.XWPF2XHTMLConverter.convert(XWPF2XHTMLConverter.java:72)
Caused by: fr.opensagres.poi.xwpf.converter.core.XWPFConverterException: org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: union value '#000000' does not match any members of 'ST_HexColor in namespace http://schemas.openxmlformats.org/wordprocessingml/2006/main'
	at fr.opensagres.poi.xwpf.converter.xhtml.XHTMLConverter.convert(XHTMLConverter.java:78)
	at fr.opensagres.poi.xwpf.converter.xhtml.XHTMLConverter.doConvert(XHTMLConverter.java:64)
	at fr.opensagres.poi.xwpf.converter.xhtml.XHTMLConverter.doConvert(XHTMLConverter.java:39)
	at fr.opensagres.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:46)
	at fr.opensagres.xdocreport.converter.docx.poi.xhtml.XWPF2XHTMLConverter.convert(XWPF2XHTMLConverter.java:67)
	... 11 more
Caused by: org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: union value '#000000' does not match any members of 'ST_HexColor in namespace http://schemas.openxmlformats.org/wordprocessingml/2006/main'
	at org.apache.xmlbeans.impl.values.XmlUnionImpl.set_text(XmlUnionImpl.java:154)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1135)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.check_dated(XmlObjectBase.java:1274)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.isNil(XmlObjectBase.java:630)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.java_value(XmlObjectBase.java:2805)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.objectValue(XmlObjectBase.java:1599)
	at org.apache.xmlbeans.impl.values.XmlObjectBase.getObjectValue(XmlObjectBase.java:1530)
	at org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTColorImpl.getVal(Unknown Source)
	at fr.opensagres.poi.xwpf.converter.core.utils.ColorHelper.getColor(ColorHelper.java:65)
	at fr.opensagres.poi.xwpf.converter.core.styles.run.RunFontColorValueProvider.getValue(RunFontColorValueProvider.java:42)
	at fr.opensagres.poi.xwpf.converter.core.styles.XWPFStylesDocument.getFontColor(XWPFStylesDocument.java:679)
	at fr.opensagres.poi.xwpf.converter.xhtml.internal.styles.CSSStylesDocument.createCSSStyle(CSSStylesDocument.java:291)
	at fr.opensagres.poi.xwpf.converter.xhtml.internal.styles.CSSStylesDocument.createCSSStyle(CSSStylesDocument.java:251)
	at fr.opensagres.poi.xwpf.converter.xhtml.internal.XHTMLMapper.visitRun(XHTMLMapper.java:244)
	at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitRuns(XWPFDocumentVisitor.java:647)
	at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraphBody(XWPFDocumentVisitor.java:467)
	at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraph(XWPFDocumentVisitor.java:358)
	at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitBodyElements(XWPFDocumentVisitor.java:231)
	at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:183)
	at fr.opensagres.poi.xwpf.converter.xhtml.XHTMLConverter.convert(XHTMLConverter.java:74)
	... 15 more