Class FindReplaceOptions

Class FindReplaceOptions

Namespace: Aspose.Words.Replacing
Assembly: Aspose.Words.dll (25.3.0)

Specifies options for find/replace operations.

To learn more, visit the Find and Replace documentation article.

public class FindReplaceOptions

Inheritance

objectFindReplaceOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

FindReplaceOptions()

Initializes a new instance of the FindReplaceOptions class with default settings.

public FindReplaceOptions()

FindReplaceOptions(FindReplaceDirection)

Initializes a new instance of the FindReplaceOptions class with the specified direction.

public FindReplaceOptions(FindReplaceDirection direction)

Parameters

direction FindReplaceDirection

The direction of the find and replace operation.

FindReplaceOptions(IReplacingCallback)

Initializes a new instance of the FindReplaceOptions class with the specified replacing callback.

public FindReplaceOptions(IReplacingCallback replacingCallback)

Parameters

replacingCallback IReplacingCallback

The callback to use for replacing found text.

FindReplaceOptions(FindReplaceDirection, IReplacingCallback)

Initializes a new instance of the FindReplaceOptions class with the specified direction and replacing callback.

public FindReplaceOptions(FindReplaceDirection direction, IReplacingCallback replacingCallback)

Parameters

direction FindReplaceDirection

The direction of the find and replace operation.

replacingCallback IReplacingCallback

The callback to use for replacing found text.

Properties

ApplyFont

Text formatting applied to new content.

public Font ApplyFont { get; }

Property Value

Font

ApplyParagraphFormat

Paragraph formatting applied to new content.

public ParagraphFormat ApplyParagraphFormat { get; }

Property Value

ParagraphFormat

Direction

Selects direction for replace. Default value is Aspose.Words.Replacing.FindReplaceDirection.Forward.

public FindReplaceDirection Direction { get; set; }

Property Value

FindReplaceDirection

FindWholeWordsOnly

True indicates the oldValue must be a standalone word.

public bool FindWholeWordsOnly { get; set; }

Property Value

bool

IgnoreDeleted

Gets or sets a boolean value indicating either to ignore text inside delete revisions. The default value is false.

public bool IgnoreDeleted { get; set; }

Property Value

bool

IgnoreFieldCodes

Gets or sets a boolean value indicating either to ignore text inside field codes. The default value is false.

public bool IgnoreFieldCodes { get; set; }

Property Value

bool

Remarks

This option affects only field codes (it does not ignore nodes between Aspose.Words.NodeType.FieldSeparator and Aspose.Words.NodeType.FieldEnd).

To ignore whole field, please use corresponding option Aspose.Words.Replacing.FindReplaceOptions.IgnoreFields.

IgnoreFields

Gets or sets a boolean value indicating either to ignore text inside fields. The default value is false.

public bool IgnoreFields { get; set; }

Property Value

bool

Remarks

This option affects whole field (all nodes between Aspose.Words.NodeType.FieldStart and Aspose.Words.NodeType.FieldEnd).

To ignore only field codes, please use corresponding option Aspose.Words.Replacing.FindReplaceOptions.IgnoreFieldCodes.

IgnoreFootnotes

Gets or sets a boolean value indicating either to ignore footnotes. The default value is false.

public bool IgnoreFootnotes { get; set; }

Property Value

bool

IgnoreInserted

Gets or sets a boolean value indicating either to ignore text inside insert revisions. The default value is false.

public bool IgnoreInserted { get; set; }

Property Value

bool

IgnoreShapes

Gets or sets a boolean value indicating either to ignore shapes within a text.

The default value is false.

public bool IgnoreShapes { get; set; }

Property Value

bool

IgnoreStructuredDocumentTags

Gets or sets a boolean value indicating either to ignore content of Aspose.Words.Markup.StructuredDocumentTag. The default value is false.

public bool IgnoreStructuredDocumentTags { get; set; }

Property Value

bool

Remarks

When this option is set to true, the content of Aspose.Words.Markup.StructuredDocumentTag will be treated as a simple text.

Otherwise, Aspose.Words.Markup.StructuredDocumentTag will be processed as standalone Story and replacing pattern will be searched separately for each Aspose.Words.Markup.StructuredDocumentTag, so that if pattern crosses a Aspose.Words.Markup.StructuredDocumentTag, then replacement will not be performed for such pattern.

LegacyMode

Gets or sets a boolean value indicating that old find/replace algorithm is used.

public bool LegacyMode { get; set; }

Property Value

bool

Remarks

Use this flag if you need exactly the same behavior as before advanced find/replace feature was introduced. Note that old algorithm does not support advanced features such as replace with breaks, apply formatting and so on.

MatchCase

True indicates case-sensitive comparison, false indicates case-insensitive comparison.

public bool MatchCase { get; set; }

Property Value

bool

ReplacementFormat

Specifies format of the replacement. Default is Aspose.Words.Replacing.ReplacementFormat.Text.

public ReplacementFormat ReplacementFormat { get; set; }

Property Value

ReplacementFormat

Remarks

Has effect only when using in Aspose.Words.LowCode.Replacer

ReplacingCallback

The user-defined method which is called before every replace occurrence.

public IReplacingCallback ReplacingCallback { get; set; }

Property Value

IReplacingCallback

SmartParagraphBreakReplacement

Gets or sets a boolean value indicating either it is allowed to replace paragraph break when there is no next sibling paragraph.

The default value is false.

public bool SmartParagraphBreakReplacement { get; set; }

Property Value

bool

Remarks

This option allows to replace paragraph break when there is no next sibling paragraph to which all child nodes can be moved, by finding any (not necessarily sibling) next paragraph after the paragraph being replaced.

UseLegacyOrder

True indicates that a text search is performed sequentially from top to bottom considering the text boxes. Default value is false.

public bool UseLegacyOrder { get; set; }

Property Value

bool

UseSubstitutions

Gets or sets a boolean value indicating whether to recognize and use substitutions within replacement patterns. The default value is false.

public bool UseSubstitutions { get; set; }

Property Value

bool

Remarks

For the details on substitution elements please refer to: https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-regular-expressions.

 English