Hello all,
I agree, look at POI. It worked perfectly for me for upload and download. I
put hereunder an example of code for download to an excel file.
Regards,
Jacques
public static void exportExcel(String file_name)
{
ArrayList states = OperatorsQ1.query();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet("operator_list_of_states");
HSSFRow rw1 = sh.createRow((short)sh.getLastRowNum()+1);
rw1.createCell((short)0).setCellValue("Operator:");
rw1.createCell((short)1).setCellValue(Operator.current_operator_code);
rw1.createCell((short)2).setCellValue(Operator.current_operator_name);
HSSFRow rw2 = sh.createRow((short)sh.getLastRowNum()+1);
rw2.createCell((short)0).setCellValue("Validity Period:");
rw2.createCell((short)1).setCellValue("from");
rw2.createCell((short)2).setCellValue(ValidityPeriod.fromDate.toQueryString(
));
rw2.createCell((short)3).setCellValue("to:");
rw2.createCell((short)4).setCellValue(ValidityPeriod.toDate.toQueryString())
;
HSSFRow rw3 = sh.createRow((short)sh.getLastRowNum()+1);
rw3.createCell((short)0).setCellValue("List of States");
for (int i = 0; i < states.size(); i ++)
{
HSSFRow rw4 = sh.createRow((short)sh.getLastRowNum()+1);
rw4.createCell((short)0).setCellValue((String) states.get(i));
}
try
{
FileOutputStream fileOut = new FileOutputStream(file_name);
wb.write(fileOut);
fileOut.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
-----Original Message-----
From: Borislav Sabev [mailto:[EMAIL PROTECTED]
Sent: 12 July 2005 09:12
To: Struts Users Mailing List
Subject: Re: Excel download
Senthilrajan VS wrote:
>Hi all,
>
>Is there any way in struts to download the page (view part) in Excel
>format.
>
>Thanks & Regards,
>SenthilRajan VS
>
>
Take a look at POI http://jakarta.apache.org/poi/
Regards
Borislav
____
This message and any files transmitted with it are legally privileged and
intended for the sole use of the individual(s) or entity to whom they are
addressed. If you are not the intended recipient, please notify the sender by
reply and delete the message and any attachments from your system. Any
unauthorised use or disclosure of the content of this message is strictly
prohibited and may be unlawful.
Nothing in this e-mail message amounts to a contractual or legal commitment on
the part of EUROCONTROL unless it is confirmed by appropriately signed hard
copy.
Any views expressed in this message are those of the sender.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]