You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by mrbains21 <mr...@gmail.com> on 2012/06/08 09:47:21 UTC

Can we create a word 2003 document file.

Hi my question is given a file name can we create a word 2003 document using
poi. I created .doc files in java but when i use them in poi it gives error
as unable to read heder etc. here is the snippet
f = new File(filename);
			try {
				//dont replace files
				//if (!f.exists()) {
					f.createNewFile();
				//}
			} catch (Exception e) {
				e.printStackTrace();
			}

so now is there a way to do same with some poi class?? as the files created
by the above code is not readable by my program, whereas if i create file
mannually by ms word it works.
 so can we create a new word file by a program using the poi api, and i
think that would be truncated or will be created so that i can further read
it in program and enter text in to it. please help!!

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Can-we-create-a-word-2003-document-file-tp5710091.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Can we create a word 2003 document file.

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Not as far as I am aware. I have not used the API for a very long time but it
certainly used to be the case that you had to have a existing binary Word
document, open it with HWPF and then modify it. This might not be the case
any longer as I have not used the API in anger for ages now and do not have
any up to date experience with it.

This is far from being a serious limitation in practice though. All you need
to do is create an empty document with Word, open that, modify it and then
save it away again under a different name. This is certainly the approach I
using the API.

Yours

Mark B 

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Can-we-create-a-word-2003-document-file-tp5710091p5710117.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Can we create a word 2003 document file.

Posted by mrbains21 <mr...@gmail.com>.
hey i am asking for the .doc document format. can i create .doc files with
poi??

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Can-we-create-a-word-2003-document-file-tp5710091p5710102.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Can we create a word 2003 document file.

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Sorry, but I am not at all clear what you are asking here. When you refer to
Word 2003 do you mean the transitional xml file format that Microsoft
introduced for that version of Office and that was subsequently superseded
by the Office Open XML file format? If so then no, it is not possible to
create a Word 2003 (.xml) format file using POI.

If this is not what you are asking, can you please explain again a little
more clearly what you are trying to create. To recap, there are, basically,
three different file format for Word files; binary (.doc), OOXML (.docx) and
the 'stop gap' xml file format where files typically have the extension .xml
in my experience.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Can-we-create-a-word-2003-document-file-tp5710091p5710096.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org