动态table往excel读入数据的问题。 table里的部分行和列被合并了。导出的时候合并过的列可以完全导出。但是合并的行却不见了。行和列的合并都是经过系统自动生成的。如果把合并的行给分开就会完全导出没有错误。郁闷!!!找到问题点却没找到解决方法。各位高手给小弟指点一下吧!!!!在线等待…………………… 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Response.Clear();Response.Buffer= true; Response.Charset="UTF-7";Response.AppendHeader("Content-Disposition","attachment;filename=TrialMap.xls"); //onlineResponse.ContentEncoding=System.Text.Encoding.GetEncoding("UTF-7"); this.EnableViewState = false;System.IO.StringWriter oStringWriter = new System.IO.StringWriter();System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);tblTest.RenderControl(oHtmlTextWriter);Response.Write(oStringWriter.ToString()); Response.End(); 这是导出数据的代码!!从网上学的。public void spanRow(Table dgModify,int spancell,int spanby,int spand) { if(spanby<0||spanby>dgModify.Rows.Count) { return; } int rowspan = 1; for(int i=1;i<dgModify.Rows.Count;i++) { if(dgModify.Rows[i-1].Cells[spand].Text == dgModify.Rows[i].Cells[spand].Text) { if(dgModify.Rows[i-1].Cells [spanby].Text == dgModify.Rows[i].Cells [spanby].Text) { rowspan +=1; dgModify.Rows[i].Cells [spancell].Visible =false; dgModify.Rows[i-rowspan+1].Cells [spancell].RowSpan = rowspan; } else { string str = dgModify.Rows [i].Cells [spanby].Text; string str1 = dgModify.Rows[i-1].Cells [spanby].Text; rowspan=1; } dgModify.Rows [i].Cells[spancell].Width =Unit.Percentage(0.3); } else { rowspan = 1; } } }这是用来进行行的合并的代码!!! 一道面试题 this.printDocument.PrintPage函数preview和print都可以进, 怎么区别啊 关于HttpWebRequest的问题 如何遍历C#窗体上的控件(删除) 如何使控制台程序启动之后最小化 为什么我自己定制的picturebox不能显示出来 oledbdatareader的问题,急啊 sql server 登陆错误 帮忙解决啊。。 TreeView问题: 当我们鼠标选中一个Node时,只有一种难看的蓝色,请问能够让选中的Node添加其他颜色或不要颜色吗 求助 java中的">>>"在c#中如何实现 richTextBox里面怎么加入图像阿
Response.Buffer= true;
Response.Charset="UTF-7";
Response.AppendHeader("Content-Disposition","attachment;filename=TrialMap.xls"); //online
Response.ContentEncoding=System.Text.Encoding.GetEncoding("UTF-7");
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
tblTest.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
这是导出数据的代码!!从网上学的。
public void spanRow(Table dgModify,int spancell,int spanby,int spand)
{
if(spanby<0||spanby>dgModify.Rows.Count)
{
return;
}
int rowspan = 1;
for(int i=1;i<dgModify.Rows.Count;i++)
{
if(dgModify.Rows[i-1].Cells[spand].Text == dgModify.Rows[i].Cells[spand].Text)
{
if(dgModify.Rows[i-1].Cells [spanby].Text == dgModify.Rows[i].Cells [spanby].Text)
{
rowspan +=1;
dgModify.Rows[i].Cells [spancell].Visible =false;
dgModify.Rows[i-rowspan+1].Cells [spancell].RowSpan = rowspan;
}
else
{
string str = dgModify.Rows [i].Cells [spanby].Text;
string str1 = dgModify.Rows[i-1].Cells [spanby].Text;
rowspan=1;
}
dgModify.Rows [i].Cells[spancell].Width =Unit.Percentage(0.3);
}
else
{
rowspan = 1;
}
}
}
这是用来进行行的合并的代码!!!