Lavorare con OfficeMath
Ora è ancora più comodo lavorare con gli oggetti di tipo OfficeMath. In Aspose.Words, il cliente può facilmente giustificare e può anche gestire se un’equazione viene visualizzata in linea o in una riga separata. A maggior ragione, con la disponibilità di MathObjectType; controlli utili possono essere implementati utilizzando questo oggetto matrix.
Gli esempi di codice seguenti mostrano come utilizzare queste proprietà:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(UseOfficeMathProperties.class); | |
Document doc = new Document(dataDir + "MathEquations.docx"); | |
OfficeMath officeMath = (OfficeMath) doc.getChild(NodeType.OFFICE_MATH, 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.setDisplayType(OfficeMathDisplayType.DISPLAY); // or OfficeMathDisplayType.Inline | |
// Gets/sets Office Math justification. | |
officeMath.setJustification(OfficeMathJustification.LEFT); // Left justification of Math Paragraph. | |
doc.save(dataDir + "MathEquations_out.docx"); |