java.lang.Objectcom.aspose.words.Range
public class Range
The document is represented by a tree of nodes and the nodes provide operations
to work with the tree, but some operations are easier to perform if the document
is treated as a contiguous sequence of text. Range is a "facade" interface that provide methods that treat the document
or portions of the document as "flat" text regardless of the fact that the document
nodes are stored in a tree-like object model. Range does not contain any text or nodes, it is merely a view or "window"
over a fragment of a document.
Property Getters/Setters Summary | ||
---|---|---|
BookmarkCollection | getBookmarks() | |
Returns a |
||
Aspose.Words.Fields.FieldCollection | getFields() | |
Returns a |
||
Aspose.Words.Fields.FormFieldCollection | getFormFields() | |
Returns a |
||
java.lang.String | getText() | |
Gets the text of the range. |
Method Summary | ||
---|---|---|
void | delete() | |
Deletes all characters of the range. | ||
void | invalidateFieldTypes() | |
Changes field type values |
||
void | normalizeFieldTypes() | |
Changes field type values |
||
int | replace(java.lang.String oldValue, java.lang.String newValue, boolean isMatchCase, boolean isMatchWholeWord) | |
Replaces all occurrences of a specified string with another string. | ||
int | replace(java.util.regex.Pattern pattern, java.lang.String replacement) | |
Replaces all occurrences of a character pattern specified by a regular expression with another string. | ||
Document | toDocument() | |
Constructs a new fully formed document that contains the range. | ||
void | unlinkFields() | |
Unlinks fields in this range. | ||
void | updateFields() | |
Updates the values of document fields in this range. |
Property Getters/Setters Detail |
---|
getBookmarks | |
public BookmarkCollection getBookmarks() |
getFields | |
public Aspose.Words.Fields.FieldCollection getFields() |
getFormFields | |
public Aspose.Words.Fields.FormFieldCollection getFormFields() |
getText | |
public java.lang.String getText() |
The returned string includes all control and special characters as described in
Method Detail |
---|
delete | |
public void delete() |
invalidateFieldTypes | |
public void invalidateFieldTypes() |
Use this method after document changes that affect field types.
To change field type values in the whole document use
normalizeFieldTypes | |
public void normalizeFieldTypes() |
Use this method after document changes that affect field types.
To change field type values in the whole document use
replace | |
public int replace(java.lang.String oldValue, java.lang.String newValue, boolean isMatchCase, boolean isMatchWholeWord) throws java.lang.Exception |
An exception is thrown if a captured or replacement string contain one or more special characters: paragraph break, cell break, section break, field start, field separator, field end, inline picture, drawing object, footnote.
oldValue
- A string to be replaced.newValue
- A string to replace all occurrences of oldValue.isMatchCase
- True indicates case-sensitive comparison, false indicates case-insensitive comparision.isMatchWholeWord
- True indicates the oldValue must be a standalone word.replace | |
public int replace(java.util.regex.Pattern pattern, java.lang.String replacement) throws java.lang.Exception |
Replaces the whole match captured by the regular expression.
An exception is thrown if a captured or replacement string contain one or more special characters: paragraph break, cell break, section break, field start, field separator, field end, inline picture, drawing object, footnote.
pattern
- A regular expression pattern used to find matches.replacement
- A string to replace all occurrences of oldValue.toDocument | |
public Document toDocument() throws java.lang.Exception |
unlinkFields | |
public void unlinkFields() throws java.lang.Exception |
Replaces all the fields in this range with their most recent results.
To unlink fields in the whole document use
updateFields | |
public void updateFields() throws java.lang.Exception |
When you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call this method before saving if you have modified the document programmatically and want to make sure the proper (calculated) field values appear in the saved document.
There is no need to update fields after executing a mail merge because mail merge is a kind of field update and automatically updates all fields in the document.
This method does not update all field types. For the detailed list of supported field types, see the Programmers Guide.
This method does not update fields that are related to the page layout algorithms (e.g. PAGE, PAGES, PAGEREF).
The page layout-related fields are updated when you render a document or call
To update fields in the whole document use