A Note object represents a single footnote, endnote, or section note. The textual content of each note is stored in a communal Text object that holds all notes of similar type (see the fullText property below). However, each Note object represents a single logically distinct note.
The term note reference refers to the numeric placeholder for each note, eg: “3”, “iii”, “三”, etc. Each note has two note such references, one in the main document body and another before the note’s content. By definition the note reference does not include any punctuation or whitespace that follows it, as is typical in the note area. For example, in the note “3. footnote” the period and space are part of the note’s content, not the note reference.
Existing Note objects can be obtained through commands like Document.allNotes and Text.noteAtIndex.
Note Type Commands
Note.selectedNote v2.0.5
Returns the first Note object that is contained in the active document’s selection. A note is considered to be selected if either its reference in the main body text is encompassed, or any part of the note’s editable text is selected. Returns the @undefined value if no note is selected.
Note.selectedNotes v2.0.5
Returns all Note objects that are selected in the active document. A note is considered to be selected if either its reference in the main body text is encompassed, or any part of the note’s editable text is selected. Returns the @undefined value if no notes are selected.
Note.insertFootnoteInTextAtIndex text, charIndex, [noteContent] v1.1
Inserts a new footnote into the given Text object at the provided character index, eg: the first character of the footnote reference be at the given index. This command returns a Note object that represents the new footnote. If the text object does not allow footnotes (eg: a table cell) then this command returns the @undefined value.
The optional noteContent argument (available in v1.2) specifies the text to use for the new note’s content. As defined earlier, this content includes any text like punctuation or whitespace not strictly part of the note reference. If this argument is not given then the default note content for the document is used (as configured by the user in the stylesheet).
Note.insertEndnoteInTextAtIndex text, charIndex, [noteContent] v1.1
Works exactly like the command insertFootnoteInTextAtIndex (above), but instead of inserting a footnote will insert either a document or section endnote.
Whether the new note is a section or document endnote depends on the way the user has configured the note styles in the document. Currently the application only allows one type of endnote placement per document, and thus the placement chosen for the user’s Endnote note style will be used for the inserted note.
Note Object Properties
.placement v1.1
Returns a string that describes where this note should be placed. The string can be either “page” (for footnotes), “section” (for section notes), or “document” (for endnotes). Read-only.
.fullText v1.1
Returns the Text object that holds the contents of all notes of similar placement. For endnotes this text object holds all endnotes in the same document. For footnotes this text holds all footnotes in the same document, regardless of what page they display on. For section notes, this text holds all notes in that particular document section.
The content of individual notes in this text are divided from one another by one or more whitespace characters. This whitespace character can be a newline, page break, or tab, depending on the layout of notes in the document.
If the note is not currently placed in a document, this returns the @undefined value. Read-only.
Note: the returned text object follows reference semantics, eg: changes to it will change the contents of the document itself.
.fullTextRange v1.1
Returns a Range object that specifies where in the fullText object the note’s content occurs. This range includes the note reference and the actual note text, but excludes the whitespace that may follow the note to separate it from other notes of similar placement.
If the note is not currently placed in a document, this returns the @undefined value. Read-only.
.fullTextReferenceRange v1.1
Returns a Range object for only the note’s reference in the fullText object.
If the note is not currently placed in a document, this returns the @undefined value. Read-only.
.fullTextContentRange v1.1
Returns a Range object for only the note’s text in the fullText object. This includes the whitespace and punctuation (if any) between the note reference and the note text, but excludes the whitespace that may follow the note to separate it from other notes of similar placement.
If the note is not currently placed in a document, this returns the @undefined value. Read-only.
.unplacedText v1.3
For notes that have not yet been placed (eg: discovered by the layout mechanism during page layout) this returns the Text object holding the note text. The content in this text object is logically equivalent to that described by the fullTextContentRange property (eg: it does not include the note reference, etc).
This transitory content is eventually combined with other notes of similar placement in the fullText storage. If the note is already placed, this returns the @undefined value. Read-only.
.documentText v1.1
Returns the main document body Text object in which the note reference resides. If the note is not currently in a document this returns the @undefined value. Read-only.
Note: the returned text object follows reference semantics, eg: changes to it will change the contents of the document itself.
.documentTextRange v1.1
Returns a Range object that specifies where in the document text object the note reference resides. If the note is not currently placed in a document, this returns the @undefined value. Read-only.
.contentSubtext v1.1
Returns a Text object that contains just the note content itself. This content does not include any other notes or the note reference. Modifications to this text object will not be reflected in the corresponding document, nor can you use this text object to generate new document selections. Read-only.
This property is equivalent to the code:
$text = $note.fullText
$contentRange = $note.fullTextContentRange
$subtext = $text.subtextInRange($contentRange)
.customReference v1.2
Returns a Text object for the note’s custom reference. If no custom reference has been set and the note follows the normal numbering sequence, returns the @undefined value. Setting this property to the @undefined value clears any custom reference.
Previous Chapter ListItem Object |
<< index >> |
Next Chapter Style Object |