What's new in Word JavaScript API 1.5
WordApi 1.5 added support for footnotes, endnotes, content control events, and style management.
API list
The following table lists the APIs in Word JavaScript API requirement set 1.5. To view API reference documentation for all APIs supported by Word JavaScript API requirement set 1.5 or earlier, see Word APIs in requirement set 1.5 or earlier.
Class | Fields | Description |
---|---|---|
Application | retrieveStylesFromBase64(base64File: string) | Parse styles from template Base64 file and return JSON format of retrieved styles as a string. |
Body | endnotes | Gets the collection of endnotes in the body. |
footnotes | Gets the collection of footnotes in the body. | |
getContentControls(options?: Word.ContentControlOptions) | Gets the currently supported content controls in the body. | |
ContentControl | endnotes | Gets the collection of endnotes in the content control. |
footnotes | Gets the collection of footnotes in the content control. | |
getContentControls(options?: Word.ContentControlOptions) | Gets the currently supported child content controls in this content control. | |
onDataChanged | Occurs when data within the content control are changed. | |
onDeleted | Occurs when the content control is deleted. | |
onEntered | Occurs when the content control is entered. | |
onExited | Occurs when the content control is exited, for example, when the cursor leaves the content control. | |
onSelectionChanged | Occurs when selection within the content control is changed. | |
ContentControlAddedEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
ContentControlCollection | getByChangeTrackingStates(changeTrackingStates: Word.ChangeTrackingState[]) | Gets the content controls that have the specified tracking state. |
ContentControlDataChangedEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
ContentControlDeletedEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
ContentControlEnteredEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
ContentControlExitedEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
ContentControlOptions | types | An array of content control types, item must be 'RichText' or 'PlainText'. |
ContentControlSelectionChangedEventArgs | eventType | The event type. |
ids | Gets the content control IDs. | |
source | The source of the event. | |
Document | addStyle(name: string, type: Word.StyleType) | Adds a style into the document by name and type. |
close(closeBehavior?: Word.CloseBehavior) | Closes the current document. | |
getContentControls(options?: Word.ContentControlOptions) | Gets the currently supported content controls in the document. | |
getEndnoteBody() | Gets the document's endnotes in a single body. | |
getFootnoteBody() | Gets the document's footnotes in a single body. | |
getStyles() | Gets a StyleCollection object that represents the whole style set of the document. | |
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End", insertFileOptions?: Word.InsertFileOptions) | Inserts a document into the target document at a specific location with additional properties. | |
onContentControlAdded | Occurs when a content control is added. | |
save(saveBehavior?: Word.SaveBehavior, fileName?: string) | Saves the document. | |
Field | code | Specifies the field's code instruction. |
data | Specifies data in an "Addin" field. | |
delete() | Deletes the field. | |
kind | Gets the field's kind. | |
locked | Specifies whether the field is locked. | |
select(selectionMode?: Word.SelectionMode) | Selects the field. | |
type | Gets the field's type. | |
updateResult() | Updates the field. | |
FieldCollection | getByTypes(types: Word.FieldType[]) | Gets the Field object collection including the specified types of fields. |
InsertFileOptions | importChangeTrackingMode | Represents whether the change tracking mode status from the source document should be imported. |
importPageColor | Represents whether the page color and other background information from the source document should be imported. | |
importParagraphSpacing | Represents whether the paragraph spacing from the source document should be imported. | |
importStyles | Represents whether the styles from the source document should be imported. | |
importTheme | Represents whether the theme from the source document should be imported. | |
NoteItem | body | Represents the body object of the note item. |
delete() | Deletes the note item. | |
getNext() | Gets the next note item of the same type. | |
getNextOrNullObject() | Gets the next note item of the same type. | |
reference | Represents a footnote or endnote reference in the main document. | |
type | Represents the note item type: footnote or endnote. | |
NoteItemCollection | getFirst() | Gets the first note item in this collection. |
getFirstOrNullObject() | Gets the first note item in this collection. | |
items | Gets the loaded child items in this collection. | |
Paragraph | endnotes | Gets the collection of endnotes in the paragraph. |
footnotes | Gets the collection of footnotes in the paragraph. | |
getContentControls(options?: Word.ContentControlOptions) | Gets the currently supported content controls in the paragraph. | |
ParagraphFormat | alignment | Specifies the alignment for the specified paragraphs. |
firstLineIndent | Specifies the value (in points) for a first line or hanging indent. | |
keepTogether | Specifies whether all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. | |
keepWithNext | Specifies whether the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. | |
leftIndent | Specifies the left indent. | |
lineSpacing | Specifies the line spacing (in points) for the specified paragraphs. | |
lineUnitAfter | Specifies the amount of spacing (in gridlines) after the specified paragraphs. | |
lineUnitBefore | Specifies the amount of spacing (in gridlines) before the specified paragraphs. | |
mirrorIndents | Specifies whether left and right indents are the same width. | |
outlineLevel | Specifies the outline level for the specified paragraphs. | |
rightIndent | Specifies the right indent (in points) for the specified paragraphs. | |
spaceAfter | Specifies the amount of spacing (in points) after the specified paragraph or text column. | |
spaceBefore | Specifies the spacing (in points) before the specified paragraphs. | |
widowControl | Specifies whether the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Microsoft Word repaginates the document. | |
Range | endnotes | Gets the collection of endnotes in the range. |
footnotes | Gets the collection of footnotes in the range. | |
getContentControls(options?: Word.ContentControlOptions) | Gets the currently supported content controls in the range. | |
insertEndnote(insertText?: string) | Inserts an endnote. | |
insertField(insertLocation: Word.InsertLocation | "Replace" | "Start" | "End" | "Before" | "After", fieldType?: Word.FieldType, text?: string, removeFormatting?: boolean) | Inserts a field at the specified location. | |
insertFootnote(insertText?: string) | Inserts a footnote. | |
Style | baseStyle | Gets the name of an existing style to use as the base formatting of another style. |
builtIn | Gets whether the specified style is a built-in style. | |
delete() | Deletes the style. | |
font | Gets a font object that represents the character formatting of the specified style. | |
inUse | Gets whether the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. | |
linked | Gets whether a style is a linked style that can be used for both paragraph and character formatting. | |
nameLocal | Gets the name of a style in the language of the user. | |
nextParagraphStyle | Gets the name of the style to be applied automatically to a new paragraph that is inserted after a paragraph formatted with the specified style. | |
paragraphFormat | Gets a ParagraphFormat object that represents the paragraph settings for the specified style. | |
priority | Specifies the priority. | |
quickStyle | Specifies whether the style corresponds to an available quick style. | |
type | Gets the style type. | |
unhideWhenUsed | Specifies whether the specified style is made visible as a recommended style in the Styles and in the Styles task pane in Microsoft Word after it's used in the document. | |
visibility | Specifies whether the specified style is visible as a recommended style in the Styles gallery and in the Styles task pane. | |
StyleCollection | getByName(name: string) | Get the style object by its name. |
getByNameOrNullObject(name: string) | If the corresponding style doesn't exist, then this method returns an object with its isNullObject property set to true . |
|
getCount() | Gets the number of the styles in the collection. | |
getItem(index: number) | Gets a style object by its index in the collection. | |
items | Gets the loaded child items in this collection. | |
Table | endnotes | Gets the collection of endnotes in the table. |
footnotes | Gets the collection of footnotes in the table. | |
TableRow | endnotes | Gets the collection of endnotes in the table row. |
footnotes | Gets the collection of footnotes in the table row. |
See also
Współpracuj z nami w serwisie GitHub
Źródło tej zawartości można znaleźć w witrynie GitHub, gdzie można również tworzyć i przeglądać problemy i żądania ściągnięcia. Więcej informacji znajdziesz w naszym przewodniku dla współtwórców.