//..................................................................... /// <summary> /// 公式中名称是正文样式,没有斜体 /// </summary> /// <param name="mathlin"></param> /// <returns></returns> public static M.Run MakeMathRun(string mathlin, bool plainstyle = false) { //M.Style fontstyle = new M.Style( ) { Val = M.StyleValues.Plain }; //RunFonts fonts = new RunFonts( ) { Ascii = "Cambria Math", HighAnsi = "Cambria Math" }; RunProperties properties = new RunProperties( ); properties.Append(OpenDocxMathExprs.MakeMathFont( )); if (plainstyle) { properties.Append(OpenDocxMathExprs.MakeMathFonStyle( )); } //--------------------------------------------- M.Text mathtext = new M.Text( ); mathtext.Text = mathlin; //--------------------------------------------- M.Run mathrun = new M.Run( ); mathrun.Append(properties); mathrun.Append(mathtext); return(mathrun); }
//..................................................................... /// <summary> /// /// </summary> /// <param name="useItalic"></param> /// <returns></returns> public static M.ControlProperties MakeControlProperties(bool useItalic = false) { RunProperties propertiesRUN = new RunProperties( ); propertiesRUN.Append(OpenDocxMathExprs.MakeMathFont()); if (useItalic) { propertiesRUN.Append(OpenDocxMathExprs.MakeMathFontItalic()); } //--------------------------------------------- M.ControlProperties propertiesCTRL = new M.ControlProperties( ); propertiesCTRL.Append(propertiesRUN); return(propertiesCTRL); }