如何迅速将Word转换为Html
//将Word转换为Htmlpublic string wordToHtml(System.Web.UI.HtmlControls.HtmlInputFile wordFilePath){Microsoft.Office.Interop.Word.ApplicationClass word = new Microsoft.Office.Interop.Word.ApplicationClass();Type wordType = word.GetType();Microsoft.Office.Interop.Word.Documents docs = word.Documents; // 打开文件Type docsType = docs.GetType(); //应当先把文件上传至服务器然后再解析文件为html//if (wordFilePath.PostedFile != null)//{ //变换前路径 改动1//string filePath = ViewState["sss"].ToString();//} string filePath = File1.PostedFile.FileName;object fileName = filePath; Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[]{ fileName, true, true }); // 转换格式,另存为htmlType docType = doc.GetType();string filename = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() +System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString(); //被转换的html文档保存的位置string ConfigPath = AppDomain.CurrentDomain.BaseDirectory.ToString() + "Uploadfiles \\wordTmp\\" + filename + ".html";object saveFileName = ConfigPath; docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,null, doc, new object[]{ saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML }); // 退出 WordwordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);//转到新生成的页面
如何将html文件转换为word文件
第一步、打开网页后单击浏览器菜单栏的“文件”-->另存为,然后选择“网页,全部htm,html”格式;(如下图):第二步、我们打开Word,然后选择Word菜单栏的“文件”-->打开,找到刚才保存文件的地方,选择打开(如:我这里打开“《Excel2003如何合并单元格》”这个页面):步骤三、打开以后我们删除一些不需要的地方,比如:顶部和底部的,那些对于我们来说都没什么用,我们要主要就是要内容。
然后打开菜单栏的“表格”-->转换-->表格转换为文本,将一些文档中的表格一一去掉。
最后步、修改了一下效果跟先前那个比起来是不是要好得多呀?我们将修改好的文档“另存为”或者“保存”普通的(.doc)格式就可以了。
【doc转html代码】如何把word转换成HTML?我想把word文档转换为...
有两种方法,一种是选中你要保存的HTML文字,复制,然后打开一个word空白文档,在“编辑”菜单中选择“选择性粘贴”,选择无格式文本就可以了。
第二种是把这个HTML文件保存下来,选中这个文件,右击,选择打开方式,选择WORD打开,再保存为doc格式就可以了。
html 页面怎么转化为word文档
打开这个文档,以桌面上随便一个word为例,就拿今天在军事网上看到的文章为例吧,打这个文件打开;打开这个word文件后,选择office菜单下面的另存为菜单 ,如图;在”另存为“的下拉菜单中选择最下面一个”其他格式“,如图;点击进去之后,在文件格式网页格式,然后再点保存就可以了;
JAVA中如何把WORD文档直接转换成html?
jacob是java和windows下的com桥,通过它我们可以在java程序中调用COM组件。
如果你的JDK是1.4,那你需要下载jacob1.9的jni库才能正常运行,早期版本在JDK1.4下有些问题。
package com;/** * Title:Word文档转html类 * Description: * Copyright:() 2002 * @author 舵手 * @version 1.0 */import com.jacob.com.*;import com.jacob.activeX.*; public class WordtoHtml { /** *文档转换函数 *@param docfile word文档的绝对路径加文件名(包含扩展名) *@param htmlfile 转换后的html文件绝对路径和文件名(不含扩展名) */ public static void change(String docfile, String htmlfile) { ActiveXComponent app = new ActiveXComponent("Word.Application");// 启动word try { app.setProperty("Visible", new Variant(false)); //设置word不可见 Object docs = app.getProperty("Documents").toDispatch(); Object doc = Dispatch.invoke(docs,"Open",Dispatch.Method,new Object[] { docfile, new Variant(false),new Variant(true) }, new int[1]).toDispatch(); // 打开word文件 Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Object[] {htmlfile, new Variant(8) }, new int[1]); // 作为html格式保存到临时文件 Variant f = new Variant(false); Dispatch.call(doc, "Close", f); } catch (Exception e) { e.printStackTrace(); } finally { app.invoke("Quit", new Variant[]{}); } } public static void main(String[] strs){ WordtoHtml.change("c:\\a\\运输管理调度系统总体方案.doc", "c:\\a\\t"); }}
如何批量将html文件转换为word文档
html文件转换为word文件:打开这个文档,以桌面上随便一个word为例,就拿今天在军事网上看到的文章为例吧,打这个文件打开;打开这个word文件后,选择office菜单下面的另存为菜单 ,如图;在”另存为“的下拉菜单中选择最下面一个”其他格式“,如图;点击进去之后,在文件格式网页格式,然后再点保存就可以了;...
word转网页格式,怎么才保存word的格式?
启动Word2010,本例以 Word 2010为例进行讲解,其他版本的操作方法类似,只需要找到对应的菜单及功能键即可如下图所示的文件,选择“文件”菜单,保存文件如下图选择另存为,设置保存路径在弹出的保存窗口中选择保存成网页文件最后给出一个效果图
转载请注明出处51数据库 » word转html方法