i am a newbie at java programming. i have been tasked with evaluating the aspose.word for java. i downloaded the demo zip file. i have tried to add some of the .java files to a new java project that i created just for testing the aspose evaluation version.
can your demo version be used in this way?
i would like to manipulate the existing data in our database and output it in a doc, html, and pdf format.
do you have any more detailed documentation on how i can start doing this? also, where do i get the models/beans for document.java and documentbuilder.java?
Please be more specific in what you are going to do. Application data manipulation is not what Aspose.Words intended for. But you really can populate data into a word document using Mail Merge techniques or many other useful features. If you explain the task we can give more advice how to solve it. Once you have downloaded the distribution you can study from the demo application bundled with it.
You can refer to this page with Java package documentation:
Thank you for your response. I have created a Java web application, where users can enter and edit data. The users can also output the data into a report (MS Word document) by clicking a submit button (very similar to your “Generate” button on aspose.words.demos).
We would like to be able to output the data in italics, Rich Text Format, and HTML hyperlinks. We would also like to output an image to the report.
Is it possible to test this out? Do you have any documentation on how I can integrate this into my Java application?
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
//Insert italic text
builder.setItalic(true);
builder.writeln("this is italic text");
//Clease text formating
builder.clearRunAttrs();
//Change text color
builder.getFont().setColor(new Color(0, 0, 255));
//Set underline
builder.setUnderline(Underline.SINGLE);
//Insert hyperlink
builder.insertHyperlink("Aspose", "http://www.aspose.com", false);
//Insert image into the document
builder.insertImage("C:\\Temp\\test.jpg");
doc.save("out.doc");
Unfortunately Aspose.Words for java doesn’t support RTF format. This feature will be implemented later hopefully in second half of this year.
Thanks! I was able to output to a Word document. However, I had to comment out the line builder.getFont().setColor(new Color(0, 0, 255));. I get the following error when I leave this line in:
cannot find symbol
[javac] symbol : class Color
[javac] location: class com.aspose.web.action.StartAction
[javac] builder.getFont().setColor(new **Color**(0, 0, 255));
[javac] ^
Borders are disabled by default. When you open the generated document using MS Word you should select “Hide Gridlines” from “Table” menu. You can’t hide gridlines using Aspose.Words because “Table / Hide Gridlines” is option of MSWord.
Unfortunately, java version of Aspose.Words doesn’t support PDF format yet. We are planning the complete reengineering of PDF module in .Net baseline. Only after the reengineering PDF module will be ported to Java.
Doc2Pdf demo just shows how Aspose.Words document model can be used to generate documents in arbitrary formats. It uses iText third-parity library to generate simplistic PDF from Aspose.Words document model. iText (and PDF!) was chosen randomly – it’s can be any other format and library.
So. If you need in real PDF (with images, accurate formatting and so one) you have to wait about a year or half a year when PDF module will be reengineered and ported to java.