XmlTextFormatter Class
Provides a XML
language text formatter service.
public class XmlTextFormatter : ITextFormatter
- Inheritance:
- object object
- Implements:
- ITextFormatter
Constructors
XmlTextFormatter()
Initializes an instance of the class.
public XmlTextFormatter()
Properties
AttributeSpacingMode
Gets or sets the attribute spacing mode.
public XmlAttributeSpacingMode AttributeSpacingMode { get; set; }
Property Value
- XmlAttributeSpacingMode:
The attribute spacing mode. The default value is
Preserve
.
ElementSpacingMode
Gets or sets the element spacing mode.
public XmlElementSpacingMode ElementSpacingMode { get; set; }
Property Value
- XmlElementSpacingMode:
The element spacing mode. The default value is
Preserve
.
TagWrapLength
Gets or sets the tag wrap length.
public int TagWrapLength { get; set; }
Property Value
- int:
The tag wrap length. The default value is
0
, which means tag wrapping is disabled.
Methods
Format(ITextSnapshot, ITextPositionRangeCollection, TextFormatMode)
Applies text formatting to part or all of a snapshot.
public void Format(ITextSnapshot snapshot, ITextPositionRangeCollection selectionPositionRanges, TextFormatMode mode = TextFormatMode.Ranges)
Parameter | Type | Description |
---|---|---|
snapshot | ITextSnapshot | The target ITextSnapshot. |
selectionPositionRanges | ITextPositionRangeCollection | The ITextPositionRangeCollection indicating the selection position ranges. These are used to translate the current selection to the new snapshot that is created, even when formatting the entire snapshot. |
mode | TextFormatMode | A TextFormatMode indicating whether to format part or all of the snapshot. The default value is |
Remarks
The containing ITextDocument is accessible via the ITextSnapshot.