首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

页面下载功能的实现解决思路

2012-03-01 
页面下载功能的实现想做一个下载功能的实现,点击页面中的下载按钮,就可以实现将页面的文字保存到word里进

页面下载功能的实现
想做一个下载功能的实现,点击页面中的下载按钮,就可以实现将页面的文字保存到word里进行下载。

[解决办法]
直接用word打开,然后存成.doc文件就可以了。

protected void ConvertToHtml(string SrcFilePath,string TargetFilePath)
{
Word.Application app=new Word.Application();
app.Visible=false;
Object o=Missing.Value;
object docFile=SrcFilePath;
_Document doc=app.Documents.Open(ref docFile,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o);
object fileName=TargetFilePath;
object format=Word.WdSaveFormat.wdFormatDocument; //word format
doc.SaveAs(ref fileName,ref format,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o);
object t=true;
app.Quit(ref t,ref o,ref o);
}
 

热点排行