var path = Request.Url.Host + ":" + Request.Url.Port + list[i].AnnexPath;
//html保存路径
string savePath = Server.MapPath("~/Uploads/RemoteDatum/");
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}
//将word转成html
if (!System.IO.File.Exists(savePath + list[i].AnnexId + ".html"))
{
Microsoft.Office.Interop.Word.ApplicationClass word = new Microsoft.Office.Interop.Word.ApplicationClass();
Type wordType = word.GetType();
Documents docs = word.Documents;
Type docsType = docs.GetType();
Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { (object)path, true, true });
Type docType = doc.GetType();
string strSaveFileName = savePath + list[i].AnnexId + ".html";
object saveFileName = (object)strSaveFileName;
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML });
docType.InvokeMember("Close", System.Reflection.BindingFlags.InvokeMethod, null, doc, null);
wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);
}
var htmlPath = "/Uploads/RemoteDatum/" + list[i].AnnexId + ".html";

最新文章

  1. [Exchange]使用EWS托管API2.0同步邮箱
  2. iOS--获取输入字符的第一个字母(汉字则获取拼音的第一个字母)
  3. 一个在 Java VM 上使用可观测的序列来组成异步的、基于事件的程序的库 RxJava,相当好
  4. k近邻法的C++实现:kd树
  5. struts2框架开发的第一个应用
  6. 关于XMLEncoder和XMLDecoder
  7. 关于5303狄惟佳同学的myod程序设计的补充实现
  8. 算法题丨Next Permutation
  9. ANN实现
  10. win10下使用wget
  11. Oracle内置函数SQLCODE和SQLERRM的使用
  12. webpack2.0学习
  13. 程序员必须知道的HTML常用代码有哪些?
  14. jquery的extend函数
  15. js中forEach,for in,for of的区别
  16. uboot 下更改NAND的分区 fdisk
  17. 20155303 2016-2017-2 《Java程序设计》第八周学习总结
  18. Tomcat与Gzip与缓存
  19. 怎么上传自己的代码/项目到自己的github仓库上
  20. Centos上Apache重启,mysql重启,nginx重启方法

热门文章

  1. redis的主从复制原理
  2. 20175227张雪莹 2018-2019-2 《Java程序设计》第十周学习总结
  3. httpClinent工具类
  4. 服务器开启FTP功能
  5. leetcode 日常清单
  6. html提交表单,php在后台获取表单内容的方法_例1
  7. Elasticsearch安装配置问题
  8. Oracle 本地创建多个实例并创建多个监听(只能在服务端弄,不可在客户端)
  9. 数组中存放model去重
  10. document.documentElement.clientHeight 和 document.body.clientHeight