You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Alexandru, Ionita" <ga...@cstdev.cst.ro> on 2004/04/07 18:41:17 UTC
Example
can someone tell me where can I find some read/write word documents
samples?
I have to insert some text in a word document, after a specified
sequence of known text.
I've tried some code, but, the final word doc was corrupted
========================================================================
======
public static void main(String[] args){
try
{
HWPFDocument doc = new HWPFDocument (new FileInputStream
(args[0]));
Range r = doc.getRange();
r.insertAfter("this is the text that I wanna insert");
OutputStream out = new FileOutputStream(args[1]);
doc.write(out);
out.flush();
out.close();
}
catch (Throwable t){
t.printStackTrace();
}
}
========================================================================
=========
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org
RE: Example
Posted by "Alexandru, Ionita" <ga...@cstdev.cst.ro>.
I've tried again, but the same problem occurred, and the manifestation
was the same...
I don't know if the code is realy correct.
Thanks again!
> -----Original Message-----
> From: Ryan Ackley [mailto:sackley@cfl.rr.com]
> Sent: Thursday, April 08, 2004 3:52 PM
> To: POI Users List
> Subject: Re: Example
>
>
> I fixed this problem please try again
>
>
> ----- Original Message -----
> From: "Alexandru, Ionita" <ga...@mail.cst.ro>
> To: <po...@jakarta.apache.org>
> Sent: Wednesday, April 07, 2004 11:41 AM
> Subject: Example
>
>
> > can someone tell me where can I find some read/write word documents
> > samples?
> >
> > I have to insert some text in a word document, after a specified
> > sequence of known text. I've tried some code, but, the
> final word doc
> > was corrupted
> >
> >
> >
> ======================================================================
> > ==
> > ======
> >
> > public static void main(String[] args){
> > try
> > {
> > HWPFDocument doc = new HWPFDocument (new FileInputStream (args[0]));
> > Range r = doc.getRange();
> >
> > r.insertAfter("this is the text that I wanna insert"); OutputStream
> > out = new FileOutputStream(args[1]); doc.write(out);
> >
> > out.flush();
> > out.close();
> > }
> > catch (Throwable t){
> > t.printStackTrace();
> > }
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> ======================================================================
> > ==
> > =========
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org
Re: Example
Posted by Ryan Ackley <sa...@cfl.rr.com>.
I fixed this problem please try again
----- Original Message -----
From: "Alexandru, Ionita" <ga...@mail.cst.ro>
To: <po...@jakarta.apache.org>
Sent: Wednesday, April 07, 2004 11:41 AM
Subject: Example
> can someone tell me where can I find some read/write word documents
> samples?
>
> I have to insert some text in a word document, after a specified
> sequence of known text.
> I've tried some code, but, the final word doc was corrupted
>
>
> ========================================================================
> ======
>
> public static void main(String[] args){
> try
> {
> HWPFDocument doc = new HWPFDocument (new FileInputStream
> (args[0]));
> Range r = doc.getRange();
>
> r.insertAfter("this is the text that I wanna insert");
> OutputStream out = new FileOutputStream(args[1]);
> doc.write(out);
>
> out.flush();
> out.close();
> }
> catch (Throwable t){
> t.printStackTrace();
> }
> }
>
>
>
>
>
>
>
>
> ========================================================================
> =========
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org
Need help
Posted by gopal sharma <go...@translineindia.com>.
Hi Friends,
I want to send the contents of html page(jsp) to excel file.
This I want to happen on the click of the button.
I have written a function name
function jspToExcel()
{
<%
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=gopal.xls");
OutputStream output = response.getOutputStream();
wb.write(output);
out.close();
return;
%>
}
and I am calling this function on button click.
But when I try to execute the jsp page I get "Compilation Error"
If i remove "return " statement, I get illegalStateException.
Pl . help me where I am wrong.
As I have seen the others mail, I have tried to follow same thing.I have
included all library.
with regards
Gopal
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org
Re: Example
Posted by Ryan Ackley <sa...@cfl.rr.com>.
Your code should work, Do me a favor and post it as a bug with the Word
document attached and I will look at it tonight.
Thanks
Ryan
----- Original Message -----
From: "Alexandru, Ionita" <ga...@mail.cst.ro>
To: <po...@jakarta.apache.org>
Sent: Wednesday, April 07, 2004 12:41 PM
Subject: Example
> can someone tell me where can I find some read/write word documents
> samples?
>
> I have to insert some text in a word document, after a specified
> sequence of known text.
> I've tried some code, but, the final word doc was corrupted
>
>
> ========================================================================
> ======
>
> public static void main(String[] args){
> try
> {
> HWPFDocument doc = new HWPFDocument (new FileInputStream
> (args[0]));
> Range r = doc.getRange();
>
> r.insertAfter("this is the text that I wanna insert");
> OutputStream out = new FileOutputStream(args[1]);
> doc.write(out);
>
> out.flush();
> out.close();
> }
> catch (Throwable t){
> t.printStackTrace();
> }
> }
>
>
>
>
>
>
>
>
> ========================================================================
> =========
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org