I have downloaded ODFToolkit, and I don't have to setup OpenOffice. I can create odt file as following.
And my question is - May I read .doc
and .docx
files and save them as .odt
?
Could you help me please?
Here is the code:
import org.odftoolkit.odfdom.doc.OdfTextDocument;
import java.net.URI;
public class QuickOdt {
public static void main(String[] args) {
OdfTextDocument outputDocument;
try {
outputDocument = OdfTextDocument.newTextDocument();
outputDocument.addText("I'm using the ODFDOM toolkit!");
outputDocument.newParagraph();
outputDocument.newImage(new URI("images/odf-community.jpg"));
outputDocument.newParagraph("Bu bir taze paragrafdyr");
outputDocument.save("quick.odt");
} catch (Exception e) {
System.err.println("Unable to create output file.");
System.err.println(e.getMessage());
}
}
}