如果以Html產生Word,然後在Word2007 或Word2010 修改後按儲存的話
會出現多餘的資料夾和檔案(但是Word2003不會)
所以我就把產生的Word檔變成MHT格式的就好了


但是Word 2000會完全不能用=.="


雖然我不知道104人力銀行是怎麼做的
但做起來跟104人力銀行產生Word履歷表的功能很像~.~"


// Word
Response.AddHeader("content-disposition", "attachment;filename=WORD檔名.doc");
Response.ContentType = "application/msword


Response.Write("MIME-Version: 1.0" + Environment.NewLine);
Response.Write("Content-Type: multipart/mixed; boundary=\"myRegion\"" + Environment.NewLine);
Response.Write("--myRegion" + Environment.NewLine);
Response.Write("Content-Type: text/html" + Environment.NewLine + Environment.NewLine);


Response.Write("<html><body>");
Response.Flush();


StringWriter mySWriter = new StringWriter();
HtmlTextWriter myHWriter = new HtmlTextWriter(mySWriter);
某個控制項.RenderControl(myHWriter);


Response.Write("<meta http-equiv=Content-Type content=text/html;charset=big5>");
Response.Write(mySWriter.ToString().Trim());


Response.Write("</body></html>");


Response.Write(Environment.NewLine + Environment.NewLine + "--myRegion--");


Response.Flush();
Response.End();

arrow
arrow
    全站熱搜

    welkingunther 發表在 痞客邦 留言(0) 人氣()