使用 OfficeMath

Contents
[ ]

现在使用 OfficeMath 类型对象更加方便。在 Aspose.Words 中,客户可以轻松地进行 Justify,还可以管理方程是内联显示还是单独行显示。更重要的是,随着 MathObjectType 的可用性;可以通过使用此矩阵对象来实现有用的控件。

以下代码示例展示了如何使用这些属性:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithFields();
Document doc = new Document(dataDir+ "MathEquations.docx");
OfficeMath officeMath = (OfficeMath)doc.GetChild(NodeType.OfficeMath, 0, true);
// Gets/sets Office Math display format type which represents whether an equation is displayed inline with the text or displayed on its own line.
officeMath.DisplayType = OfficeMathDisplayType.Display; // or OfficeMathDisplayType.Inline
// Gets/sets Office Math justification.
officeMath.Justification = OfficeMathJustification.Left; // Left justification of Math Paragraph.
doc.Save(dataDir + "MathEquations_out.docx");