Text Suite
439
Remarks
The count command with this list in a document returns the number of items in the main story only.
To count items in other stories, use the list with the text range object.
The make command isn't available for the Word class. Instead, use the
insert
command to add text
to a text range object. The following example inserts text after the first word in the active document.
insert text "New" at the end of word 1 of text object of active document
Properties
<Inheritance> text range
Inherits the properties and elements of the text range class.
Class: Word style
Plural
Word styles
Represents a single built-in or user-defined style. The Word style class includes style attributes
(font, font style, paragraph spacing, and so on) as properties of the Word style class. The Word
styles list includes all the styles in the specified document.
To return a single Word style object, use Word style index, where index is the style name, a built-in
style, or an index number. You must exactly match the spelling and spacing of the style name, but
not necessarily its capitalization. The following example modifies the font name of the user-defined
style named "Color" in the active document.
set name of font object of Word style "Color" of active document to "Arial"
The following example sets the built-in Heading 1 style to not be bold.
set bold of font object of Word style style heading1 of active document to ¬
false
The style index number represents the position of the style in the alphabetically sorted list of style
names. Note that
Word styles 1
is the first style in the alphabetic list. The following example
displays the base style and style name of the first style in the Word styles list.
display dialog "Base style: " & base style of Word style 1 of active document ¬
& return & "Style name: " & name local of Word style 1 ¬
of
active
document
To apply a style to a range, paragraph, or multiple paragraphs, set the style property to a user-
defined or built-in style name. The following example applies the Normal style to the first four
paragraphs in the active document.
set myRange to set range (text object of active document) start (start of ¬
content of text object of paragraph 1 of active document) end (end ¬
of content of text object of paragraph 4 of active document)
set style of myRange to style normal