export to excel issue

G

Guest

I am pasting sample code below which I call on a button click. My problem is
that 6/7 is shown by excel as 7-Jun. I want it to look as 6/7 in excel.
Please let me know if anyone has a solution.

Thanks

string temp = "<html><table><tr><td>6/7</label></td></tr></table></html>";
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=test.xls");
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.Charset = "";
EnableViewState = false;
Response.Write(temp);
 
C

Cowboy \(Gregory A. Beamer\)

Add a single quote ' before the 6/7. That will indicate you want text rather
than the Excel tendency to treat it as a date.
 
G

Guest

Hi
Thanks for the reply. However if I add a quote it will show '6/7 in
excell cell. It doesn't look nice. Is there any way I can achieve this
without showing any other character in the cell.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Adding Text to ListView Excel Export 0
HTML Table Issue 1
Export Grid View to Excel 1
export to excel 0
Export datagrid to excel 1
export to excel 1
export to excel 0
Export To Excel 1

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top