Howdy,
Yup, Senor Wingfield's suggestion is referred to as "ticking" the cell.

The other thing you can do is write out Excel XML (only if you have
Office XP or later).  It's actually a decent way to go about things, and
I've been working with it for the past few weeks.  You can get detailed
data type and formatting controls that way.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Jon Wingfield [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, November 25, 2003 6:41 AM
>To: Tomcat Users List
>Subject: Re: Miss 0 when Excel file is downloaded
>
>As you say it's an excel problem not a java/servlet/tomcat problem.
>Excel has always been this way. Really annoying when leading zeroes do
>mean something (like in telephone numbers, for example).
>If this is a display issue only then try adding a leading single quote
>to the data:
>
>out.writeBytes("'00667115");
>
>Adding the single quote works when using excel manually, the zeroes are
>displayed but not the qoute (unless you select the cell).
>
>Of course, that modifies the data. You could try writing the excel file
>with POI's HSSF project (http://jakarta.apache.org/poi/). You'll then
be
>able to control the column type.
>
>Good luck,
>
>Jon
>
>Cui Xiaojing-a13339 wrote:
>> 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]
>>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to