//..................................................................... /// <summary> /// 使用常规的字符串生成一个分式(标准的、上下格式) /// </summary> /// <param name="upper"></param> /// <param name="lower"></param> /// <returns></returns> public static M.Fraction MakeFraction(string upper, string lower) { M.Fraction fraction = new M.Fraction( ); M.Numerator upperNUM = new M.Numerator( ); upperNUM.Append(OpenDocxMathExprs.MakeMathRun(upper)); M.Denominator lowerDEN = new M.Denominator( ); lowerDEN.Append(OpenDocxMathExprs.MakeMathRun(lower)); fraction.Append(OpenDocxMathExprs.MakeFractionProperties( )); fraction.Append(upperNUM); fraction.Append(lowerDEN); return(fraction); }
//..................................................................... /// <summary> /// /// </summary> /// <param name="upper"></param> /// <param name="lower"></param> /// <returns></returns> public static M.Fraction MakeFraction(OpenXmlElement upper, OpenXmlElement lower) { M.Fraction fraction = new M.Fraction( ); M.Numerator upperNUM = new M.Numerator( ); upperNUM.Append(upper); M.Denominator lowerDEN = new M.Denominator( ); lowerDEN.Append(lower); fraction.Append(OpenDocxMathExprs.MakeFractionProperties( )); fraction.Append(upperNUM); fraction.Append(lowerDEN); return(fraction); }