Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!

Matteo Tassinari

Greenhorn
+ Follow
since Jul 08, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matteo Tassinari

oh my! I must be blind, I didn't see the getBytes() method!

I completely skipped the initial section, looking for something that sounded like "toByteArray()"... Now I know why I didn't find it!
10 years ago
And how do I convert a String into a ByteArray? There seems to be no method capable of doing this. Or, at least, I haven't seen it in the API documentation.
10 years ago
Hi everybody

as the topic title suggests, I'd like to see if there is some way to create an InputStream from a String. The only way I've been able to find, searching in the Java API documentation, is to create a StringBufferInputStream, but that's a deprecated class and so I do not really like this method.

Does any of you know if there is another method?
10 years ago
That could be an idea, but since this "merging" solution will need to get installed on our customers computers (because it would obviously be shipped in bundle with our software, a web-based AMP application), I do not think they'd accept to have an openoffice server running on their computers. And this would also require major modifications of our software, that would not be really cost-effective

Basically my conclusion is that you cannot 'really append' one word document to another using POI.
The best you could do is extract the text and text format and append it to another document. This will work only in case of really simple work documents.



Uhm, that doesn't sound good for me. The documents I need to merge together are all full of tables, images, and also uses different styles.

I was hoping to find a way to do this in Java 'cause if there is one, then the company for which I work wouldn't need to completely rewrite the reporting utility of our software (which is based on tomcat and Java servlets).
Hi everybody!

I think that the topic title says almost all about it, but I'll try to be more specific: I have a tomcat servlet which prints out a bunch of .doc files (which are created using JasperReports if this is important) and I need to take those files and put them all in a single file.

Googling around I found this "POI" project which seems to enable Java programmers to be able to manipulate Microsoft Office files (and so also .doc file) using their API, which I downloaded the last version. But I'm not really sure about how actually do this.

Here is what I was thinking to do, from a very high-level point of view:
- create an empty HWPF document
- read the first .doc file into another HWPF document
- copy the content from the last created document to the empty one
- read the second .doc file
- and so on...

Can any of you please help me understand how to implement this? Thank you very much in advance.