java.lang.Object
com.aspose.words.OutlineOptions
public class OutlineOptions
To learn more, visit the Save a Document documentation article.
| 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 |
||
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 to set outline levels for bookmarks.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a bookmark with another bookmark nested inside it.
builder.startBookmark("Bookmark 1");
builder.writeln("Text inside Bookmark 1.");
builder.startBookmark("Bookmark 2");
builder.writeln("Text inside Bookmark 1 and 2.");
builder.endBookmark("Bookmark 2");
builder.writeln("Text inside Bookmark 1.");
builder.endBookmark("Bookmark 1");
// Insert another bookmark.
builder.startBookmark("Bookmark 3");
builder.writeln("Text inside Bookmark 3.");
builder.endBookmark("Bookmark 3");
// When saving to .pdf, bookmarks can be accessed via a drop-down menu and used as anchors by most readers.
// Bookmarks can also have numeric values for outline levels,
// enabling lower level outline entries to hide higher-level child entries when collapsed in the reader.
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
BookmarksOutlineLevelCollection outlineLevels = pdfSaveOptions.getOutlineOptions().getBookmarksOutlineLevels();
outlineLevels.add("Bookmark 1", 1);
outlineLevels.add("Bookmark 2", 2);
outlineLevels.add("Bookmark 3", 3);
Assert.assertEquals(outlineLevels.getCount(), 3);
Assert.assertTrue(outlineLevels.contains("Bookmark 1"));
Assert.assertEquals(outlineLevels.get(0), 1);
Assert.assertEquals(outlineLevels.get("Bookmark 2"), 2);
Assert.assertEquals(outlineLevels.indexOfKey("Bookmark 3"), 2);
// We can remove two elements so that only the outline level designation for "Bookmark 1" is left.
outlineLevels.removeAt(2);
outlineLevels.remove("Bookmark 2");
// There are nine outline levels. Their numbering will be optimized during the save operation.
// In this case, levels "5" and "9" will become "2" and "3".
outlineLevels.add("Bookmark 2", 5);
outlineLevels.add("Bookmark 3", 9);
doc.save(getArtifactsDir() + "BookmarksOutlineLevelCollection.BookmarkLevels.pdf", pdfSaveOptions);
// Emptying this collection will preserve the bookmarks and put them all on the same outline level.
outlineLevels.clear();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.
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.
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.