精华内容
下载资源
问答
  • word 转html

    2015-11-24 10:13:42
    word 转html string dtTicks = DateTime.Now.Ticks.ToString(); //在此处放置用户代码以初始化页面 string dir = wordFileName.Substring(0, wordFileName.LastIndexOf("\\")); string strSaveFileName = dir ...
  • word转html

    2016-12-30 16:44:00
    word文件转为html格式,支持图片抽取
  • Word转HTML

    千次阅读 2016-11-05 19:03:46
    Word转HTML把Work生成的HTML中的代码进行简化处理

    Word转HTML

    把Work生成的HTML中的代码进行简化处理

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>WORD转HTML</title>
    <style>
    body{ font-size:12px; padding:20px; margin:0px;}
    p{ font-size:12px; margin:0px; line-height:25px; padding:0px;}
    table{ border-left:1px solid #CCCCCC; border-top:1px solid #CCCCCC;}
    table td{ border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC;}
    </style>
    <script language="javascript" type="text/javascript">
    //运行文本域代码
    function runEx(cod1)  {
     cod=document.all(cod1)
      var code=cod.value;
      if (code!=""){
      var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
      newwin.opener = null // 防止代码对论谈页面修改
      newwin.document.write(code);  //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
      newwin.document.close();
    }
    }
    </script>
    </head>
    <body>
    <script>
    function GetClipboardHTML()
    {
    var oDiv = document.getElementById("divTemp")
    oDiv.innerHTML = "" ;
    var oTextRange = document.body.createTextRange() ;
    oTextRange.moveToElementText(oDiv) ;
    oTextRange.execCommand("Paste") ;
    var sData = oDiv.innerHTML ;
    oDiv.innerHTML = "" ;
    return sData ;
    }
    function cleanAndPaste( html )
    {
    // Remove all SPAN tags
    html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
    // Remove all B tags
    html = html.replace(/<\/?B[^>]*>/gi, "" );
    // Remove all COLGROUP tags
    html = html.replace(/<\/?COLGROUP[^>]*>/gi, "" );
    html = html.replace(/<\/?COL[^>]*>/gi, "" );
    // Remove all td tags
    html = html.replace(/<td[^>]*>/gi, "<td>" );
    html = html.replace(/TD/gi, "td" );
    html = html.replace(/TR/gi, "tr" );
    html = html.replace(/TABLE/gi, "table" );
    html = html.replace(/<\/?TBODY[^>]*>/gi, "" );
    // Remove all tr tags
    html = html.replace(/<tr[^>]*>/gi, "<tr>" );
    // Remove all table tags
    html = html.replace(/<table[^>]*>/gi, "<table>" );
    // Remove Class attributes
    html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
    // Remove Style attributes
    html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
    // Remove Lang attributes
    html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
    // Remove XML elements and declarations
    html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
    // Remove Tags with XML namespace declarations: <o:p></o:p>
    html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
    // Replace the &nbsp;
    html = html.replace(/&nbsp;/, "" );
    //replace H to <P>
    html = html.replace( /<H1>/gi, "" ) ;
    html = html.replace( /<\/H1>/gi, "" ) ;
    html = html.replace( /<H2>/gi, "" ) ;
    html = html.replace( /<\/H2>/gi, "" ) ;
    html = html.replace( /<H3>/gi, "" ) ;
    html = html.replace( /<\/H3>/gi, "" ) ; 
    //删除font
    html = html.replace( /<(font[^>]*)>/gi, "" ) ;
    html = html.replace( /<\/font>/gi, "" ) ;
    //html = html.replace(/<\/?A[^>]*>/gi, "" );
    // Transform <P> to <DIV>
    //把td里面的p去除
    var re = new RegExp("(<td>[^>]*<P)([^>]*>.*?)(<\/P><\/td>)","gi") ;
    // Different because of a IE 5.0 error
    html = html.replace( re, "<td$2</td>" ) ;
    //删除p空格
    html = html.replace(/<(p[^>]*)><\/p>/gi, "");
    html = html.replace(/<(p[^>]*)>&nbsp;<\/p>/gi, "");
    //insertHtml( html ) ;
    //return html;
    Form1.my.value = html;
    }
    function Paste()
    {
    var sHTML = GetClipboardHTML() ;
    var re = /<\w[^>]* class="?MsoNormal"?/gi ;
    var re2 = /<\w[^>]* class="?xl"?/gi ;
    if ( re.test( sHTML ) )
    {
    alert("您要粘贴的内容好像是来自 Word,系统将清除 Word 格式后再粘贴!")
    }
    if ( re2.test( sHTML ) )
    {
    alert("您要粘贴的内容好像是来自 Excel,系统将清除 Excel 格式后再粘贴!")
    }
    cleanAndPaste( sHTML ) ;
    }
    </script>
    <Form id="Form1" name="Form1">
    <p>点击粘贴</p>
    <input type="button" value="粘贴" onclick="Paste()">
    <br/>
    <textarea name="my" cols="60" rows="10" id="rn01"></textarea>
    <br/>
    <INPUT onclick="runEx('rn01')"  type="button" value="运行代码" style="cursor:hand">
    <div id=divTemp style="VISIBILITY: hidden; OVERFLOW: hidden; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px"></div>
    </Form>
    </BODY>
    </HTML>
    展开全文
  • word html

    千次阅读 2019-01-23 09:42:06
    因为原先的word的文档编码不一定,而html文件编码常规为utf-8,故将原先的文件编码改为utf-8 2.保存为html单个文件 将word另存为html文件 保存类型要选 筛选过的网页(*.htm;*.html) 默认是htm文件...

    1.避免乱码,先将文件设置为utf-8

    因为原先的word的文档编码不一定,而html文件编码常规为utf-8,故将原先的文件编码改为utf-8

     

     

    2.保存为html单个文件

    将word另存为html文件

    保存类型要选   筛选过的网页(*.htm;*.html)

    默认是htm文件,要改为html文件

    展开全文
  • java word转html

    2017-06-14 14:15:48
    java word转html (只支持2007以下版本)
  • 利用pdfbox,jacob,实现。pdf转图片并合成一张图片输出,图片转pdf,word转html,word转pdf
  • word转html.docx

    2019-05-28 11:01:04
    word转html,支持doc和docx两种格式文件,具体代码和jar包 文档中都有描述
  • java word转html源码

    2018-01-10 08:36:25
    java word转html源码源码,包含Jar文件,支持doc与docx格式。
  • android word转html

    2013-07-01 23:47:14
    android利用poi实现word转html
  • 基于java的word转html

    2017-07-27 14:49:36
    基于java的单线程word转html工具,可实现配置路径自动将路径下的word文件转成html,包括doc和docx格式,其中图片、表格、链接、目录等均可完整转换。
  • Word导入Demo,Word转Html

    2015-06-29 12:32:07
    Word导入功能demo,Word转HTML,引用Microsoft.Office.Interop.Word.dll写的,服务器要安装Microsoft Office,自己亲测可用,里面我写有注释,而且我列出了我部属到服务器时遇见的所有问题。如果只是需要把word转为...
  • Python word转html

    千次阅读 2019-08-02 13:30:23
    Python word转html from win32com.client import Dispatch def doc2html(input, output): w = Dispatch('Word.Application') try: doc = w.Documents.Open(input, ReadOnly=1) doc.SaveAs(...

    Python word转html

    from win32com.client import Dispatch
    
    
    def doc2html(input, output):
        w = Dispatch('Word.Application')
        try:
            doc = w.Documents.Open(input, ReadOnly=1)
            doc.SaveAs(output, 8)
            return True
        except Exception as e:
            return False
    
    
    def main():
        input = r'/home/python/Desktop/XX.doc'
        output = r'/home/python/Desktop'
        rc = doc2html(input, output)
        if rc:
            print('转换成功')
        else:
            print('转换失败')
    
    
    if __name__ == '__main__':
        main()
    

    貌似pywin32模块只能在Windows上用

    展开全文
  • 主要介绍了php实现word转html的方法,涉及PHP调用com组件操作word文档的相关技巧,需要的朋友可以参考下
  • word转html工具

    千次阅读 2017-12-15 09:06:28
    word转html工具类
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStreamWriter;
    import java.util.List;
    
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    
    import org.apache.commons.io.output.ByteArrayOutputStream;
    import org.apache.poi.hwpf.HWPFDocument;
    import org.apache.poi.hwpf.converter.PicturesManager;
    import org.apache.poi.hwpf.converter.WordToHtmlConverter;
    import org.apache.poi.hwpf.usermodel.Picture;
    import org.apache.poi.hwpf.usermodel.PictureType;
    import org.apache.poi.xwpf.converter.core.FileImageExtractor;
    import org.apache.poi.xwpf.converter.core.FileURIResolver;
    import org.apache.poi.xwpf.converter.core.IURIResolver;
    import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
    import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
    import org.apache.poi.xwpf.usermodel.XWPFDocument;
    import org.apache.poi.xwpf.usermodel.XWPFPictureData;
    import org.w3c.dom.Document;
    
    
    
    public class WordToHtml {
        public static void main(String[] args) {
            try {
                wordToHtml("d:\\12.docx", "d:\\", "123.html");
                wordToHtml("d:\\2.doc", "d:\\", "12.html");
            } catch (TransformerException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        public static void wordToHtml(String wordPath,String htmlPath,String newFilename) throws TransformerException, IOException, ParserConfigurationException {    
                convert2Html(wordPath, htmlPath, newFilename);
        }    
    
        public static void writeFile(String content, String path) {    
            FileOutputStream fos = null;    
            BufferedWriter bw = null;
            try {    
                File file = new File(path);
                if(!file.exists()){
    
                }
                fos = new FileOutputStream(file);    
                bw = new BufferedWriter(new OutputStreamWriter(fos));    
                bw.write(content);  
            } catch (FileNotFoundException fnfe) {    
                fnfe.printStackTrace();    
            } catch (IOException ioe) {    
                ioe.printStackTrace();    
            } finally {    
                try {    
                    if (bw != null)    
                        bw.close();    
                    if (fos != null)    
                        fos.close();    
                } catch (IOException ie) {    
                }    
            }    
        }    
    
        /**
         * 将word转换成html
         * 支持 .doc and .docx
         * @param fileName word文件名
         * @param outPutFilePath html存储路径
         * @param newFileName html名
         * @throws TransformerException
         * @throws IOException
         * @throws ParserConfigurationException
         */
        public static void convert2Html(String fileName, String outPutFilePath,String newFileName)    
                throws TransformerException, IOException,    
                ParserConfigurationException {
            String substring = fileName.substring(fileName.lastIndexOf(".")+1);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
    
            /**
             * word2007和word2003的构建方式不同,
             * 前者的构建方式是xml,后者的构建方式是dom树。
             * 文件的后缀也不同,前者后缀为.docx,后者后缀为.doc
             * 相应的,apache.poi提供了不同的实现类。
             */
            if("docx".equals(substring)){
    //          writeFile(new String("<html><head>  <meta http-equiv=\"content-type\" content=\"text/html\" charset=\"utf-8\"/></head>对不起,.docx格式的word文档,暂时不能生成预览</html>".getBytes("utf-8")), outPutFilePath+newFileName); 
    
                //step 1 : load DOCX into XWPFDocument
                InputStream inputStream = new FileInputStream(new File(fileName));
                XWPFDocument document = new XWPFDocument(inputStream);
    
                //step 2 : prepare XHTML options
                final String imageUrl = "";
    
                XHTMLOptions options = XHTMLOptions.create();
                options.setExtractor(new FileImageExtractor(new File(outPutFilePath + imageUrl)));
                options.setIgnoreStylesIfUnused(false);
                options.setFragment(true);
                options.URIResolver(new IURIResolver() {
    //              @Override 重写的方法,加上这个报错,你看看是啥问题
                    public String resolve(String uri) {
                        return imageUrl + uri;
                    }
                });
    
                //step 3 : convert XWPFDocument to XHTML
                XHTMLConverter.getInstance().convert(document, out, options);
            }else{
            HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(fileName));//WordToHtmlUtils.loadDoc(new FileInputStream(inputFile));    
            WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(    
                    DocumentBuilderFactory.newInstance().newDocumentBuilder()    
                            .newDocument());    
             wordToHtmlConverter.setPicturesManager( new PicturesManager()    
             {    
                 public String savePicture( byte[] content,    
                         PictureType pictureType, String suggestedName,    
                         float widthInches, float heightInches )    
                 {    
                     return suggestedName;    
                 }    
             } );    
            wordToHtmlConverter.processDocument(wordDocument);    
            //save pictures    
            List pics=wordDocument.getPicturesTable().getAllPictures();    
            if(pics!=null){    
                for(int i=0;i<pics.size();i++){    
                    Picture pic = (Picture)pics.get(i);    
                    System.out.println();    
                    try {    
                        pic.writeImageContent(new FileOutputStream(outPutFilePath    
                                + pic.suggestFullFileName()));    
                    } catch (FileNotFoundException e) {    
                        e.printStackTrace();    
                    }      
                }    
            }    
            Document htmlDocument = wordToHtmlConverter.getDocument();    
            DOMSource domSource = new DOMSource(htmlDocument);    
            StreamResult streamResult = new StreamResult(out);    
    
            TransformerFactory tf = TransformerFactory.newInstance();    //这个应该是转换成xml的
            Transformer serializer = tf.newTransformer();    
            serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");    
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");    
            serializer.setOutputProperty(OutputKeys.METHOD, "html");    
            serializer.transform(domSource, streamResult);    
            }    
    
            out.close();    
            writeFile(new String(out.toByteArray()), outPutFilePath+newFileName);    
        }
    
    }
    
    展开全文
  • java word转html poi3.9

    2017-08-15 09:24:30
    java实现word转html,基于poi3.9的。里面包含了jar包
  • poi操作word转html必须jar poi操作word转html必须jar poi操作word转html必须jar poi操作word转html必须jar
  • poi word转html例子及jar包 poi word转html例子及jar包
  • Java实现word转HTML

    千次阅读 2019-12-02 22:34:38
    Java word转html主要是为了word的在线浏览。不过转换可用性不是很好。我们先开始开发吧 第一步:引用Maven <!-- Word转HTML start --> <dependency> <groupId>org.apache.poi</...
  • poi完美word转html

    2013-11-12 18:25:58
    poi完美word转html,完整操作资料的引用说明
  • word转html java

    2018-09-21 16:04:55
    java中读取word文档并转换成html语言,其中还包含OSS上传文件的实例
  • 大批量Word转html 转text

    2013-04-02 14:00:28
    大批量Word转html 转text 另附批量text转txt的bat @Echo off REN *.text *.txt DIR PAUSE
  • poi word转html架包

    2017-06-28 17:26:19
    poi word转html架包
  • Word转html实现在线预览

    万次阅读 2018-12-25 17:37:29
    word转html,可以同时支持doc和docx两种格式,非常好用 开发工具:idea 项目管理工具:maven 不多说,直接撸代码 1、首先配置pom.xml文件,具体配置如下 2、工具类的开发 /** * WORD转HTML docx格式 * POI版本: ...
  • 64位jacob,用于word转html

    2017-11-16 10:38:46
    64位jacob 用于word转html 包含Java代码,将jacob.dll放到 windows下的 64位文件夹 ,项目中引入jar包即可
  • Word转HTML工具 Word2Htm

    千次下载 热门讨论 2012-02-21 12:49:48
    Word2Htm是一款先进的Word转换Htm/Html的工具,该工具不像别的软件直接Word另存为Htm/Html,那样会产生很多垃圾代码,本软件可以智能分析Word中的代码,将Word文档转换为有条理、结构清晰、内容简洁的Htm/Html文档,...
  • 根据文件目录生成HTMl页面...WORD转HTML,自已在做一个电子书的时候用到的。电子收要生成一个目录。一个一个做太废事了。就做了一个小工具。。呵呆。写的有一些乱。。

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 149,973
精华内容 59,989
关键字:

word转html