Free Support Forum -

Where Is the "How To"?

I am going to use the Aspose.Words for Java. Do I have to first download some JARs and put them in my application's WEB-INF\lib directory. And which packages am I supposed to import into my Java classes? In general, I am asking where to find the "How To" to use the Aspose.Words for Java. Thanks for your time and quidance.

In your target dir you should put following things from the distribution:

1) Aspose.Words for Java lib itself: Aspose.Words.jdk14.jar OR Aspose.Words.jdk15.jar (respectively to your target JVM);

2) If you are using XPath functionality of Aspose.Words, put also Jaxen JAR from the distribution;

3) Put the Aspose.Words for Java license file (if you already bought the product);

4) Put LICENSE*.txt files from the distribution root.

You need to import only one package: com.aspose.words.

In general, you can find basic info about distribution content in README file in the distribution root folder. Distribution also contains several demo-projects that demonstrate work under JDK 1.4, JDK 1.5 and simple web-application (under Tomcat servlet container). Each demo-project has IntelliJ IDEA 5.x project and module files – you can find some (obvious) settings in these files.

Best Regards,

Where to find the your Aspose.Words for Jave distribution and download it?

I clicked on the Downloads Tab at this web site and I saw the File Management products, Utility components, and Visual components.

I do not know which one/which ones to download. And I do not know which ones are for "Java". I "cannot" use the .NET.

Sorry I have not made it clear. The direct link is:

You will have found on this page both Aspose.Words for .Net and Aspose.Words for Java downloads.


Thanks a lot for your help. It is now very clear.

I am sorry. Things are still unclear. I am able to find the aspose.Words.jdk15.jar; but still do not know where to put them in the structure of my Java application. For example, I am using the Tomcat and my application is structured like:

$Catalina Home/webapps/ApplicationName/src

$Catalina Home/webapps/ApplicationName/WebContent/WEB-INF

Where do I put the Aspose.Words.jdk15.jar ?

And where do I put the LICENSE.txt file?

Thanks in advance.

Okay, I see you are only at the beginning of your way:) I wish you good lack with all these:)

For beginning I suggest you make and debug your Aspose.Words application without any overheads (like GUI, servlet containers and so one).

After you had debugged application itself, you can compile it as a WAR file and deploy it into Tomcat or any other servlet container. Deployment process can significantly differ from server to server but always it is a well-documented procedure. The same I can say about paths to libraries.

Anyway, if you download distribution you can see Aspose.Words.Demos.Web demo-project that works under Tomcat. If you launch this project under IntelliJ IDEA you can see how all these configured.

Best Regards,

My JAVA_HOME is C:/sun/AppServer/jdk

1. How do I make and debug my Aspose.Words application without any overheads (like GUI, servlet containers and so one)?

2, How do I structure my Aspose.Words application in the Windows Explorer? For example, I have C:\Test_Aspose_Words directory created.

3. Where do I put my Java class and the Aspose.Words.jdk15.jar, which is an executable jar?

4. I can see the LICENSE.txt bundled with the Aspose.Words download. Where is my directory structure I put that LINCENSE.txt?

I have drafted a Java class to generate the Word document. For testing purpose, I can hard code all texts instead of gettting them dynamically:


import java.util.List;

import java.util.ArrayList;





import java.awt.Color;

import com.aspose.words.*;

import org.apache.log4j.Logger;

public class GenerateAsposeWordsDocument


private static final Logger logger = Logger.getLogger( GenerateAsposeWordsDocument.class );

private static GenerateAsposeWordsDocument wordsDocumentInstance = null;

// for thread-safe purpose on a multi-processor system

public synchronized static GenerateAsposeWordsDocument getInstance()


if ( wordsDocumentInstance == null )


wordsDocumentInstance = new GenerateAsposeWordsDocument();


return wordsDocumentInstance;


public byte[] generate( List measurementSummaryHierarchy, int level )


ByteArrayOutputStream baos = new ByteArrayOutputStream();



Document wordMeasurementSummaryReport = new Document();


// check the package to import and the Java Date

wordMeasurementSummaryReport.CustomDocumentProperties.Add( "Creation Date", new DateTime(

//Creating a new section node

Section wordMeasurementSummaryReportSection = new Section( wordMeasurementSummaryReport );

//Appending section to the document

wordMeasurementSummaryReport.appendChild( wordMeasurementSummaryReportSection );

//Setting properties for the section



//Creating the wordMeasurementSummaryReportBody section for the document

Body wordMeasurementSummaryReportBody = new Body( wordMeasurementSummaryReport );

wordMeasurementSummaryReportSection.appendChild( wordMeasurementSummaryReportBody );

//Creating wordMeasurementSummaryReportParagraph for the wordMeasurementSummaryReportBody -- Title

Paragraph measurementSummaryTitle = new Paragraph( wordMeasurementSummaryReport );

wordMeasurementSummaryReportBody.appendChild( measurementSummaryTitle );

//Formatting the wordMeasurementSummaryReportParagraph

measurementSummaryTitle.getParagraphFormat().setStyleName( "Heading 1" );

measurementSummaryTitle.getParagraphFormat().setAlignment( ParagraphAlignment.CENTER );

//Create a run of text in the wordMeasurementSummaryReportParagraph.

Run titleRun = new Run( wordMeasurementSummaryReport );

titleRun.setText( ClientLocale.getResourceProperty( ClientLocale.SOME_CONSTANT ) );

titleRun.getFont().setColor( Color.BLACK );

measurementSummaryTitle.appendChild( titleRun );

String[] levelOne_list = measurementSummaryHierarchy.getFirstLevel();

for ( int i=0; i<levelOne_list.length; i++ )




Paragraph levelOneParagraph = new Paragraph( wordMeasurementSummaryReport );

wordMeasurementSummaryReportBody.appendChild( levelOneParagraph );

levelOneParagraph.getParagraphFormat().setStyleName("Heading 2");


// indentation is 1 inch by 72 points


Run levelOneParagraphRun = new Run( wordMeasurementSummaryReport );

levelOneParagraphRun.setText( "[" + levelOne_listIdea [I].getId() + "] " + levelOne_listIdea [I].getName());

levelOneParagraphRun.getFont().setColor( Color.BLACK );

levelOneParagraph.appendChild( levelOneParagraphRun );

} catch(Exception e)






// must determine save to what! baos, SaveFormat.FORMAT_DOCUMENT );

} catch( Exception e )


logger.error( "", e );


logger.debug( "Generated " + baos.size() + " byte Word report." );

return baos.toByteArray();



Okay, for the first time will be enough two lines:

Document doc = new Document("C:\\Test_Aspose_Words\\Docs\\Test.doc");"C:\\Test_Aspose_Words\\Docs\\Test Out.doc");

along with the import statement and any MS Word doc saved to C:\Test_Aspose_Words\Docs\Test.doc.

You can place these lines inside a main() proc or inside a test unit – it is for your taste. And try do not use all these pretty things like logging and exception handling while you testing such a basic staff as an access to a library. You can add it later.

What IDE are you using? Is it your first java application?

You can place your test project inside your C:\Test_Aspose_Words folder. Any modern IDE will create for you all needed src and out dirs.

You can extract Aspose.Words for Java distributive wherever you want, you only need in tune up your IDE paths to Aspose.Words.jdk15.jar and to Javadoc folder named “apidoc”.


Thank you for showing me running a simple test to figure out accessing to the Aspose.Words.jdk15.jar. Things seem to work now.