熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

拼接的字符串導入EXCEL

2013-11-13 10:18:44  來源: .NET編程 
    StringBuilder sb = new StringBuilder()
   
    sbAppendLine(<table><tr><th>序號</th><th>批單號</th><th>保單號</th><th>被保險人</th><th>保全項目</th><th>退費金額</th><th>保全操作日期</th><th>經辦人</th></tr>
   
    int i = ;
   
    string str = abc;
   
    string str = wanglei;
   
    string str = aaa;
   
    string time = DateTimeNowToString()
   
    sbAppendLine(<tr><td></td><td style=\vndmsexcelnumberformat:@\> + + </td><td style=\vndmsexcelnumberformat:@\> + str + </td><td> + str + </td><td> + str + </td><td>  + </td><td> + time + </td><td> + str  + </td></tr>
   
    //foreach (BillChange change in list)
   
    //{
   
    //    sbAppendLine(<tr><td> + (i++)ToString() + </td><td style=\vndmsexcelnumberformat:@\> + changeChangeBillCode + </td><td style=\vndmsexcelnumberformat:@\> + changeBillCode + </td><td> + changeBillHolder + </td><td> + GetChangeTypeString(changeChangeType) + </td><td> + (changeReturnFee > ? changeReturnFeeToString() : ) + </td><td> + changeCreateDatetimeToString(yyyyMMdd) + </td><td> + changeCreatorName + </td></tr>
   
    //}
   
    sbInsert( <html><head><meta content=text/html; charset=utf httpequiv=contenttype /></head><body><table border=>
   
    sbAppendLine(</table></body></html>
   
    ResponseClear()
   
    ResponseBuffer = true;
   
    ResponseCharset = UTF;
   
    ResponseAppendHeader(ContentDisposition attachment;filename=\ + ServerUrlEncode(保單變更信息xls) + \
   
    ResponseContentEncoding = EncodingUTF;
   
    ResponseContentType = application/msexcel;
   
    ResponseWrite(sbToString())
   
    ResponseEnd()
From:http://tw.wingwit.com/Article/program/net/201311/13218.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.