Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using multiple mso-number-format's when exporting using HttpResponse

Hi,

I've got the following code to write out a grid to Excel:

private void WriteExcelDataToHttpResponse()
{
Response.Clear();
Response.Charset = "";
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stwWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htwHtmlTextWriter = new
System.Web.UI.HtmlTextWriter(stwWriter);
this.ExcelTable.RenderControl(htwHtmlTextWriter);
string s_styleInfo = @"<style td { mso-number-format:""" + "\\@" + @"""; }
</style";
string s_excel = stwWriter.ToString();
Response.Write(s_styleInfo + s_excel);
Response.End();
}

This results in the following in the output file that works perfectly:

..xl24
{mso-style-parent:style0;
mso-number-format:"\@";
white-space:normal;}

Now, every "td" uses this class, like so:

<td class=xl24 width=138 style='width:104pt'SocialSecurityNumber</td

I've got something like this to add date to the table prior to exporting it:

row = new HtmlTableRow();
// name column
cell = new HtmlTableCell();
cell.InnerText = HttpUtility.HtmlEncode(s.Name);
row.Cells.Add(cell);
ExcelTable.Rows.Add(row);

My question is, can I specify a different mso-number-format in specific
cells in this code? If so, how? E.g. cell.something =
"mso-number-format:0";

Many thanks!

Mark




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting multiple sheets to multiple htm files? [email protected] Excel Discussion (Misc queries) 4 April 2nd 05 01:26 PM
Exporting from Excel to multiple XML files Questions Excel Discussion (Misc queries) 0 March 17th 05 10:20 PM
Exporting To Excel With ASP - Number Problem williamsd Excel Programming 8 March 6th 04 06:10 PM
Exporting multiple worksheets as CSV Mike O[_3_] Excel Programming 0 February 25th 04 06:05 PM
Exporting multiple worksheets as CSV Joe Sheehan Excel Programming 3 February 24th 04 02:38 PM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"