Pledgie



if you think this library has been useful, feel free to give any help. Don't be shy.


Click here to lend your support to: Java2word, coding for fun! and make a donation at www.pledgie.com !

how to implement a new element

project moved to: https://github.com/leonardoanalista/java2word

11 comments:

  1. Hi Leonardo,

    I'm a totally new Android-App developer using the latest Eclipse without Tomcat, I'm loving Java2Word - it's perfect for my needs.

    I'm having a problem testing - I would like to use Option 2 to create the document.

    I've found the build.properties.EXAMPLE but I don't know where it's supposed to go in eclipse - it says to copy the file, what do I save it as? .java?

    Thanks in advance
    Heather

    ReplyDelete
    Replies
    1. Hi Heather
      Save in the same directory with name: "build.properties". You should have both files in the same directory.

      You should now be able to run in your eclipse the ant task "aabuild".

      You only need to set up the environment if you are gonna implement something new on java2word or just for curiosity. If you will only use it, just need the jar file.
      let me know if you need something else, cheers Leonardo

      Delete
  2. WOW...

    Impressed with the speed of your reply!

    Thanks for the information :), I have one last question ->

    with the jar file - where does it create the document? In my app I'm creating an App-folder on the sd card and I'd like the document to go there, how do I find these details?

    Heather

    ReplyDelete
    Replies
    1. Lets image you have your document variable

      IDocument myDoc = new Document2004();
      //add my content here...

      at this point, you could do this:

      String docString = myDoc.getContent();

      Variable "docString" is the XML representation of your MS Word document.

      Now you get this variable and create the physical file with name "something.doc".

      The file creation is up to your application but you could take a look at this class:

      TestUtils.createLocalDoc(myDoc.getContent());

      maybe checkout the svn code and follow this method. It is pretty simple. Something like this:


      File fileObj = new File("/sd_root/whocares/filename.doc");

      PrintWriter writer = null;
      try {
      writer = new PrintWriter(fileObj);
      } catch (FileNotFoundException e) {
      e.printStackTrace();
      }

      writer.println(docString);
      writer.close();

      Write here later how you intent to use java2word with android apps. Some guys did something similar but I forgot to ask for more details... so that we can adapt java2word for android in the future.

      The email notification popped up just when I was about to sleep.

      Delete
    2. Hi,

      I have not been able to get it to write the document to the SD card -> used
      Environment.getExternalStorageDirectory() ;
      to find the path, have added the permission to the manifest but still it crashes when trying to run :(. It's not as straightforward as it seems although it's probably my lack of java programming skills.

      Thanks anyway for your help

      Delete
    3. I know nothing about Android apps. You challenge is to write on the SD card. The rest should be fine.

      Delete
  3. Hi...
    i am developing android application which generates report....
    initially i was using iText library for generating pdf's but after trying anything, i came to know that any versions of iText is android compatiable... because it uses java.awt.Color class which is not in android...

    can i use this library for generating report in doc format, generated report should consists of tables, different font and styles.. ?
    and where can i find documentation for this ?
    kindly suggest me please....

    ReplyDelete
    Replies
    1. I know nothing about androids. Some guys managed to get java2word running on it but I have no idea how. Sorry can't help you on this.

      Delete
  4. Hello, I'm using Java2word with x-tream for insert images in my doc. Everything runs right and don't show any problem. But when I open my doc, the image isn't there.

    Can you help me, please?

    I'm using linux and Libre office, I don't know if this settings don't work with java 2 word.

    ReplyDelete
  5. Hey I am finding this very interesting great work.
    My only doubt is how can I append HTML tag template to a doc file using this api.
    I would highly appreciate your prompt reply.

    ReplyDelete