Word.Frame class
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents a frame. The Frame
object is a member of the Word.FrameCollection object.
- Extends
Remarks
Properties
borders | Returns a |
context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
height | Specifies the height (in points) of the frame. |
height |
Specifies a |
horizontal |
Specifies the horizontal distance between the frame and the surrounding text, in points. |
horizontal |
Specifies the horizontal distance between the edge of the frame and the item specified by the |
lock |
Specifies if the frame is locked. |
range | Returns a |
relative |
Specifies the relative horizontal position of the frame. |
relative |
Specifies the relative vertical position of the frame. |
shading | Returns a |
text |
Specifies if document text wraps around the frame. |
vertical |
Specifies the vertical distance (in points) between the frame and the surrounding text. |
vertical |
Specifies the vertical distance between the edge of the frame and the item specified by the |
width | Specifies the width (in points) of the frame. |
width |
Specifies the rule used to determine the width of the frame. |
Methods
copy() | Copies the frame to the Clipboard. |
cut() | Removes the frame from the document and places it on the Clipboard. |
delete() | Deletes the frame. |
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 |
select() | Selects the frame. |
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. |
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
borders
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns a BorderUniversalCollection
object that represents all the borders for the frame.
readonly borders: Word.BorderUniversalCollection;
Property Value
Remarks
context
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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
height
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the height (in points) of the frame.
height: number;
Property Value
number
Remarks
heightRule
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies a FrameSizeRule
value that represents the rule for determining the height of the frame.
heightRule: Word.FrameSizeRule | "Auto" | "AtLeast" | "Exact";
Property Value
Word.FrameSizeRule | "Auto" | "AtLeast" | "Exact"
Remarks
horizontalDistanceFromText
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the horizontal distance between the frame and the surrounding text, in points.
horizontalDistanceFromText: number;
Property Value
number
Remarks
horizontalPosition
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the horizontal distance between the edge of the frame and the item specified by the relativeHorizontalPosition
property.
horizontalPosition: number;
Property Value
number
Remarks
lockAnchor
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies if the frame is locked.
lockAnchor: boolean;
Property Value
boolean
Remarks
range
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns a Range
object that represents the portion of the document that's contained within the frame.
readonly range: Word.Range;
Property Value
Remarks
relativeHorizontalPosition
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the relative horizontal position of the frame.
relativeHorizontalPosition: Word.RelativeHorizontalPosition | "Margin" | "Page" | "Column" | "Character" | "LeftMargin" | "RightMargin" | "InsideMargin" | "OutsideMargin";
Property Value
Word.RelativeHorizontalPosition | "Margin" | "Page" | "Column" | "Character" | "LeftMargin" | "RightMargin" | "InsideMargin" | "OutsideMargin"
Remarks
relativeVerticalPosition
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the relative vertical position of the frame.
relativeVerticalPosition: Word.RelativeVerticalPosition | "Margin" | "Page" | "Paragraph" | "Line" | "TopMargin" | "BottomMargin" | "InsideMargin" | "OutsideMargin";
Property Value
Word.RelativeVerticalPosition | "Margin" | "Page" | "Paragraph" | "Line" | "TopMargin" | "BottomMargin" | "InsideMargin" | "OutsideMargin"
Remarks
shading
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns a ShadingUniversal
object that refers to the shading formatting for the frame.
readonly shading: Word.ShadingUniversal;
Property Value
Remarks
textWrap
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies if document text wraps around the frame.
textWrap: boolean;
Property Value
boolean
Remarks
verticalDistanceFromText
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the vertical distance (in points) between the frame and the surrounding text.
verticalDistanceFromText: number;
Property Value
number
Remarks
verticalPosition
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the vertical distance between the edge of the frame and the item specified by the relativeVerticalPosition
property.
verticalPosition: number;
Property Value
number
Remarks
width
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the width (in points) of the frame.
width: number;
Property Value
number
Remarks
widthRule
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the rule used to determine the width of the frame.
widthRule: Word.FrameSizeRule | "Auto" | "AtLeast" | "Exact";
Property Value
Word.FrameSizeRule | "Auto" | "AtLeast" | "Exact"
Remarks
Method Details
copy()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Copies the frame to the Clipboard.
copy(): void;
Returns
void
Remarks
cut()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Removes the frame from the document and places it on the Clipboard.
cut(): void;
Returns
void
Remarks
delete()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Deletes the frame.
delete(): void;
Returns
void
Remarks
load(options)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.FrameLoadOptions): Word.Frame;
Parameters
- options
- Word.Interfaces.FrameLoadOptions
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.Frame;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.Frame;
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
select()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Selects the frame.
select(): void;
Returns
void
Remarks
set(properties, options)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.FrameUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Word.Interfaces.FrameUpdateData
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)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Word.Frame): void;
Parameters
- properties
- Word.Frame
Returns
void
toJSON()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.Frame
object is an API object, the toJSON
method returns a plain JavaScript object (typed as Word.Interfaces.FrameData
) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Word.Interfaces.FrameData;
Returns
track()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.Frame;
Returns
untrack()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
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.Frame;