将word⽂档转化为html(代码)
/// <summary>
/// 把Word⽂档转化为Html⽂件
/// </summary>
/// <param name="wordFileName">word⽂件名</param>
/// <param name="htmlFileName">要保存的html⽂件名</param>
/// <returns></returns>
public static bool WordToHtml(string wordFileName, string htmlFileName)
{
try
{
Object oMissing = System.Reflection.Missing.Value;
蝴蝶光是什么样的
Word._Application WordApp = new Word.Application();
WordApp.Visible = false;
object filename = wordFileName;
_Document WordDoc = WordApp.Documents.Open(ref filename, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
// Type wordType = WordApp.GetType();evaluation密钥
// 打开⽂件
Type docsType = WordApp.Documents.GetType();
文件格式转换app
// 转换格式,另存为
Type docType = WordDoc.GetType();
取整函数matlabobject saveFileName = htmlFileName;
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, WordDoc,                    new object[] { saveFileName, WdSaveFormat.wdFormatHTML });
//保存
WordDoc.Save();
WordDoc.Close(ref oMissing, ref oMissing, ref oMissing);网页滑条代码
WordApp.Quit(ref oMissing, ref oMissing, ref oMissing);
return true;
}
catch (Exception e)
{
Console.WriteLine(e.Message);三角函数图像平移
Console.WriteLine(e.StackTrace);
return false;
}
}
如果不是⽤程序当中进⾏转换的时候,还有⼀个⽐较简单的转换⽅式就是点击word中的另存,直接在另存的对话框中保存类型选择html格式 进⾏保存就可以了

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。