如何把网页页面下载为word或者html格式?
相静如滨 2012-11-03 05:58:09 如何把网页页面下载为word或者html格式?
.net新手,请教下大家,用什么技术可以把网页下载为word或者html格式文件。
网页上面的内容有图片,文字,统计曲线图,jpgrid表格数据。
统计曲线图,jpgrid表格数据均是用jquery格式异步加载数据的。
试过了用WebClient技术,可以保存为word文档,但是由于 统计曲线图和jpgrid表格数据是异步加载的,所以保存下来的数据没有统计曲线图和jpgrid表格数据。
有没有朋友知道怎么处理这个? 加急。。。。
页面代码:
string path = "d:/test/test.doc";
System.Net.WebClient wc = new System.Net.WebClient();
wc.Headers["User-Agent"] = "blah";
byte[] bateFile = wc.DownloadData(@url); //当前页面路径
System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None);
fs.Write(bateFile, 0, bateFile.Length);
fs.Flush();
fs.Close();
DownLoadFile(path);//调用下载页面方法