zoukankan      html  css  js  c++  java
  • MathML转换成OfficeML

    
    
      public XslCompiledTransform XslTransforms;
                XslTransforms = new XslCompiledTransform();
                XslTransforms.Load(@"D:DocEditorMicrosoft OfficeOffice14MML2OMML.xsl");
        





    // The MML2OMML.xsl file is located under // %ProgramFiles%Microsoft OfficeOffice12 /// <summary> /// 获取键值hash /// </summary> /// <param name="Docurl"></param> /// <param name="MathMl"></param> /// <returns></returns> public IDictionary<String,OpenXmlElement> GetOMMLHash(IDictionary<string, string> MathML) { IDictionary<String, OpenXmlElement> Currentresult=new Dictionary<string,OpenXmlElement>(); foreach (var MMLname in MathML.Keys) { // Load the file containing your MathML presentation markup. using (XmlReader reader = XmlReader.Create(new StringReader(MathML[MMLname]))) { using (MemoryStream ms = new MemoryStream()) { XmlWriterSettings settings = XslTransforms.OutputSettings.Clone(); // Configure xml writer to omit xml declaration. settings.ConformanceLevel = ConformanceLevel.Fragment; settings.OmitXmlDeclaration = true; XmlWriter xw = XmlWriter.Create(ms, settings); // Transform our MathML to OfficeMathML XslTransforms.Transform(reader, xw); ms.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(ms, Encoding.UTF8); string officeML = sr.ReadToEnd(); // Create a OfficeMath instance from the // OfficeMathML xml. DocumentFormat.OpenXml.Math.OfficeMath omml = new DocumentFormat.OpenXml.Math.OfficeMath(officeML); Currentresult[MMLname] = omml; } } } return Currentresult; }
  • 相关阅读:
    POJ 1936 All in All
    POJ 2305 Basic remains
    POJ 2081 Recaman's Sequence
    MFC MDI 窗口函数执行顺序
    decompose
    不新建一个文档
    code mistake
    ...
    paper
    stereo
  • 原文地址:https://www.cnblogs.com/daxiongblog/p/4941652.html
Copyright © 2011-2022 走看看