C# word生成html
2024-09-28 01:16:03
引入 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的格式或版本不适用");
}
}
最新文章
- 谈谈枚举的新用法——java
- 【转】Weblogic的集群
- django-cms 代码研究(四)CMS_TEMPLATE标签
- 设计和实现OLAP解决方案
- C# Base64解码 二进制输出
- myeclipse egit 安装失败 org.eclipse.e4.ui.css.swt.theme 0.0.0
- SecureCRT通过Javascrip脚本实现Ctrl+C
- REST架构概述
- FCL源码中数组类型的学习及排序函数Sort函数的分析
- Gradle项目BUG
- [math][mathematica] archlinux 下 mathematica 的安装 (科学计算软件 mathematica/matlab/sagemath)
- 分布式系统介绍-PNUTS
- mysql中参数low_case_table_name的使用?不同参数值的设置有什么影响?
- 新概念 Lesson 5 How are you today
- inputsimulator - Windows Input Simulator
- golang init函数
- 为什么说Java中只有值传递----说服自己
- 一维码Code 93简介及其解码实现(zxing-cpp)
- svn自助改动password(PHP脚本实现)
- java 代码调用函数
热门文章
- print puts p 用法
- POJ 题目3020 Antenna Placement(二分图)
- Android基础新手教程——3.4 TouchListener PK OnTouchEvent + 多点触碰
- 局部变量,全局变量,extend,static
- NET中的池
- php 写日志函数(原创)
- typeof、instanceof、hasOwnProperty()、isPrototypeOf()
- webkitdirectory 实现文件夹上传
- 项目中遇到的所有ECharts图表集合
- TreeSet中的排序问题——Comparable