thuliobuarque / java2word

Automatically exported from code.google.com/p/java2word
0 stars 0 forks source link

Provide support for open office #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
My concern is about the fact that, Java2Word is working fine in MS Office(Word) 
but the document so formed is getting rendered in Open Office in a completely 
different format.

So can you please let me know , how to deal with this situation.

Waiting for reply.

Regards

Original issue reported on code.google.com by ankur881...@gmail.com on 14 Jun 2011 at 12:15

GoogleCodeExporter commented 8 years ago
can you pls attach screenshot(not the  doc files) of both documents and the 
code that you wrote?
what is your OS?

thanks 
Leonardo

Original comment by leonardo...@gmail.com on 15 Jun 2011 at 12:22

GoogleCodeExporter commented 8 years ago
I am attaching the word file generated along with the code.

Code:
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

import word.api.interfaces.IDocument;
import word.w2004.Document2004;
import word.w2004.elements.Heading2;

public class Java2Word {
    public static void main (String[] args){
        try{
            File newDocument = new File("C:\\Java2Word.doc");
            PrintWriter writer = new PrintWriter(newDocument);
            IDocument iDocument = new Document2004();
            iDocument.addEle(Heading2.with("===== Hello World ======").create());
            String text = iDocument.getContent();
            writer.println(text);
            writer.close();
        } catch(IOException ioException){
            ioException.printStackTrace();
        }
    }
} 

Please open this file in OpenOffice.
Regarding my OS: I am using windows XP SP2

Original comment by ankur881...@gmail.com on 15 Jun 2011 at 11:09

Attachments:

GoogleCodeExporter commented 8 years ago

hey mate, sorry for the late reply. This is not a new issue.

pls take a look at this issue, comment 3: 
http://code.google.com/p/java2word/issues/detail?id=4&can=1&q=openoffice

Thake a look at this one as well:
http://code.google.com/p/java2word/issues/detail?id=16&can=1&q=openoffice

This guy friendly made some experiments "stein.st...@gmail.com"

thanks a lot Stein!

cheers
Leonardo

Original comment by leonardo...@gmail.com on 20 Jun 2011 at 8:41

GoogleCodeExporter commented 8 years ago
Thanks for the reply.

But still I am unable to solve the problem.

So can you please mention the changes in the file I had attached previously, so 
that 
it will open in both MS Office and Open Office.

Waiting for reply.

Regards

Original comment by ankur881...@gmail.com on 21 Jun 2011 at 2:03

GoogleCodeExporter commented 8 years ago
Hi Arkur881

I thought that by renaming the file to .xml would work fine in openoffice, but 
didn't at all.

You said that in openoffice renders "completely different format". In my case, 
in linux-libreoffice doesn't even open. 

What you mean with "render"? Does it open at least? that's why I asked you to 
attach screen shot of the unwanted result.

I think that all research done by stain.st(issue 4 and issue 16) was in Windows.

I chanced this to a task: "make java2word document be open in MS Word and 
Open(Libre) Office in Windows and Linux"

There are some tweaks to make it open properly and we need to document this 
because even I don't remember after some months. 

I am going on holidays in 2 days, for a month. Depending on the work I won't be 
able to do before the trip...

I need to see the screenshot as I asked ok. Thanks for your collaboration!

cheers
Leonardo Correa   

Original comment by leonardo...@gmail.com on 23 Jun 2011 at 12:14

GoogleCodeExporter commented 8 years ago

Original comment by leonardo...@gmail.com on 23 Jun 2011 at 12:14

GoogleCodeExporter commented 8 years ago
I am attaching the screen shots, as you wished.

Please try to give some solution before your vacation.

Regards

Original comment by ankur881...@gmail.com on 23 Jun 2011 at 4:03

Attachments:

GoogleCodeExporter commented 8 years ago
yeah, it opens but doesn't render. I got the same result in Linux with Open and 
Libre Office.

unfortunately I won't be able to solve research this before I go. This research 
would require a lot of time: generate the file, change XML, change extension, 
try different combinations, MS office on Windows, Open Office on Windows/Linux, 
Libre Office in Linux/Windows.  

thanks for your collaboration mate. 

cheers
Leonardo 

Original comment by leonardo...@gmail.com on 23 Jun 2011 at 11:33

GoogleCodeExporter commented 8 years ago
Hi, Does this bug got resolved? I am using java2word jar to generate word 
documents. Word document looks good in Microsoft word but when I open it in 
openoffice.org it shows xml tags. I am attaching converted pdf file of the word 
doc opened using openoffice. Please let me know is there anything else I need 
to do.

Regards,
Prachi

Original comment by prachi.a...@gmail.com on 1 Nov 2011 at 4:36

Attachments:

GoogleCodeExporter commented 8 years ago
not yet. There is something to be discovery and modified in the first line I 
guess: 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?mso-application 
progid="Word.Document"?>
We need to find a way to work in both. So still yet to be resolved. 

Leonardo

Original comment by leonardo...@gmail.com on 1 Nov 2011 at 10:40

GoogleCodeExporter commented 8 years ago
Thanks Leonardo.

Original comment by prachi.a...@gmail.com on 2 Nov 2011 at 7:03

GoogleCodeExporter commented 8 years ago
try to rename the file to .xml. 
OpenOffice doesn't like MLWord doc renamed to .doc. 
I am still trying to find a way around.

Original comment by leonardo...@gmail.com on 2 Nov 2011 at 11:54

GoogleCodeExporter commented 8 years ago
I renamed file to .xml but it doesn't show any data. Not even xml tags.
Thanks for looking at this. I really liked this library and document looks good 
in MS Word.

Original comment by prachi.a...@gmail.com on 4 Nov 2011 at 9:43

GoogleCodeExporter commented 8 years ago
thanks for you feedback mate. I am trying to find a way to work in MSWord and 
OppenOffice but I haven't found out yet. This is the main thing I will try to 
get done soon.
Leonardo 

Original comment by leonardo...@gmail.com on 4 Nov 2011 at 11:35

GoogleCodeExporter commented 8 years ago
I found that renaming the file to .docx works for me

Original comment by gpbo...@gmail.com on 18 Jan 2012 at 1:20