Skip to main content

OfficeTextArea Class

Allows you to access and manipulate text.

Declaration

public abstract class OfficeTextArea extends OfficeObject

Remarks

To specify the text area content, add TextParagraph objects to the collection returned by the OfficeTextArea.getParagraphs() method.

To split a paragraph into runs (spans of text that share the same formatting), add TextRun objects to the collection returned by the TextParagraph.getRuns() method.

A new shape’s text area initially contains an empty paragraph to keep the presentation document valid.

You can also use the OfficeTextArea.getText(), TextParagraph.getText(), and TextRun.setText() methods to specify text content.

Use the \r\n character sequence to split the string value into paragraphs or runs.

The following code snippet performs basic text area operations:

import com.devexpress.docs.presentation.*;
import com.devexpress.docs.office.*;
//...
// Set the text content of a shape text area.
TextArea textArea = shape.getTextArea();
textArea.setText("Hello World!");

// Find and replace a text fragment.
textArea.replaceText("Hello", "Hi");

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
JavaObject
OfficeObject
OfficeTextArea

Methods

findText(String text, TextSearchOptions options) Method

Finds all occurrences of the specified text in the text area using specified search options.

Declaration

public List<TextRange> findText(String text, TextSearchOptions options)

Parameters

Name Type Description
text String

Text to find.

options TextSearchOptions

Options for the text search.

Returns

Type Description
java.util.List<TextRange>

A list of text ranges that are occurrences of the specified text.

findText(String text) Method

Finds all occurrences of the specified text in the text area.

Declaration

public List<TextRange> findText(String text)

Parameters

Name Type Description
text String

Text to find.

Returns

Type Description
java.util.List<TextRange>

A list of text ranges that are occurrences of the specified text.

getLevel1ParagraphProperties() Method

Returns the paragraph properties for level 1 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel1ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Use the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

Note

Different presentation viewers may prioritize paragraph-level and level-specific settings differently. In some instances, top-level paragraphs may use either getParagraphProperties() or getLevel1ParagraphProperties() settings.

getLevel2ParagraphProperties() Method

Returns the paragraph properties for level 2 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel2ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Use the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel3ParagraphProperties() Method

Returns the paragraph properties for level 3 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel3ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Use the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel4ParagraphProperties() Method

Returns the paragraph properties for level 4 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel4ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel5ParagraphProperties() Method

Returns the paragraph properties for level 5 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel5ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel6ParagraphProperties() Method

Returns the paragraph properties for level 6 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel6ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel7ParagraphProperties() Method

Returns the paragraph properties for level 7 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel7ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel8ParagraphProperties() Method

Returns the paragraph properties for level 8 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel8ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getLevel9ParagraphProperties() Method

Returns the paragraph properties for level 9 paragraphs in the text area.

Declaration

public TextParagraphProperties getLevel9ParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

getParagraphProperties() Method

Returns paragraph properties for paragraphs in the text area.

Declaration

public TextParagraphProperties getParagraphProperties()

Returns

Type Description
TextParagraphProperties

Paragraph properties.

Remarks

Note

Different presentation viewers may prioritize paragraph-level and level-specific settings differently. In some instances, top-level paragraphs may use either getParagraphProperties() or getLevel1ParagraphProperties() settings.

getParagraphs() Method

Returns a collection of paragraphs in the text area.

Declaration

public ITextParagraphCollection getParagraphs()

Returns

Type Description
com.devexpress.docs.office.ITextParagraphCollection

A collection of paragraphs in the text area.

getText() Method

Returns the text of a text run string.

Declaration

public String getText()

Returns

Type Description
String

The text of the text run string.

modifyTextProperties(List<TextRange> ranges, TextProperties properties) Method

Modifies text properties for the specified text ranges.

Declaration

public void modifyTextProperties(List<TextRange> ranges, TextProperties properties)

Parameters

Name Type Description
ranges java.util.List<TextRange>

Text ranges.

properties TextProperties

Text properties to apply.

modifyTextProperties(TextRange range, TextProperties properties) Method

Creates a text run that matches to the specified text range and applies specified text properties to it. Properties to apply should not be null.

Declaration

public void modifyTextProperties(TextRange range, TextProperties properties)

Parameters

Name Type Description
range TextRange

The text range to which the properties are applied.

properties TextProperties

The text properties to apply.

removeText(List<TextRange> ranges) Method

Removes text from specified text ranges.

Declaration

public void removeText(List<TextRange> ranges)

Parameters

Name Type Description
ranges java.util.List<TextRange>

Text ranges to remove.

removeText(TextRange range) Method

Removes the specified text ranges from the text area.

Declaration

public void removeText(TextRange range)

Parameters

Name Type Description
range TextRange

The text range to remove.

replaceText(List<TextRange> ranges, String newText) Method

Replaces text in the specified text ranges.

Declaration

public void replaceText(List<TextRange> ranges, String newText)

Parameters

Name Type Description
ranges java.util.List<TextRange>

Text ranges to replace.

newText String

The replacement text.

replaceText(String oldText, String newText, TextSearchOptions options) Method

Replaces matching text in the text area.

Declaration

public void replaceText(String oldText, String newText, TextSearchOptions options)

Parameters

Name Type Description
oldText String

The text to find.

newText String

The replacement text.

options TextSearchOptions

Search options used to find matching text.

replaceText(String oldText, String newText) Method

Replaces the specified text ranges with new text.

Declaration

public void replaceText(String oldText, String newText)

Parameters

Name Type Description
oldText String

Text to be replaced.

newText String

The new text to replace the old text.

replaceText(TextRange range, String newText) Method

Replaces text in the specified text range.

Declaration

public void replaceText(TextRange range, String newText)

Parameters

Name Type Description
range TextRange

The text range to replace.

newText String

The replacement text.

setLevel1ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 1 paragraphs in the text area.

Declaration

public void setLevel1ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

Note

Different presentation viewers may prioritize paragraph-level and level-specific settings differently. In some instances, top-level paragraphs may use either getParagraphProperties() or getLevel1ParagraphProperties() settings.

setLevel2ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 2 paragraphs in the text area.

Declaration

public void setLevel2ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel3ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 3 paragraphs in the text area.

Declaration

public void setLevel3ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel4ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 4 paragraphs in the text area.

Declaration

public void setLevel4ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel5ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 5 paragraphs in the text area.

Declaration

public void setLevel5ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel6ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 6 paragraphs in the text area.

Declaration

public void setLevel6ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel7ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 7 paragraphs in the text area.

Declaration

public void setLevel7ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel8ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 8 paragraphs in the text area.

Declaration

public void setLevel8ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setLevel9ParagraphProperties(TextParagraphProperties value) Method

Sets the paragraph properties for level 9 paragraphs in the text area.

Declaration

public void setLevel9ParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Call the setListIndentLevel(@Nullable Integer value) method to specify the indent level of a paragraph.

setParagraphProperties(TextParagraphProperties value) Method

Sets paragraph properties for paragraphs in the text area.

Declaration

public void setParagraphProperties(TextParagraphProperties value)

Parameters

Name Type Description
value TextParagraphProperties

Paragraph properties.

Remarks

Note

Different presentation viewers may prioritize paragraph-level and level-specific settings differently. In some instances, top-level paragraphs may use either getParagraphProperties() or getLevel1ParagraphProperties() settings.

setText(String value) Method

Sets the text of a text run string.

Declaration

public void setText(String value)

Parameters

Name Type Description
value String

The text of the text run string.