Install Aspose.Words.jdk16.jar to local maven repository:
MVN install:install-file-dfile=aspose.words.jdk16.jar-dgroupid=com.aspose-dartifactid=aspose-words-dversion= 13.9.0.0-dpackaging=jar
Dependencies in the Pom.xml file:
<Dependency> <groupId>Com.aspose</groupId> <Artifactid>Aspose-words</Artifactid> <version>13.9.0.0</version></Dependency>
License.xml files are placed in the Resource directory:
<License> <Data> < Products> <Product>Aspose.total for Java</Product> <Product>Aspose.words for Java</Product> </ Products> <Editiontype>Enterprise</Editiontype> <Subscriptionexpiry>20991231</Subscriptionexpiry> <Licenseexpiry>20991231</Licenseexpiry> <serialnumber>23dcc79f-44ec-4a23-be3a-03c1632404e9</serialnumber> </Data> <Signature>snllkgmudf0r8o1kkilwagdgfs2bvjb/2xp8p5iudvfzxmhppo+d0ran1p9tkdjv4abwagkxxj3jcqtqe/ 2irfqwnpf8itn8afzlv3tjpyed3ywe7it55gz6eijupc7akeoohtb4w2fpox58wwof3snp6sk6jdfiaugehyj9pju=</Signature></License>
HTML File to Doc Demo:
PackageCom.demo.core.util;Importcom.aspose.words.Document;ImportCom.aspose.words.License;Importcom.aspose.words.LoadOptions;Importfreemarker.template.Configuration;Importfreemarker.template.Template;ImportOrg.apache.logging.log4j.LogManager;ImportOrg.apache.logging.log4j.Logger;ImportJava.io.*;ImportJava.util.Map; Public classWordutil {Private Static FinalLogger Logger =Logmanager.getlogger (); Private Staticstring Getwebrootabsolutepath () {string FolderPath= Wordutil.class. Getprotectiondomain (). Getcodesource (). GetLocation (). GetPath (); //if (Folderpath.indexof ("Web-inf") > 0) { returnFolderpath.substring (0, (Folderpath.indexof ("classes") + "classes". Length ())); //} } /*** Get registration file*/ Public Static voidGetlicense () {String path= Getwebrootabsolutepath () + "/license.xml"; InputStream is; Try{ is=NewFileInputStream (NewFile (path)); License License=NewLicense (); License.setlicense (IS); } Catch(FileNotFoundException e) {logger.error ("License.xml File not Found"); } Catch(Exception e) {logger.error ("License Register Failed"); } } Public Static voidMain (string[] args)throwsException {getlicense (); Loadoptions loadoptions=Newloadoptions (); Loadoptions.setloadformat (Com.aspose.words.LoadFormat.HTML); Document Doc=NewDocument ("c:\\users\\gebron\\desktop\\a.html", loadoptions); Doc.save ("C:\\users\\gebron\\desktop\\123.doc"); }}
Aspose.Words.jdk16.jar Download:
http://download.csdn.net/download/gebron/9898668
Aspose.words for Java Example