利用获取页面html,导出excel
2007-12-19 14:55
417 查看
public void CreateExcelxxbb(string FileName) //
{
WebRequest mywebrq;
WebResponse mywebresp;
StreamReader sr;
string strexcel = this.sqltoexcelxx();
string strurl = Request.Url.ToString();
strurl = strurl.Substring(0, strurl.LastIndexOf("/") + 1);
strurl = strurl + "fel_yzbb.aspx?str=" + strexcel + "&stid=" + this.drpstname.SelectedValue.Trim() + "&reid=" + this.rbtrole.SelectedValue.Trim();
//int n = strurl.LastIndexOf("/");
//strurl = strurl.Substring(0, n - 5);
mywebrq = WebRequest.Create(strurl);
mywebresp = mywebrq.GetResponse();
sr = new StreamReader(mywebresp.GetResponseStream());
HttpResponse resp;
resp = Page.Response;
resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
resp.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
string str = sr.ReadToEnd();
str = str.Substring(str.IndexOf("<div>"));
str = str.Substring(0, str.LastIndexOf("</div>") + 6);
//str = str.Substring(str.IndexOf("<!--biaojikaishi-->")+19);
//str = str.Substring(0, str.IndexOf("<!--biaojijieshu-->"));
resp.Write(str);
//写缓冲区中的数据到HTTP头文件中
resp.End();
}
{
WebRequest mywebrq;
WebResponse mywebresp;
StreamReader sr;
string strexcel = this.sqltoexcelxx();
string strurl = Request.Url.ToString();
strurl = strurl.Substring(0, strurl.LastIndexOf("/") + 1);
strurl = strurl + "fel_yzbb.aspx?str=" + strexcel + "&stid=" + this.drpstname.SelectedValue.Trim() + "&reid=" + this.rbtrole.SelectedValue.Trim();
//int n = strurl.LastIndexOf("/");
//strurl = strurl.Substring(0, n - 5);
mywebrq = WebRequest.Create(strurl);
mywebresp = mywebrq.GetResponse();
sr = new StreamReader(mywebresp.GetResponseStream());
HttpResponse resp;
resp = Page.Response;
resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
resp.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
string str = sr.ReadToEnd();
str = str.Substring(str.IndexOf("<div>"));
str = str.Substring(0, str.LastIndexOf("</div>") + 6);
//str = str.Substring(str.IndexOf("<!--biaojikaishi-->")+19);
//str = str.Substring(0, str.IndexOf("<!--biaojijieshu-->"));
resp.Write(str);
//写缓冲区中的数据到HTTP头文件中
resp.End();
}
相关文章推荐
- 提交搜索表单 html页面表格导出到excel总结
- html页面表格导出到excel总结
- 利用poi从jsp页面导出报表到excel
- html页面里table导出为excel
- 利用poi从jsp页面导出报表到excel
- 利用poi实现页面上excel的导入和导出(不刷新页面)之导入
- 利用webBrowser获取框架内Html页面内容
- 利用poi从jsp页面导出报表到excel
- jsp利用POI生成Excel并在页面中导出的示例
- 利用SQL*PLUS导出成EXCEL和html的功能实现报表统计:
- Jsp页面中的table利用ie导出到Excel
- 利用selenium获取动态页面的html数据
- 利用webBrowser获取框架内Html页面内容
- Java Web获取数据库数据,利用jxl实现数据导出成Excel文件
- html利用jquery获取其他页面的数据并输出
- html页面表格导出到excel总结
- SP2010可视化WebPart利用Respose方法导出Excel后页面按钮失效的解决方法
- jsp利用POI生成Excel并在页面中导出的示例
- 利用poi实现页面上excel的导入和导出(不刷新页面)之导出
- Java POI Excel导出为HTML页面(去掉行号、列号)