java.lang.Objectcom.aspose.words.OutlineOptions
public class OutlineOptions
Constructor Summary |
---|
OutlineOptions()
|
Property Getters/Setters Summary | ||
---|---|---|
BookmarksOutlineLevelCollection | getBookmarksOutlineLevels() | |
Allows to specify individual bookmarks outline level. | ||
boolean | getCreateMissingOutlineLevels() | |
void | setCreateMissingOutlineLevels(boolean value) | |
Gets or sets a value determining whether or not to create missing outline levels when the document is exported. Default value for this property is false. |
||
boolean | getCreateOutlinesForHeadingsInTables() | |
void | setCreateOutlinesForHeadingsInTables(boolean value) | |
Specifies whether or not to create outlines for headings (paragraphs formatted with the Heading styles) inside tables. | ||
int | getDefaultBookmarksOutlineLevel() | |
void | setDefaultBookmarksOutlineLevel(int value) | |
Specifies the default level in the document outline at which to display Word bookmarks. | ||
int | getExpandedOutlineLevels() | |
void | setExpandedOutlineLevels(int value) | |
Specifies how many levels in the document outline to show expanded when the file is viewed. | ||
int | getHeadingsOutlineLevels() | |
void | setHeadingsOutlineLevels(int value) | |
Specifies how many levels of headings (paragraphs formatted with the Heading styles) to include in the document outline. |
Constructor Detail |
---|
public OutlineOptions()
Property Getters/Setters Detail |
---|
getBookmarksOutlineLevels | |
public BookmarksOutlineLevelCollection getBookmarksOutlineLevels() |
If bookmark level is not specified in this collection then
Example:
Shows how adding bookmarks outlines with whitespaces(pdf, xps, swf)Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); //Add bookmarks with whitespaces. MS Word formats (like doc, docx) does not support bookmarks with whitespaces by default //and all whitespaces in the bookmarks were replaced with underscores. If you need to use bookmarks in PDF, XPS or SWF outlines, you can use them with whitespaces. builder.startBookmark("My Bookmark"); builder.writeln("Text inside a bookmark."); builder.startBookmark("Nested Bookmark"); builder.writeln("Text inside a NestedBookmark."); builder.endBookmark("Nested Bookmark"); builder.writeln("Text after Nested Bookmark."); builder.endBookmark("My Bookmark"); //Specify bookmarks outline level. If you are using xps or swf format, just use XpsSaveOptions and SwfSaveOptions. PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); pdfSaveOptions.getOutlineOptions().getBookmarksOutlineLevels().add("My Bookmark", 1); pdfSaveOptions.getOutlineOptions().getBookmarksOutlineLevels().add("Nested Bookmark", 2); doc.save(getArtifactsDir() + "Bookmarks.WhiteSpaces.pdf", pdfSaveOptions);
getCreateMissingOutlineLevels/setCreateMissingOutlineLevels | |
public boolean getCreateMissingOutlineLevels() / public void setCreateMissingOutlineLevels(boolean value) |
Gets or sets a value determining whether or not to create missing outline levels when the document is exported.
Default value for this property is false.
Example:
Shows how to create missing outline levels saving the document in PDFDocument doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Creating TOC entries builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1); builder.writeln("Heading 1"); builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_4); builder.writeln("Heading 1.1.1.1"); builder.writeln("Heading 1.1.1.2"); builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_9); builder.writeln("Heading 1.1.1.1.1.1.1.1.1"); builder.writeln("Heading 1.1.1.1.1.1.1.1.2"); // Create "PdfSaveOptions" with some mandatory parameters // "HeadingsOutlineLevels" specifies how many levels of headings to include in the document outline // "CreateMissingOutlineLevels" determining whether or not to create missing heading levels PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); pdfSaveOptions.getOutlineOptions().setHeadingsOutlineLevels(9); pdfSaveOptions.getOutlineOptions().setCreateMissingOutlineLevels(true); pdfSaveOptions.setSaveFormat(SaveFormat.PDF); doc.save(getArtifactsDir() + "CreateMissingOutlineLevels.pdf", pdfSaveOptions);
getCreateOutlinesForHeadingsInTables/setCreateOutlinesForHeadingsInTables | |
public boolean getCreateOutlinesForHeadingsInTables() / public void setCreateOutlinesForHeadingsInTables(boolean value) |
Default value is false.
getDefaultBookmarksOutlineLevel/setDefaultBookmarksOutlineLevel | |
public int getDefaultBookmarksOutlineLevel() / public void setDefaultBookmarksOutlineLevel(int value) |
Individual bookmarks level could be specified using
Specify 0 and Word bookmarks will not be displayed in the document outline. Specify 1 and Word bookmarks will be displayed in the document outline at level 1; 2 for level 2 and so on.
Default is 0. Valid range is 0 to 9.
getExpandedOutlineLevels/setExpandedOutlineLevels | |
public int getExpandedOutlineLevels() / public void setExpandedOutlineLevels(int value) |
Note that this options will not work when saving to XPS.
Specify 0 and the document outline will be collapsed; specify 1 and the first level items in the outline will be expanded and so on.
Default is 0. Valid range is 0 to 9.
Example:
Converts a whole document to PDF with three levels in the document outline.Document doc = new Document(getMyDir() + "Rendering.doc"); PdfSaveOptions options = new PdfSaveOptions(); options.getOutlineOptions().setHeadingsOutlineLevels(3); options.getOutlineOptions().setExpandedOutlineLevels(1); doc.save(getArtifactsDir() + "Rendering.SaveToPdfWithOutline.pdf", options);
getHeadingsOutlineLevels/setHeadingsOutlineLevels | |
public int getHeadingsOutlineLevels() / public void setHeadingsOutlineLevels(int value) |
Specify 0 for no headings in the outline; specify 1 for one level of headings in the outline and so on.
Default is 0. Valid range is 0 to 9.
Example:
Converts a whole document to PDF with three levels in the document outline.Document doc = new Document(getMyDir() + "Rendering.doc"); PdfSaveOptions options = new PdfSaveOptions(); options.getOutlineOptions().setHeadingsOutlineLevels(3); options.getOutlineOptions().setExpandedOutlineLevels(1); doc.save(getArtifactsDir() + "Rendering.SaveToPdfWithOutline.pdf", options);