Monday, February 2, 2009

aspx轉excel, word

Word
Response.AddHeader("content-disposition", "attachment;filename=KS-0-9602.doc")
Response.ContentType = "application/vnd.ms-word"

excel
Response.AddHeader ("Content-Disposition", "attachment; filename=KS-0-9602..xls")
Response.ContentType = "application/ms-excel"

加上 style="mso-number-format:" 以指定excel中資料的格式,以下把數字轉為文字
<td style="mso-number-format: @">0121111</td>

No comments:

Post a Comment