引入 Aspose.Words

public void ConvertToHtml(string wordPath, string savaPath)
{
try
{
Aspose.Words.Document doc = new Aspose.Words.Document(wordPath); if (doc == null)
{
throw new Exception("Word文件无效或者Word文件被加密!");
} if (savaPath.Trim().Length == )
{
savaPath= Path.GetDirectoryName(wordPath);
} if (!Directory.Exists(savaPath))
{
Directory.CreateDirectory(savaPath);
} string wordName = Path.GetFileNameWithoutExtension(wordPath);
Aspose.Words.Saving.HtmlSaveOptions htmlSaveOptions = new Aspose.Words.Saving.HtmlSaveOptions(Aspose.Words.SaveFormat.Html);
string wordPath = Path.Combine(savaPath, wordName ) + "_001.html";
doc.Save(wordPath , htmlSaveOptions);
}
catch (Exception ex)
{
throw new FriendlyException("word的格式或版本不适用");
}
}

最新文章

  1. 谈谈枚举的新用法——java
  2. 【转】Weblogic的集群
  3. django-cms 代码研究(四)CMS_TEMPLATE标签
  4. 设计和实现OLAP解决方案
  5. C# Base64解码 二进制输出
  6. myeclipse egit 安装失败 org.eclipse.e4.ui.css.swt.theme 0.0.0
  7. SecureCRT通过Javascrip脚本实现Ctrl+C
  8. REST架构概述
  9. FCL源码中数组类型的学习及排序函数Sort函数的分析
  10. Gradle项目BUG
  11. [math][mathematica] archlinux 下 mathematica 的安装 (科学计算软件 mathematica/matlab/sagemath)
  12. 分布式系统介绍-PNUTS
  13. mysql中参数low_case_table_name的使用?不同参数值的设置有什么影响?
  14. 新概念 Lesson 5 How are you today
  15. inputsimulator - Windows Input Simulator
  16. golang init函数
  17. 为什么说Java中只有值传递----说服自己
  18. 一维码Code 93简介及其解码实现(zxing-cpp)
  19. svn自助改动password(PHP脚本实现)
  20. java 代码调用函数

热门文章

  1. print puts p 用法
  2. POJ 题目3020 Antenna Placement(二分图)
  3. Android基础新手教程——3.4 TouchListener PK OnTouchEvent + 多点触碰
  4. 局部变量,全局变量,extend,static
  5. NET中的池
  6. php 写日志函数(原创)
  7. typeof、instanceof、hasOwnProperty()、isPrototypeOf()
  8. webkitdirectory 实现文件夹上传
  9. 项目中遇到的所有ECharts图表集合
  10. TreeSet中的排序问题——Comparable