2012-04-11 36 views
0
C:\Users\Agastheswar\Desktop\RESUME2.docx 
log4j:WARN No appenders could be found for logger (org.docx4j.utils.ResourceUtils). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
16 [main] INFO org.docx4j.utils.Log4jConfigurator - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically. 
32 [main] INFO org.docx4j.jaxb.Context - JAXB: RI not present. Trying Java 6 implementation. 
32 [main] INFO org.docx4j.jaxb.Context - JAXB: Using Java 6 implementation. 
32 [main] INFO org.docx4j.jaxb.Context - loading Context jc 
9813 [main] INFO org.docx4j.jaxb.Context - loaded com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl .. loading others .. 
10360 [main] INFO org.docx4j.jaxb.Context - .. others loaded .. 
10439 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Detected WordProcessingML package 
10458 [main] INFO org.docx4j.openpackaging.parts.Part - /_rels/.rels 
10458 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart 
10467 [main] INFO org.docx4j.openpackaging.parts.Part - /docProps/app.xml 
10467 [main] INFO org.docx4j.openpackaging.parts.DocPropsExtendedPart - unmarshalling org.docx4j.openpackaging.parts.DocPropsExtendedPart 
10474 [main] INFO org.docx4j.openpackaging.parts.Part - /docProps/core.xml 
10474 [main] INFO org.docx4j.openpackaging.parts.DocPropsCorePart - unmarshalling org.docx4j.openpackaging.parts.DocPropsCorePart 
10483 [main] INFO org.docx4j.openpackaging.parts.Part - /word/document.xml 
10483 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart - For MDP, unmarshall via binder 
10748 [main] INFO org.docx4j.openpackaging.parts.Part - /word/_rels/document.xml.rels 
10748 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart 
10751 [main] INFO org.docx4j.openpackaging.parts.Part - /word/fontTable.xml 
10821 [main] ERROR org.docx4j.XmlUtils - javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found 
Warning: Xalan jar missing from classpath; xslt not supported 
10823 [main] WARN org.docx4j.XmlUtils - Using default SAXParserFactory: null 
10824 [main] INFO org.docx4j.openpackaging.parts.Part - /word/styles.xml 
10850 [main] INFO org.docx4j.openpackaging.io.LoadFromZipNG - Encountered (but not loading) hyperlink mailto:[email protected] 
10851 [main] INFO org.docx4j.openpackaging.parts.Part - /word/numbering.xml 
10886 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Looking at extension 'xml 
10887 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Found content type 'application/xml' for /customXml/item1.xml 
10887 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/item1.xml 
10889 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/item1.xml 
10890 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/_rels/item1.xml.rels 
10890 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart 
10901 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/itemProps1.xml 
10903 [main] INFO org.docx4j.openpackaging.parts.Part - /word/webSettings.xml 
10906 [main] INFO org.docx4j.openpackaging.parts.Part - /word/settings.xml 
10936 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected 
10936 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss) 
10939 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart - encountered unexpected content; pre-processing 
11233 [main] ERROR org.docx4j.XmlUtils - Detected com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl, but require org.apache.xalan.transformer.TransformerImpl. Ensure Xalan 2.7.0 is on your classpath! 
11263 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected 
11263 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss) 
11264 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected 
11264 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss) 
11265 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected 
11265 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss) 
11266 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected 
11266 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss) 
11275 [main] WARN org.docx4j.openpackaging.contenttype.ContentTypeManager - DefaultPart used for part '/word/stylesWithEffects.xml' of content type 'application/vnd.ms-word.stylesWithEffects+xml' 
11278 [main] INFO org.docx4j.openpackaging.parts.Part - /word/stylesWithEffects.xml 
11296 [main] INFO org.docx4j.openpackaging.parts.Part - /word/theme/theme1.xml 
11296 [main] INFO org.docx4j.openpackaging.parts.ThemePart - unmarshalling org.docx4j.openpackaging.parts.ThemePart 
11469 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.getCssForTableCells(reference, node-set)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.getCssForTableCells(reference, node-set)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11472 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.createBlockForPPr(reference, node-set, string, result-tree)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.createBlockForPPr(reference, node-set, string, result-tree)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11473 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.createBlockForRPr(reference, string, node-set, result-tree)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.createBlockForRPr(reference, string, node-set, result-tree)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11473 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.SdtWriter.toNode(reference, node-set, result-tree)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.SdtWriter.toNode(reference, node-set, result-tree)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11473 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.model.images.WordXmlPictureE20.createHtmlImgE20(reference, reference, node-type)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.model.images.WordXmlPictureE20.createHtmlImgE20(reference, reference, node-type)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11474 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11476 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.model.images.WordXmlPictureE10.createHtmlImgE10(reference, reference, node-type)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.model.images.WordXmlPictureE10.createHtmlImgE10(reference, reference, node-type)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11501 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11501 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11501 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11502 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11502 [main] ERROR org.docx4j.XmlUtils - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
javax.xml.transform.TransformerException: Cannot convert argument/return type in call to method 'org.docx4j.convert.out.html.HtmlExporterNG2.notImplemented(node-type, string)' 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
11502 [main] ERROR org.docx4j.XmlUtils - Could not compile stylesheet 
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) 
    at org.docx4j.XmlUtils.getTransformerTemplate(XmlUtils.java:733) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.<clinit>(HtmlExporterNG2.java:126) 
    at CreateHtml.main(CreateHtml.java:51) 
