Word.View class
Contains the view attributes (such as show all, field shading, and table gridlines) for a window or pane.
- Extends
Remarks
Properties
| are |
Specifies whether all nonprinting characters are displayed. |
| are |
Gets whether background colors and images are shown when the document is displayed in print layout view. |
| are |
Gets whether square brackets are displayed at the beginning and end of each bookmark. |
| are |
Specifies whether Microsoft Word displays the comments in the document. |
| are |
Specifies whether Microsoft Word displays connecting lines from the text to the revision and comment balloons. |
| are |
Gets whether crop marks are shown in the corners of pages to indicate where margins are located. |
| are |
Gets whether objects created with the drawing tools are displayed in print layout view. |
| are |
Specifies whether shading is applied to the ranges in the document that users have permission to modify. |
| are |
Specifies whether field codes are displayed. |
| are |
Specifies whether Microsoft Word displays formatting changes made to the document with Track Changes enabled. |
| are |
Specifies whether handwritten ink annotations are shown or hidden. |
| are |
Specifies whether Microsoft Word displays insertions and deletions made to the document with Track Changes enabled. |
| are |
Gets whether lines wrap at the right edge of the document window rather than at the right margin or the right column boundary. |
| are |
Gets whether object anchors are displayed next to items that can be positioned in print layout view. |
| are |
Gets whether Microsoft Word displays optional line breaks. |
| are |
Gets whether optional hyphens are displayed. |
| are |
Gets whether other authors' presence should be visible in the document. |
| are |
Gets whether the top and bottom margins and the gray area between pages in the document are displayed. |
| are |
Gets whether paragraph marks are displayed. |
| are |
Gets whether blank boxes are displayed as placeholders for pictures. |
| are |
Specifies whether Microsoft Word displays revisions and comments made to the document with Track Changes enabled. |
| are |
Gets whether space characters are displayed. |
| are |
Specifies whether table gridlines are displayed. |
| are |
Gets whether tab characters are displayed. |
| are |
Gets whether dotted lines are displayed around page margins, text columns, objects, and frames in print layout view. |
| column |
Specifies the column width in Reading mode. |
| context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
| field |
Gets on-screen shading for fields. |
| is |
Specifies whether all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display. |
| is |
Specifies whether only the first line of body text is shown in outline view. |
| is |
Specifies whether character formatting is visible in outline view. |
| is |
Specifies whether the window is in full-screen view. |
| is |
Gets whether text formatted as hidden text is displayed. |
| is |
Gets whether highlight formatting is displayed and printed with the document. |
| is |
Specifies whether the document is in conflict mode view. |
| is |
Specifies whether Microsoft Word is in Panning mode. |
| is |
Specifies whether the document is being viewed in reading layout view. |
| is |
Specifies whether mail merge data is displayed instead of mail merge fields. |
| is |
Specifies whether the text in the document is visible when the header and footer areas are displayed. |
| is |
Specifies whether the pointer is displayed as a magnifying glass in print preview. |
| is |
Specifies whether pages displayed in reading layout view are displayed using the same layout as printed pages. |
| is |
Specifies whether XML tags are visible in the document. |
| markup |
Specifies the display mode for tracked changes. |
| page |
Specifies the page color in Reading mode. |
| page |
Specifies the page movement type. |
| reading |
Specifies whether margins are visible or hidden when the document is viewed in Full Screen Reading view. |
| revisions |
Gets whether Word displays revision balloons in the left or right margin in the document. |
| revisions |
Specifies the width of the revision balloons. |
| revisions |
Specifies how Microsoft Word measures the width of revision balloons. |
| revisions |
Gets the instance of a |
| seek |
Specifies the document element displayed in print layout view. |
| split |
Specifies the active window pane. |
| type | Specifies the view type. |
Methods
| collapse |
Collapses all the headings in the document. |
| collapse |
Collapses the text under the selection or the specified range by one heading level. |
| expand |
Expands all the headings in the document. |
| expand |
Expands the text under the selection by one heading level. |
| load(options) | Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| next |
Moves to the next header or footer, depending on whether a header or footer is displayed in the view. |
| previous |
Moves to the previous header or footer, depending on whether a header or footer is displayed in the view. |
| set(properties, options) | Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. |
| set(properties) | Sets multiple properties on the object at the same time, based on an existing loaded object. |
| show |
Switches between showing all text (headings and body text) and showing only headings. |
| show |
Shows all headings up to the specified heading level and hides subordinate headings and body text. |
| toJSON() | Overrides the JavaScript |
| track() | Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across |
| untrack() | Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call |
Property Details
areAllNonprintingCharactersDisplayed
Specifies whether all nonprinting characters are displayed.
areAllNonprintingCharactersDisplayed: boolean;
Property Value
boolean
Remarks
areBackgroundsDisplayed
Gets whether background colors and images are shown when the document is displayed in print layout view.
areBackgroundsDisplayed: boolean;
Property Value
boolean
Remarks
areBookmarksIndicated
Gets whether square brackets are displayed at the beginning and end of each bookmark.
readonly areBookmarksIndicated: boolean;
Property Value
boolean
Remarks
areCommentsDisplayed
Specifies whether Microsoft Word displays the comments in the document.
areCommentsDisplayed: boolean;
Property Value
boolean
Remarks
areConnectingLinesToRevisionsBalloonDisplayed
Specifies whether Microsoft Word displays connecting lines from the text to the revision and comment balloons.
areConnectingLinesToRevisionsBalloonDisplayed: boolean;
Property Value
boolean
Remarks
areCropMarksDisplayed
Gets whether crop marks are shown in the corners of pages to indicate where margins are located.
readonly areCropMarksDisplayed: boolean;
Property Value
boolean
Remarks
areDrawingsDisplayed
Gets whether objects created with the drawing tools are displayed in print layout view.
readonly areDrawingsDisplayed: boolean;
Property Value
boolean
Remarks
areEditableRangesShaded
Specifies whether shading is applied to the ranges in the document that users have permission to modify.
areEditableRangesShaded: boolean;
Property Value
boolean
Remarks
areFieldCodesDisplayed
Specifies whether field codes are displayed.
areFieldCodesDisplayed: boolean;
Property Value
boolean
Remarks
areFormatChangesDisplayed
Specifies whether Microsoft Word displays formatting changes made to the document with Track Changes enabled.
areFormatChangesDisplayed: boolean;
Property Value
boolean
Remarks
areInkAnnotationsDisplayed
Specifies whether handwritten ink annotations are shown or hidden.
areInkAnnotationsDisplayed: boolean;
Property Value
boolean
Remarks
areInsertionsAndDeletionsDisplayed
Specifies whether Microsoft Word displays insertions and deletions made to the document with Track Changes enabled.
areInsertionsAndDeletionsDisplayed: boolean;
Property Value
boolean
Remarks
areLinesWrappedToWindow
Gets whether lines wrap at the right edge of the document window rather than at the right margin or the right column boundary.
readonly areLinesWrappedToWindow: boolean;
Property Value
boolean
Remarks
areObjectAnchorsDisplayed
Gets whether object anchors are displayed next to items that can be positioned in print layout view.
readonly areObjectAnchorsDisplayed: boolean;
Property Value
boolean
Remarks
areOptionalBreaksDisplayed
Gets whether Microsoft Word displays optional line breaks.
readonly areOptionalBreaksDisplayed: boolean;
Property Value
boolean
Remarks
areOptionalHyphensDisplayed
Gets whether optional hyphens are displayed.
readonly areOptionalHyphensDisplayed: boolean;
Property Value
boolean
Remarks
areOtherAuthorsVisible
Gets whether other authors' presence should be visible in the document.
areOtherAuthorsVisible: boolean;
Property Value
boolean
Remarks
arePageBoundariesDisplayed
Gets whether the top and bottom margins and the gray area between pages in the document are displayed.
readonly arePageBoundariesDisplayed: boolean;
Property Value
boolean
Remarks
areParagraphsMarksDisplayed
Gets whether paragraph marks are displayed.
readonly areParagraphsMarksDisplayed: boolean;
Property Value
boolean
Remarks
arePicturePlaceholdersDisplayed
Gets whether blank boxes are displayed as placeholders for pictures.
readonly arePicturePlaceholdersDisplayed: boolean;
Property Value
boolean
Remarks
areRevisionsAndCommentsDisplayed
Specifies whether Microsoft Word displays revisions and comments made to the document with Track Changes enabled.
areRevisionsAndCommentsDisplayed: boolean;
Property Value
boolean
Remarks
areSpacesIndicated
Gets whether space characters are displayed.
readonly areSpacesIndicated: boolean;
Property Value
boolean
Remarks
areTableGridlinesDisplayed
Specifies whether table gridlines are displayed.
areTableGridlinesDisplayed: boolean;
Property Value
boolean
Remarks
areTabsDisplayed
Gets whether tab characters are displayed.
readonly areTabsDisplayed: boolean;
Property Value
boolean
Remarks
areTextBoundariesDisplayed
Gets whether dotted lines are displayed around page margins, text columns, objects, and frames in print layout view.
readonly areTextBoundariesDisplayed: boolean;
Property Value
boolean
Remarks
columnWidth
Specifies the column width in Reading mode.
columnWidth: Word.ColumnWidth | "Narrow" | "Default" | "Wide";
Property Value
Word.ColumnWidth | "Narrow" | "Default" | "Wide"
Remarks
context
The request context associated with the object. This connects the add-in's process to the Office host application's process.
context: RequestContext;
Property Value
fieldShading
Gets on-screen shading for fields.
readonly fieldShading: Word.FieldShading | "Never" | "Always" | "WhenSelected";
Property Value
Word.FieldShading | "Never" | "Always" | "WhenSelected"
Remarks
isDraft
Specifies whether all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display.
isDraft: boolean;
Property Value
boolean
Remarks
isFirstLineOnlyDisplayed
Specifies whether only the first line of body text is shown in outline view.
isFirstLineOnlyDisplayed: boolean;
Property Value
boolean
Remarks
isFormatDisplayed
Specifies whether character formatting is visible in outline view.
isFormatDisplayed: boolean;
Property Value
boolean
Remarks
isFullScreen
Specifies whether the window is in full-screen view.
isFullScreen: boolean;
Property Value
boolean
Remarks
isHiddenTextDisplayed
Gets whether text formatted as hidden text is displayed.
readonly isHiddenTextDisplayed: boolean;
Property Value
boolean
Remarks
isHighlightingDisplayed
Gets whether highlight formatting is displayed and printed with the document.
readonly isHighlightingDisplayed: boolean;
Property Value
boolean
Remarks
isInConflictMode
Specifies whether the document is in conflict mode view.
isInConflictMode: boolean;
Property Value
boolean
Remarks
isInPanning
Specifies whether Microsoft Word is in Panning mode.
isInPanning: boolean;
Property Value
boolean
Remarks
isInReadingLayout
Specifies whether the document is being viewed in reading layout view.
isInReadingLayout: boolean;
Property Value
boolean
Remarks
isMailMergeDataView
Specifies whether mail merge data is displayed instead of mail merge fields.
isMailMergeDataView: boolean;
Property Value
boolean
Remarks
isMainTextLayerVisible
Specifies whether the text in the document is visible when the header and footer areas are displayed.
isMainTextLayerVisible: boolean;
Property Value
boolean
Remarks
isPointerShownAsMagnifier
Specifies whether the pointer is displayed as a magnifying glass in print preview.
isPointerShownAsMagnifier: boolean;
Property Value
boolean
Remarks
isReadingLayoutActualView
Specifies whether pages displayed in reading layout view are displayed using the same layout as printed pages.
isReadingLayoutActualView: boolean;
Property Value
boolean
Remarks
isXmlMarkupVisible
Specifies whether XML tags are visible in the document.
isXmlMarkupVisible: boolean;
Property Value
boolean
Remarks
markupMode
Specifies the display mode for tracked changes.
markupMode: Word.RevisionsMode | "Balloon" | "Inline" | "Mixed";
Property Value
Word.RevisionsMode | "Balloon" | "Inline" | "Mixed"
Remarks
pageColor
Specifies the page color in Reading mode.
pageColor: Word.PageColor | "None" | "Sepia" | "Inverse";
Property Value
Word.PageColor | "None" | "Sepia" | "Inverse"
Remarks
pageMovementType
Specifies the page movement type.
pageMovementType: Word.PageMovementType | "Vertical" | "SideToSide";
Property Value
Word.PageMovementType | "Vertical" | "SideToSide"
Remarks
readingLayoutTruncateMargins
Specifies whether margins are visible or hidden when the document is viewed in Full Screen Reading view.
readingLayoutTruncateMargins: Word.ReadingLayoutMargin | "Automatic" | "Suppress" | "Full";
Property Value
Word.ReadingLayoutMargin | "Automatic" | "Suppress" | "Full"
Remarks
revisionsBalloonSide
Gets whether Word displays revision balloons in the left or right margin in the document.
readonly revisionsBalloonSide: Word.RevisionsBalloonMargin | "Left" | "Right";
Property Value
Word.RevisionsBalloonMargin | "Left" | "Right"
Remarks
revisionsBalloonWidth
Specifies the width of the revision balloons.
revisionsBalloonWidth: number;
Property Value
number
Remarks
revisionsBalloonWidthType
Specifies how Microsoft Word measures the width of revision balloons.
revisionsBalloonWidthType: Word.RevisionsBalloonWidthType | "Percent" | "Points";
Property Value
Word.RevisionsBalloonWidthType | "Percent" | "Points"
Remarks
revisionsFilter
Gets the instance of a RevisionsFilter object.
readonly revisionsFilter: Word.RevisionsFilter;
Property Value
Remarks
seekView
Specifies the document element displayed in print layout view.
seekView: Word.SeekView | "MainDocument" | "PrimaryHeader" | "FirstPageHeader" | "EvenPagesHeader" | "PrimaryFooter" | "FirstPageFooter" | "EvenPagesFooter" | "Footnotes" | "Endnotes" | "CurrentPageHeader" | "CurrentPageFooter";
Property Value
Word.SeekView | "MainDocument" | "PrimaryHeader" | "FirstPageHeader" | "EvenPagesHeader" | "PrimaryFooter" | "FirstPageFooter" | "EvenPagesFooter" | "Footnotes" | "Endnotes" | "CurrentPageHeader" | "CurrentPageFooter"
Remarks
splitSpecial
Specifies the active window pane.
splitSpecial: Word.SpecialPane | "None" | "PrimaryHeader" | "FirstPageHeader" | "EvenPagesHeader" | "PrimaryFooter" | "FirstPageFooter" | "EvenPagesFooter" | "Footnotes" | "Endnotes" | "FootnoteContinuationNotice" | "FootnoteContinuationSeparator" | "FootnoteSeparator" | "EndnoteContinuationNotice" | "EndnoteContinuationSeparator" | "EndnoteSeparator" | "Comments" | "CurrentPageHeader" | "CurrentPageFooter" | "Revisions" | "RevisionsHoriz" | "RevisionsVert";
Property Value
Word.SpecialPane | "None" | "PrimaryHeader" | "FirstPageHeader" | "EvenPagesHeader" | "PrimaryFooter" | "FirstPageFooter" | "EvenPagesFooter" | "Footnotes" | "Endnotes" | "FootnoteContinuationNotice" | "FootnoteContinuationSeparator" | "FootnoteSeparator" | "EndnoteContinuationNotice" | "EndnoteContinuationSeparator" | "EndnoteSeparator" | "Comments" | "CurrentPageHeader" | "CurrentPageFooter" | "Revisions" | "RevisionsHoriz" | "RevisionsVert"
Remarks
type
Specifies the view type.
type: Word.ViewType | "Normal" | "Outline" | "Print" | "PrintPreview" | "Master" | "Web" | "Reading" | "Conflict";
Property Value
Word.ViewType | "Normal" | "Outline" | "Print" | "PrintPreview" | "Master" | "Web" | "Reading" | "Conflict"
Remarks
Method Details
collapseAllHeadings()
Collapses all the headings in the document.
collapseAllHeadings(): void;
Returns
void
Remarks
collapseOutline(range)
Collapses the text under the selection or the specified range by one heading level.
collapseOutline(range: Word.Range): void;
Parameters
- range
- Word.Range
A Range object that specifies the range to collapse.
Returns
void
Remarks
expandAllHeadings()
Expands all the headings in the document.
expandAllHeadings(): void;
Returns
void
Remarks
expandOutline(range)
Expands the text under the selection by one heading level.
expandOutline(range: Word.Range): void;
Parameters
- range
- Word.Range
A Range object that specifies the range to expand.
Returns
void
Remarks
load(options)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(options?: Word.Interfaces.ViewLoadOptions): Word.View;
Parameters
- options
- Word.Interfaces.ViewLoadOptions
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(propertyNames?: string | string[]): Word.View;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Word.View;
Parameters
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.
Returns
nextHeaderFooter()
Moves to the next header or footer, depending on whether a header or footer is displayed in the view.
nextHeaderFooter(): void;
Returns
void
Remarks
previousHeaderFooter()
Moves to the previous header or footer, depending on whether a header or footer is displayed in the view.
previousHeaderFooter(): void;
Returns
void
Remarks
set(properties, options)
Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.
set(properties: Interfaces.ViewUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Word.Interfaces.ViewUpdateData
A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.
- options
- OfficeExtension.UpdateOptions
Provides an option to suppress errors if the properties object tries to set any read-only properties.
Returns
void
set(properties)
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Word.View): void;
Parameters
- properties
- Word.View
Returns
void
showAllHeadings()
Switches between showing all text (headings and body text) and showing only headings.
showAllHeadings(): void;
Returns
void
Remarks
showHeading(level)
Shows all headings up to the specified heading level and hides subordinate headings and body text.
showHeading(level: number): void;
Parameters
- level
-
number
The heading level to show.
Returns
void
Remarks
toJSON()
Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that's passed to it.) Whereas the original Word.View object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.ViewData) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Word.Interfaces.ViewData;
Returns
track()
Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across .sync calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you need to add the object to the tracked object collection when the object was first created. If this object is part of a collection, you should also track the parent collection.
track(): Word.View;
Returns
untrack()
Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call context.sync() before the memory release takes effect.
untrack(): Word.View;