API Reference
RtfLosslessEditor
Applies targeted edits to an RTF syntax tree while preserving untouched raw RTF.
Inheritance
- Object
- RtfLosslessEditor
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method RtfReadResult.EditLossless
- Method RtfSyntaxTree.EditLossless
Constructors
public RtfLosslessEditor(RtfReadResult readResult) #Creates a lossless editor from a read result.
Parameters
- readResult OfficeIMO.Rtf.RtfReadResult
public RtfLosslessEditor(RtfSyntaxTree syntaxTree) #Creates a lossless editor from an RTF syntax tree.
Parameters
- syntaxTree OfficeIMO.Rtf.Syntax.RtfSyntaxTree
Methods
public Void AddRevisionSaveId(Int32 id) #VoidAdds a revision save id to the root rsidtbl destination, replacing duplicate entries with a single occurrence.
Parameters
- id System.Int32
public Void AppendParagraph(String text) #VoidAppends a plain RTF paragraph at the end of the root document group while preserving existing syntax.
Parameters
- text System.String
public Void InsertRootParagraph(Int32 index, String text) #VoidInserts a plain paragraph at a direct root-node index.
Parameters
- index System.Int32
- text System.String
public Void InsertRootRtf(Int32 index, String rtfFragment) #VoidInserts a validated raw RTF fragment at a direct root-node index.
Parameters
- index System.Int32
- rtfFragment System.String
public Void MoveRootNodes(Int32 fromIndex, Int32 count, Int32 toIndex) #VoidMoves direct root syntax nodes to their final root-node index.
Parameters
- fromIndex System.Int32
- count System.Int32
- toIndex System.Int32
public Void RemoveColor(Int32 index) #VoidRemoves the one-based color-table entry when it exists while preserving the rest of the RTF stream.
Parameters
- index System.Int32
public Void RemoveFileReference(Int32 id) #VoidRemoves all file-table references with the supplied identifier while preserving the rest of the RTF stream.
Parameters
- id System.Int32
public Void RemoveFont(Int32 id) #VoidRemoves all font-table entries with the supplied RTF font identifier while preserving the rest of the RTF stream.
Parameters
- id System.Int32
public Void RemovePageBorder(RtfPageBorderSide side) #VoidRemoves one root page-border side while preserving untouched RTF syntax.
Parameters
- side OfficeIMO.Rtf.RtfPageBorderSide
public Void RemoveRevisionAuthor(Int32 index) #VoidRemoves the zero-based revision author table entry when it exists while preserving the rest of the RTF stream.
Parameters
- index System.Int32
public Void RemoveRevisionSaveId(Int32 id) #VoidRemoves all matching revision save ids from the root rsidtbl destination while preserving the rest of the RTF stream.
Parameters
- id System.Int32
public Int32 RemoveRootNodes(Int32 index, Int32 count = 1) #Int32Removes direct root syntax nodes and returns the number removed.
Parameters
- index System.Int32
- count System.Int32 = 1
public Void RemoveStyle(Int32 id, RtfStyleKind kind = Paragraph) #VoidRemoves all stylesheet entries matching the supplied id and kind while preserving the rest of the RTF stream.
Parameters
- id System.Int32
- kind OfficeIMO.Rtf.RtfStyleKind = Paragraph
public Void RemoveUserProperty(String name) #VoidRemoves all custom document properties with the supplied name while preserving the rest of the RTF stream.
Parameters
- name System.String
public Void RemoveXmlNamespace(Int32 id) #VoidRemoves all XML namespace declarations with the supplied id while preserving the rest of the RTF stream.
Parameters
- id System.Int32
public Int32 ReplaceDestinationContent(String destination, String rtfFragment) #Int32Replaces the content of every matching destination group, including headers and footers.
Parameters
- destination System.String
- rtfFragment System.String
public Boolean ReplaceImage(Int32 imageIndex, RtfImage replacement) #BooleanReplaces the nth picture destination while preserving all unrelated syntax.
Parameters
- imageIndex System.Int32
- replacement OfficeIMO.Rtf.RtfImage
public Int32 ReplaceText(String oldText, String newText, StringComparison comparison = Ordinal) #Int32Replaces literal visible text contained inside individual text nodes.
Parameters
- oldText System.String
- newText System.String
- comparison System.StringComparison = Ordinal
public Void SaveLossless(String path) #VoidSaves the edited syntax tree to a file without semantic normalization.
Parameters
- path System.String
public Void SaveLossless(Stream stream) #VoidSaves the edited syntax tree to a stream without semantic normalization.
Parameters
- stream System.IO.Stream
public Task SaveLosslessAsync(String path, CancellationToken cancellationToken = default) #TaskSaves the edited syntax tree to a file without semantic normalization.
Parameters
- path System.String
- cancellationToken System.Threading.CancellationToken = default
public Task SaveLosslessAsync(Stream stream, CancellationToken cancellationToken = default) #TaskSaves the edited syntax tree to a stream without semantic normalization.
Parameters
- stream System.IO.Stream
- cancellationToken System.Threading.CancellationToken = default
public Void SetAnsiCodePage(Nullable<Int32> codePage) #VoidAdds, replaces, or removes the root ANSI code page control while preserving the rest of the RTF stream.
Parameters
- codePage System.Nullable{System.Int32}
public Void SetCharacterSet(RtfDocumentCharacterSet characterSet, Nullable<Int32> ansiCodePage = null) #VoidSets the root document character set declaration and optionally replaces the root ANSI code page.
Parameters
- characterSet OfficeIMO.Rtf.RtfDocumentCharacterSet
- ansiCodePage System.Nullable{System.Int32} = null
public Void SetColor(Int32 index, RtfColor color) #VoidAdds or replaces a one-based color-table entry while preserving the rest of the RTF stream.
Parameters
- index System.Int32
- color OfficeIMO.Rtf.RtfColor
public Void SetColor(Int32 index, Byte red, Byte green, Byte blue) #VoidAdds or replaces a one-based RGB color-table entry while preserving the rest of the RTF stream.
Parameters
- index System.Int32
- red System.Byte
- green System.Byte
- blue System.Byte
public Void SetDefaultFont(Nullable<Int32> fontId) #VoidAdds, replaces, or removes the root default font id control while preserving the rest of the RTF stream.
Parameters
- fontId System.Nullable{System.Int32}
public Void SetDefaultLanguages(Nullable<Int32> defaultLanguageId = null, Nullable<Int32> defaultFarEastLanguageId = null, Nullable<Int32> defaultAlternateLanguageId = null) #VoidAdds, replaces, or removes root default language controls while preserving untouched RTF syntax.
Parameters
- defaultLanguageId System.Nullable{System.Int32} = null
- defaultFarEastLanguageId System.Nullable{System.Int32} = null
- defaultAlternateLanguageId System.Nullable{System.Int32} = null
public Void SetDefaultTabWidth(Nullable<Int32> twips) #VoidAdds, replaces, or removes the root default tab width while preserving untouched RTF syntax.
Parameters
- twips System.Nullable{System.Int32}
public Void SetDocumentDirection(Nullable<RtfTextDirection> direction) #VoidAdds, replaces, or removes the root document direction control while preserving untouched RTF syntax.
Parameters
- direction System.Nullable{OfficeIMO.Rtf.RtfTextDirection}
public Void SetDocumentHyphenation(Nullable<Boolean> automatic = null, Nullable<Boolean> caps = null, Nullable<Int32> consecutiveLimit = null, Nullable<Int32> zoneTwips = null) #VoidAdds, replaces, or removes root document hyphenation controls while preserving untouched RTF syntax.
Parameters
- automatic System.Nullable{System.Boolean} = null
- caps System.Nullable{System.Boolean} = null
- consecutiveLimit System.Nullable{System.Int32} = null
- zoneTwips System.Nullable{System.Int32} = null
public Void SetDocumentLayoutOptions(Nullable<Boolean> widowOrphanControl = null, Nullable<Boolean> facingPages = null, Nullable<Boolean> mirrorMargins = null) #VoidAdds, replaces, or removes root document layout option controls while preserving untouched RTF syntax.
Parameters
- widowOrphanControl System.Nullable{System.Boolean} = null
- facingPages System.Nullable{System.Boolean} = null
- mirrorMargins System.Nullable{System.Boolean} = null
public Void SetDocumentProtection(Nullable<Boolean> forms = null, Nullable<Boolean> revisions = null, Nullable<Boolean> annotations = null, Nullable<Boolean> readOnly = null) #VoidAdds, replaces, or removes root document protection controls while preserving untouched RTF syntax.
Parameters
- forms System.Nullable{System.Boolean} = null
- revisions System.Nullable{System.Boolean} = null
- annotations System.Nullable{System.Boolean} = null
- readOnly System.Nullable{System.Boolean} = null
public Void SetDocumentVariable(String name, String value) #VoidAdds, replaces, or removes a root document variable while preserving the rest of the RTF stream. Pass null for value to remove all variables with the supplied name.
Parameters
- name System.String
- value System.String
public Void SetDocumentView(Nullable<Int32> kind = null, Nullable<Int32> scale = null, Nullable<Int32> zoomKind = null, Nullable<Int32> backspaceBehavior = null) #VoidAdds, replaces, or removes root document view controls while preserving untouched RTF syntax.
Parameters
- kind System.Nullable{System.Int32} = null
- scale System.Nullable{System.Int32} = null
- zoomKind System.Nullable{System.Int32} = null
- backspaceBehavior System.Nullable{System.Int32} = null
public Void SetDrawingGrid(Nullable<Int32> horizontalSpacingTwips = null, Nullable<Int32> verticalSpacingTwips = null, Nullable<Int32> horizontalOriginTwips = null, Nullable<Int32> verticalOriginTwips = null, Nullable<Int32> horizontalShow = null, Nullable<Int32> verticalShow = null, Nullable<Boolean> snapToGrid = null, Nullable<Boolean> useMargins = null) #VoidAdds, replaces, or removes root drawing grid controls while preserving untouched RTF syntax.
Parameters
- horizontalSpacingTwips System.Nullable{System.Int32} = null
- verticalSpacingTwips System.Nullable{System.Int32} = null
- horizontalOriginTwips System.Nullable{System.Int32} = null
- verticalOriginTwips System.Nullable{System.Int32} = null
- horizontalShow System.Nullable{System.Int32} = null
- verticalShow System.Nullable{System.Int32} = null
- snapToGrid System.Nullable{System.Boolean} = null
- useMargins System.Nullable{System.Boolean} = null
public Void SetFileReference(RtfFileReference fileReference) #VoidAdds or replaces a file-table reference in the root filetbl destination while preserving the rest of the RTF stream.
Parameters
- fileReference OfficeIMO.Rtf.RtfFileReference
public Void SetFileReference(Int32 id, String path) #VoidAdds or replaces a file-table reference with the supplied identifier and path.
Parameters
- id System.Int32
- path System.String
public Void SetFont(RtfFont font) #VoidAdds or replaces a font-table entry by its RTF font identifier while preserving the rest of the RTF stream.
Parameters
- font OfficeIMO.Rtf.RtfFont
public Void SetFont(Int32 id, String name) #VoidAdds or replaces a font-table entry by its RTF font identifier and display name.
Parameters
- id System.Int32
- name System.String
public Void SetGenerator(String value) #VoidAdds, replaces, or removes the root generator metadata group while preserving the rest of the RTF stream.
Parameters
- value System.String
public Void SetGutterWidth(Nullable<Int32> gutterWidthTwips) #VoidAdds, replaces, or removes the root document gutter width while preserving untouched RTF syntax.
Parameters
- gutterWidthTwips System.Nullable{System.Int32}
public Void SetInfo(RtfDocumentInfoField field, String value) #VoidAdds, replaces, or removes a document information field while preserving the rest of the RTF stream.
Parameters
- field OfficeIMO.Rtf.RtfDocumentInfoField
- value System.String
public Void SetInfoNumber(RtfDocumentInfoNumberField field, Nullable<Int32> value) #VoidAdds, replaces, or removes a numeric document information field while preserving the rest of the RTF stream.
Parameters
- field OfficeIMO.Rtf.RtfDocumentInfoNumberField
- value System.Nullable{System.Int32}
public Void SetInfoTimestamp(RtfDocumentInfoTimestampField field, Nullable<DateTime> value) #VoidAdds, replaces, or removes a document information timestamp while preserving the rest of the RTF stream.
Parameters
- field OfficeIMO.Rtf.RtfDocumentInfoTimestampField
- value System.Nullable{System.DateTime}
public Void SetLandscape(Boolean enabled = true) #VoidAdds or removes the root landscape orientation control while preserving untouched RTF syntax.
Parameters
- enabled System.Boolean = true
public Void SetMargins(Nullable<Int32> leftTwips = null, Nullable<Int32> rightTwips = null, Nullable<Int32> topTwips = null, Nullable<Int32> bottomTwips = null) #VoidAdds, replaces, or removes root document margin controls while preserving untouched RTF syntax.
Parameters
- leftTwips System.Nullable{System.Int32} = null
- rightTwips System.Nullable{System.Int32} = null
- topTwips System.Nullable{System.Int32} = null
- bottomTwips System.Nullable{System.Int32} = null
public Void SetPageBorder(RtfPageBorderSide side, RtfPageBorderStyle style, Nullable<Int32> width = null, Nullable<Int32> space = null, Nullable<Int32> colorIndex = null, Boolean frame = false) #VoidAdds, replaces, or removes one root page-border side while preserving untouched RTF syntax.
Parameters
- side OfficeIMO.Rtf.RtfPageBorderSide
- style OfficeIMO.Rtf.RtfPageBorderStyle
- width System.Nullable{System.Int32} = null
- space System.Nullable{System.Int32} = null
- colorIndex System.Nullable{System.Int32} = null
- frame System.Boolean = false
public Void SetPageBorderOptions(Nullable<Boolean> includeHeader = null, Nullable<Boolean> includeFooter = null, Nullable<Boolean> snapToPageBorder = null, Nullable<RtfPageBorderScope> scope = null, Nullable<Boolean> displayBehindText = null, Nullable<RtfPageBorderOffset> offsetFrom = null) #VoidAdds, replaces, or removes root page-border option controls while preserving untouched RTF syntax.
Parameters
- includeHeader System.Nullable{System.Boolean} = null
- includeFooter System.Nullable{System.Boolean} = null
- snapToPageBorder System.Nullable{System.Boolean} = null
- scope System.Nullable{OfficeIMO.Rtf.RtfPageBorderScope} = null
- displayBehindText System.Nullable{System.Boolean} = null
- offsetFrom System.Nullable{OfficeIMO.Rtf.RtfPageBorderOffset} = null
public Void SetPageNumbering(Nullable<Int32> start = null, Nullable<Boolean> restart = null, Nullable<RtfPageNumberFormat> format = null, Nullable<Int32> positionXTwips = null, Nullable<Int32> positionYTwips = null) #VoidAdds, replaces, or removes root page-numbering controls while preserving untouched RTF syntax.
Parameters
- start System.Nullable{System.Int32} = null
- restart System.Nullable{System.Boolean} = null
- format System.Nullable{OfficeIMO.Rtf.RtfPageNumberFormat} = null
- positionXTwips System.Nullable{System.Int32} = null
- positionYTwips System.Nullable{System.Int32} = null
public Void SetPageSize(Nullable<Int32> widthTwips, Nullable<Int32> heightTwips) #VoidAdds, replaces, or removes root document paper size controls while preserving untouched RTF syntax.
Parameters
- widthTwips System.Nullable{System.Int32}
- heightTwips System.Nullable{System.Int32}
public Void SetPrinterPaper(Nullable<Int32> paperSize = null, Nullable<Int32> firstPageSource = null, Nullable<Int32> otherPagesSource = null) #VoidAdds, replaces, or removes root printer paper metadata controls while preserving untouched RTF syntax.
Parameters
- paperSize System.Nullable{System.Int32} = null
- firstPageSource System.Nullable{System.Int32} = null
- otherPagesSource System.Nullable{System.Int32} = null
public Void SetRevisionAuthor(Int32 index, String name) #VoidAdds or replaces a zero-based revision author table entry while preserving the rest of the RTF stream.
Parameters
- index System.Int32
- name System.String
public Void SetRevisionRootSaveId(Nullable<Int32> id) #VoidAdds, replaces, or removes the root revision save id in the root rsidtbl destination while preserving the rest of the RTF stream.
Parameters
- id System.Nullable{System.Int32}
public Void SetRevisionTracking(Nullable<Boolean> enabled = null, Nullable<Int32> displayStyle = null, Nullable<Int32> barPlacement = null) #VoidAdds, replaces, or removes root revision tracking controls while preserving untouched RTF syntax.
Parameters
- enabled System.Nullable{System.Boolean} = null
- displayStyle System.Nullable{System.Int32} = null
- barPlacement System.Nullable{System.Int32} = null
public Void SetRtlGutter(Boolean enabled = true) #VoidAdds or removes the root right-to-left gutter control while preserving untouched RTF syntax.
Parameters
- enabled System.Boolean = true
public Void SetStyleName(Int32 id, String name, RtfStyleKind kind = Paragraph) #VoidAdds a basic stylesheet entry or renames an existing entry while preserving the existing style formatting controls.
Parameters
- id System.Int32
- name System.String
- kind OfficeIMO.Rtf.RtfStyleKind = Paragraph
public Void SetUnicodeSkipCount(Nullable<Int32> count) #VoidAdds, replaces, or removes the root Unicode fallback skip count while preserving the rest of the RTF stream.
Parameters
- count System.Nullable{System.Int32}
public Void SetUserProperty(RtfUserProperty property) #VoidAdds or replaces a custom document property in the root userprops destination while preserving the rest of the RTF stream.
Parameters
- property OfficeIMO.Rtf.RtfUserProperty
public Void SetUserProperty(String name, String value) #VoidAdds or replaces a text custom document property in the root userprops destination.
Parameters
- name System.String
- value System.String
public Void SetXmlNamespace(Int32 id, String uri) #VoidAdds, replaces, or removes an XML namespace declaration in the root xmlnstbl destination while preserving the rest of the RTF stream.
Parameters
- id System.Int32
- uri System.String
public Byte[] ToBytesLossless() #Byte[]Serializes the edited syntax tree to source-preserving bytes without semantic normalization.
public RtfReadResult ToReadResult(RtfReadOptions options = null) #RtfReadResultReads the edited syntax tree into a fresh semantic model.
Parameters
- options OfficeIMO.Rtf.RtfReadOptions = null
public String ToRtf() #StringSerializes the edited syntax tree without semantic normalization.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object