This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open a document | |
auto doc = MakeObject<Document>(u"OpenType.Document.docx"); | |
// When the text shaper factory is set, the layout starts to use OpenType features. | |
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory | |
doc->get_LayoutOptions()->set_TextShaperFactory(Shaping::HarfBuzz::HarfBuzzTextShaperFactory::get_Instance()); | |
// Render the document to PDF format | |
doc->Save(u"OpenType.Document.pdf"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
LoadOptions loadOptions = new LoadOptions(); | |
loadOptions.setRecoveryMode(DocumentRecoveryMode.TRY_RECOVER); | |
Document doc = new Document(getMyDir() + "Corrupted footnotes.docx", loadOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(getMyDir() + "Page fields.docx"); | |
// Default behavior: | |
// The extracted page numbering is the same as in the original document, as if we had selected "Print 2 pages" in MS Word. | |
// The start page will be set to 2 and the field indicating the number of pages will be removed | |
// and replaced with a constant value equal to the number of pages. | |
Document extractedDoc1 = doc.extractPages(1, 1); | |
extractedDoc1.save(getArtifactsDir() + "Document.ExtractPagesWithOptions.Default.docx"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
Document doc = new Document(MyDir + "Office math.docx"); | |
MarkdownSaveOptions saveOptions = new MarkdownSaveOptions(); | |
saveOptions.OfficeMathExportMode = MarkdownOfficeMathExportMode.Latex; | |
doc.Save(ArtifactsDir + "MarkdownSaveOptions.ExportOfficeMathAsLatex.md", saveOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(getMyDir() + "Rendering.docx"); | |
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG); | |
// Set up a grid layout with: | |
// - 3 columns per row. | |
// - 10pts spacing between pages (horizontal and vertical). | |
options.setPageLayout(MultiPageLayout.grid(3, 10, 10)); | |
// Customize the background and border. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
Document doc = new Document(MyDir + "Rendering.docx"); | |
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg); | |
// Set up a grid layout with: | |
// - 3 columns per row. | |
// - 10pts spacing between pages (horizontal and vertical). | |
options.PageLayout = MultiPageLayout.Grid(3, 10, 10); | |
// Customize the background and border. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(getMyDir() + "Bookmarks.docx"); | |
// By index: | |
Bookmark bookmark1 = doc.getRange().getBookmarks().get(0); | |
// By name: | |
Bookmark bookmark2 = doc.getRange().getBookmarks().get("MyBookmark3"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(); | |
String styleName = ""; | |
// Get styles collection from the document. | |
StyleCollection styles = doc.getStyles(); | |
for (Style style : styles) { | |
if ("".equals(styleName)) { | |
styleName = style.getName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(); | |
CustomXmlPart xmlPart = | |
doc.getCustomXmlParts().add(UUID.randomUUID().toString(), "<root><text>Hello, World!</text></root>"); | |
StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.PLAIN_TEXT, MarkupLevel.BLOCK); | |
doc.getFirstSection().getBody().appendChild(sdt); | |
sdt.getXmlMapping().setMapping(xmlPart, "/root[1]/text[1]", ""); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java.git. | |
Document doc = new Document(getMyDir() + "Document.docx"); | |
doc.getSections().get(0).getRange().delete(); |
NewerOlder