13086 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/ALGER.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13102 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/BAUHS93.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13102 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/BERNHC.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13119 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/BROADW.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13134 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/CHILLER.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13165 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/ELEPHNTI.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13181 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/Gabriola.ttf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13197 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/GIGI.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13212 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/HARLOWSI.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13212 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/HARNGTON.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13212 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/HATTEN.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13212 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/impact.ttf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13228 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/ITCBLKAD.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13228 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/JOKERMAN.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13228 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/JUICE___.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13306 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/PLAYBILL.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13337 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/SNAP____.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13353 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/STENCIL.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13353 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/SWMacro.otf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13353 [main] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/C:/Windows/FONTS/TEMPSITC.TTF (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?) 
13415 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart - Style with name Normal, id 'Normal' is default paragraph style 
13431 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart - Style with name Default Paragraph Font, id 'DefaultParagraphFont' is default character style 
Exception in thread "main" java.lang.NullPointerException 
    at org.docx4j.XmlUtils.transform(XmlUtils.java:763) 
    at org.docx4j.XmlUtils.transform(XmlUtils.java:723) 
    at org.docx4j.convert.out.html.HtmlExporterNG2.html(HtmlExporterNG2.java:269) 
    at CreateHtml.main(CreateHtml.java:76) 

首先coudnt修復日誌文件接下來不可能理解的錯誤並修復它們 我用下面的代碼:錯誤運行docx4j createhtml.java文件

public class CreateHtml extends AbstractSample { 

    public static void main(String[] args) 
      throws Exception { 

     try { 
      getInputFilePath(args); 
     } catch (IllegalArgumentException e) { 

      inputfilepath = System.getProperty("user.dir") + "/sample-docs/word/sample-docx.xml"; 
     } 
     System.out.println(inputfilepath);   

     boolean save = true;    


     WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath)); 

     AbstractHtmlExporter exporter = new HtmlExporterNG2(); 

     HtmlSettings htmlSettings = new HtmlSettings(); 

     htmlSettings.setImageDirPath(inputfilepath + "_files"); 
     htmlSettings.setImageTargetUri(inputfilepath.substring(inputfilepath.lastIndexOf("/")+1) 
       + "_files"); 

     htmlSettings.setUserBodyTop("<H1>TOP!</H1>"); 
     htmlSettings.setUserBodyTail("<H1>TAIL!</H1>"); 



     SdtWriter.registerTagHandler(Containerization.TAG_BORDERS, new TagSingleBox()); 
     SdtWriter.registerTagHandler(Containerization.TAG_SHADING, new TagSingleBox()); 

     OutputStream os; 
     if (save) { 
      os = new java.io.FileOutputStream(inputfilepath + ".html"); 
     } else { 
      os = System.out; 

     } 

     javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(os); 
     exporter.html(wordMLPackage, result, htmlSettings); 
     if (save) { 
      System.out.println("Saved: " + inputfilepath + ".html using " + exporter.getClass().getName()); 
     } 

    } 
} 

這是我使用的代碼! !我已經給輸入文件的docx文件從桌面

回答

2

從您提供的日誌:

10821 [main] ERROR org.docx4j.XmlUtils - javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found 
Warning: Xalan jar missing from classpath; xslt not supported 
10823 [main] WARN org.docx4j.XmlUtils - Using default SAXParserFactory: null 

嘗試增加Xalan對你的classpath。

+0

感謝它的工作!!!但我不能轉換DOC文件,因爲他們沒有XML內容在代碼中應該改變什麼,以便它適用於文檔和DOCX? – user1162040 2012-04-12 10:46:02

+0

docx4j是爲更新的基於XML的.docx文件格式設計的解決方案(如其名稱所示)。它不適用於舊的二進制.doc文件格式。 – Ben 2012-04-16 15:44:36