1

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());
        }
    }
}
mtk
  • 13,221
  • 16
  • 72
  • 112
serdar
  • 337
  • 1
  • 2
  • 9

1 Answers1

0

You should look into Apache POI for reading word documents, and Apache OpenOffice Writer for writing into odt format.

mtk
  • 13,221
  • 16
  • 72
  • 112