Hello All,
I use below commands to generate a Excel file:
DataOutputStream out = new DataOutputStream(new
FileOutputStream("e:/report.xls"));
out.writeBytes("Commerce ID");
out.write(9);
out.writeBytes("Name");
out.write(13);
out.write(10);
out.writeBytes("00667115");
out.write(9);
out.writeBytes("Cindy");
out.write(13);
out.write(10);
out.close();
Then I use below a set of commands to download the Excel file.
FileDAO fd=new FileDAO();
response.setHeader("Cache-Control", "no-cache");
File f=new File("e:/report.xls");
response.addHeader("Content-disposition", "inline; filename="
+f.getName());
ServletOutputStream out = response.getOutputStream();
FileInputStream in=new FileInputStream(f);
int b;
while ((b=in.read())!=-1){
out.write(b);
}
in.close();
out.close();
But the downloaded Excel file only show 667115, but not 00667115 that is output when
the file is generated. I know that it is due to the default Excel field format is
General, but not Text. Could please give me some advice about how to let the Excel
file's field default format is Text? In another words, let the field contains
00667115, but not 667115. Thanks.
Regards,
Xiaojing
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]