• Post Reply Bookmark Topic Watch Topic
  • New Topic

Apache POI - HWPF writing a String

 
Pezhman Na
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a String to MS Word by Apache POI, but i could't find anything on google , could anybody suggest a sample code or which methods show how to do that? thanks
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this: http://faq.javaranch.com/java/CreateWordDocument
 
Pezhman Na
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:How about this: http://faq.javaranch.com/java/CreateWordDocument


thanks, informative, but produce lots of exceptions
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately my crystal ball is broken, so I can't read your screen and any exceptions it may contain. Care to TellTheDetails?
 
Pezhman Na
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:Unfortunately my crystal ball is broken, so I can't read your screen and any exceptions it may contain. Care to TellTheDetails?


sorry buddy, here they are :
Exception in thread "main" java.io.IOException: Unable to read entire header; 0 bytes read; expected 32 bytes
at org.apache.poi.poifs.storage.HeaderBlockReader.alertShortRead(HeaderBlockReader.java:157)
at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:85)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
at ms.main(ms.java:15)

I got more different exceptions ,but I could fix them, write now I get these for this code and simpler I wrote:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!