zoukankan      html  css  js  c++  java
  • word转html

     private void E_docx(string f_o)
            {
                //BLL.MedicalTypeBLL mdl = new BLL.MedicalTypeBLL();
                //HiddenField1.Value = mdl.D_Medicals(f_o).Rows[0]["MEDICAL_TEMPLET"].ToString();
                //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();
                //object fileName = Server.MapPath("~/UploadImgs/") + mdl.D_Medicals(f_o).Rows[0]["MEDICAL_TEMPLET"].ToString();
                //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 }); // 转换格式,另存为   
                //Type docType = doc.GetType();
                //Encoding code = Encoding.GetEncoding("gb2312");
                //string str = DateTime.Now.ToString("yyyyMMddHHmmss");
                //fileName = str + ".htm";
                //StreamWriter sw = new StreamWriter(Server.MapPath("htm/") + fileName, false, code);
                //sw.Close();
                //object saveFileName = Server.MapPath("htm/") + fileName;
                ////保存HTML  

                //docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML });
                //// 退出 Word 
                //object saveChanges = System.Reflection.Missing.Value;
                //object originalFormat = System.Reflection.Missing.Value;
                //object routeDocument = System.Reflection.Missing.Value;
                //docs.Close(ref saveChanges, ref originalFormat, ref routeDocument);
                ////doc.Close(ref saveChanges, ref originalFormat, ref routeDocument);
                //wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);

                //FileStream tFile = File.Open(saveFileName.ToString(), FileMode.Open, FileAccess.Read);
                //StreamReader sr = new StreamReader(tFile, code);
                //StringBuilder sb = new StringBuilder(sr.ReadToEnd());
                //string subs = string.Empty;
                //int iBeginIndex = sb.ToString().IndexOf("<body");
                //int  iEndIndex = sb.ToString().LastIndexOf("</body>");
                //int see = sb.ToString().Length;
                //subs = sb.ToString().Substring(iBeginIndex, iEndIndex - iBeginIndex).Replace("<body", "<div");
                //subs = sb.ToString().Replace("</body>", "</div>");
                //subs = subs.Replace(str + ".files", "htm/" + str + ".files");
                //subs = subs.Replace("v:imagedata", "image");
                //int num1 = subs.ToLower().IndexOf("<table");
                //int num2 = subs.ToLower().LastIndexOf("</table>");
                //str1 = subs.Substring(0, num1);
                //str2 = subs.Substring(num2);

                //div1.InnerHtml = subs.ToString();

            }

  • 相关阅读:
    收藏:详解交换机基础知识
    Linux Used内存到底哪里去了?
    TCP三次握手和四次挥手以及11种状态
    操作系统深度研究(75页PPT)
    命令行版的斗地主你玩过没?
    10大黑客专用的 Linux 操作系统
    (四)Linux命令大全:帮助命令
    (三)Linux命令大全:文件搜索命令
    (二)Linux命令大全:权限管理命令
    (一)Linux命令大全:文件处理命令
  • 原文地址:https://www.cnblogs.com/110abcd/p/4580540.html
Copyright © 2011-2022 走看看