如果是用OpenXML SDK
裡頭有個PageSetup類別,
把Orientation屬性設定成OrientationValues.Landscape就成了橫向文件了
感謝 wiselou 大大的解答
方便請問一下...
我目前在網路上搜尋以下這段程式碼
<pre class="c" name="code">
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=" + DateTime.Now.ToString("yyyyMMdd") + ".doc");
Response.Charset = "big5";
Response.ContentType = "application/vnd.ms-word";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.AllowSorting = false;
GridView1.AllowPaging = false;
GridView1.Columns.RemoveAt(GridView1.Columns.Count - 1);
GridView1.DataBind();
HtmlForm hf = new HtmlForm();
Controls.Add(hf);
hf.Controls.Add(GridView1);
hf.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
可以套用你的方法嗎??
感謝您~
...你用HTML的方式騙word...
這個...幫不上忙....