• 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();

            }

  • 相关阅读:
    [React Intl] Format Numbers with Separators and Currency Symbols using react-intl FormattedNumber
    [React Intl] Format a Date Relative to the Current Date Using react-intl FormattedRelative
    [React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime
    [React Intl] Render Content with Markup Using react-intl FormattedHTMLMessage
    带你走进EJB--MDB
    Google Play和基于Feature的过滤 —— Feature 参考手册
    常见排序算法的实现
    Never-build package 'XXXX' requires always-build package 'EhLib70'
    自制的七个C,总结的太好了
    那些有影响力的语言
  • 原文地址:https://www.cnblogs.com/110abcd/p/4580540.html
Copyright © 2020-2023  润新知