RadDocument
Represents the document object in RadRichTextBox.
Definition
Namespace:Telerik.WinForms.Documents.Model
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public class RadDocument : DocumentElement, IDisposable, ICustomTypeDescriptor, ISupportInitialize, INotifyPropertyChanged
Inheritance: objectDisposableObjectRadObjectDocumentElementRadDocument
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadDocument class.
public RadDocument()
Fields
The default tab width style property.
public static readonly StylePropertyDefinition<double?, DocumentProperties> DefaultTabWidthProperty
The endnotes first number style property.
public static readonly StylePropertyDefinition<int?, DocumentProperties> EndnotesFirstNumberProperty
The endnotes numbering format style property.
public static readonly StylePropertyDefinition<ListNumberingFormat?, DocumentProperties> EndnotesNumberingFormatProperty
The endnotes numbering restart type style property.
public static readonly StylePropertyDefinition<NumberingRestartType?, DocumentProperties> EndnotesNumberingRestartTypeProperty
The endnotes position style property.
public static readonly StylePropertyDefinition<EndnotesPosition?, DocumentProperties> EndnotesPositionProperty
The footnotes first number style property.
public static readonly StylePropertyDefinition<int?, DocumentProperties> FootnotesFirstNumberProperty
The footnotes numbering format style property.
public static readonly StylePropertyDefinition<ListNumberingFormat?, DocumentProperties> FootnotesNumberingFormatProperty
The footnotes numbering restart type style property.
public static readonly StylePropertyDefinition<NumberingRestartType?, DocumentProperties> FootnotesNumberingRestartTypeProperty
The footnotes position style property.
public static readonly StylePropertyDefinition<FootnotesPosition?, DocumentProperties> FootnotesPositionProperty
Represent the maximum document size.
public static readonly SizeF MAX_DOCUMENT_SIZE
The section default page margin style property.
public static readonly StylePropertyDefinition<Padding?, DocumentProperties> SectionDefaultPageMarginProperty
The section default page orientation style property.
public static readonly StylePropertyDefinition<PageOrientation?, DocumentProperties> SectionDefaultPageOrientationProperty
The section default page size style property.
public static readonly StylePropertyDefinition<Size?, DocumentProperties> SectionDefaultPageSizeProperty
Properties
Gets or sets a collection of BibliographicSource objects.
[XamlCompositePropertySerializable]
public NotifiableCollection<BibliographicSource> BibliographicSources { get; set; }
BibliographicStyles
Dictionary<string, BibliographicReferenceStyleBase>
Gets or sets a dictionary keeping the styles used for the bibliographic references inside the document.
public Dictionary<string, BibliographicReferenceStyleBase> BibliographicStyles { get; set; }
CaptionDefinitions
Dictionary<string, CaptionDefinition>
Gets the caption definitions inside the document.
public Dictionary<string, CaptionDefinition> CaptionDefinitions { get; }
The caption definitions.
Gets a DocumentPosition representing the current caret position.
public DocumentPosition CaretPosition { get; }
The current position of the caret.
Gets or sets the formatter used for code blocks.
public CodeFormatter CodeFormatter { get; set; }
The code formatter.
Gets or sets the default tab width.
[XamlSerializable]
public double DefaultTabWidth { get; set; }
Gets a value representing the desired layout size of the document.
Gets or sets a value determining how often to fire the DocumentContentChanged event.
public TimeSpan DocumentContentChangedInterval { get; set; }
Gets a value representing the layout box of the document.
Gets the document variables.
public DocumentVariableCollection DocumentVariables { get; }
The document variables.
Gets or sets the endnotes starting number.
[XamlSerializable(1)]
public int EndnotesFirstNumber { get; set; }
Gets or sets the endnotes numbering format.
[XamlSerializable(ListNumberingFormat.LowerRoman)]
public ListNumberingFormat EndnotesNumberingFormat { get; set; }
Gets or sets the type of the endnotes numbering restart.
[XamlSerializable(NumberingRestartType.Continuous)]
public NumberingRestartType EndnotesNumberingRestartType { get; set; }
Gets or sets the endnotes position.
[XamlSerializable(EndnotesPosition.DocumentEnd)]
public EndnotesPosition EndnotesPosition { get; set; }
Gets or sets the display mode for the fields in this document.
public FieldDisplayMode FieldsDisplayMode { get; set; }
The fields display mode.
Gets or sets the footnotes starting number.
[XamlSerializable(1)]
public int FootnotesFirstNumber { get; set; }
Gets or sets the footnotes numbering format.
[XamlSerializable(ListNumberingFormat.Decimal)]
public ListNumberingFormat FootnotesNumberingFormat { get; set; }
Gets or sets the type of the footnotes numbering restart.
[XamlSerializable(NumberingRestartType.Continuous)]
public NumberingRestartType FootnotesNumberingRestartType { get; set; }
Gets or sets the footnotes position.
[XamlSerializable(FootnotesPosition.PageBottom)]
public FootnotesPosition FootnotesPosition { get; set; }
Gets or sets a value indicating whether headers and footers are different in even and odd pages.
[XamlSerializable(false)]
public bool HasDifferentEvenAndOddHeadersFooters { get; set; }
true if headers and footers are different in even and odd pages; otherwise, false.
Gets the history of changes in this document.
public DocumentHistory History { get; }
Gets a value indicating whether the document is empty.
public bool IsEmpty { get; }
true if the document is empty; otherwise, false.
Gets or sets a value indicating whether the strict line breaking rule will be applied to Japanese text in this document.
[XamlSerializable(false)]
public bool IsStrictLineBreakingRuleEnabled { get; set; }
Gets or sets a value indicating whether this instance has track changes enabled.
[XamlSerializable(false)]
public bool IsTrackChangesEnabled { get; set; }
true if this instance is track changes enabled; otherwise, false.
Gets or sets a value representing the current layout mode.
[XamlSerializable]
public DocumentLayoutMode LayoutMode { get; set; }
The layout mode.
Gets or sets the language which rules should be used for line breaking in the paragraphs.
public LineBreakingRuleLanguage LineBreakingRuleLanguage { get; set; }
The line breaking rule language.
Gets or set the line spacing of this document.
[XamlSerializable]
public double LineSpacing { get; set; }
Gets or set the line spacing type of this document.
[XamlSerializable]
public LineSpacingType LineSpacingType { get; set; }
Gets the list manager.
public ListManager ListManager { get; }
The ListManager instance responsible for this document.
Gets the data source used for mail merge operations with this document.
public MailMergeDataSource MailMergeDataSource { get; }
The mail merge data source.
Gets or sets a rule determining which characters cannot end a line in East-Asian languages.
[XamlCompositePropertySerializable]
public LineBreakingRule NoLineBreaksAfterRule { get; set; }
Gets or sets a rule determining which characters cannot start a line in East-Asian languages.
[XamlCompositePropertySerializable]
public LineBreakingRule NoLineBreaksBeforeRule { get; set; }
Gets or sets the default spacing after a paragraph.
[XamlSerializable]
public double ParagraphDefaultSpacingAfter { get; set; }
Gets or sets the default spacing before a paragraph.
[XamlSerializable]
public double ParagraphDefaultSpacingBefore { get; set; }
Gets or sets the protection settings.
[XamlCompositePropertySerializable]
public DocumentProtectionSettings ProtectionSettings { get; set; }
The protection settings.
Gets or sets the default section page margin.
[XamlSerializable]
public Padding SectionDefaultPageMargin { get; set; }
Gets or sets the default section page orientation
[XamlSerializable]
public PageOrientation SectionDefaultPageOrientation { get; set; }
Gets or sets the default section page size.
[XamlSerializable]
public Size SectionDefaultPageSize { get; set; }
Gets a collection with the sections of the document.
public SectionCollection Sections { get; }
A SectionCollection representing the sections of the document.
Gets or sets the selected bibliographic style.
public BibliographicReferenceStyleBase SelectedBibliographicStyle { get; set; }
The selected bibliographic style.
Gets a DocumentSelection representing the document selection.
public DocumentSelection Selection { get; }
The document selection.
Gets or sets a value indicating whether to show bookmarks.
public bool ShowBookmarks { get; set; }
true if the bookmarks should be visualized; otherwise, false.
Gets or sets a value indicating whether to show formatting symbols.
public bool ShowFormattingSymbols { get; set; }
true if the formatting symbols should be visualized; otherwise, false.
Gets or sets a value indicating whether the merge fields in the document should have a highlight.
public bool ShowMergeFieldsHighlight { get; set; }
true if the merge fields should be highlighted; otherwise, false.
Gets or sets a value indicating whether the read only ranges in the document should have a highlight.
public bool ShowReadOnlyRangesHighlight { get; set; }
true if the read only ranges should be highlighted; otherwise, false.
Gets a value indicating whether a structure change is in progress.
public bool StructureChangeInProgress { get; }
true if the the structure of the document is currently being changed; otherwise, false.
Gets the collection of styles inside the document.
public StyleCollection StyleRepository { get; }
The style repository.
Methods
Arranges the document.
public void Arrange(RectangleF arrangeRect)
The rectangle to arrange in.
Marks the start of styles editing and temporarily suspends the updates of the styles.
public void BeginStylesUpdate()
Calls the DocumentContentChanged event.
protected void CallOnDocumentContentChanged()
Determines whether the document contains annotation markers of type T.
Copies the properties from another RadDocument to the current instance.
protected override void CopyPropertiesFromOverride(DocumentElement element)
The RadDocument to copy the properties from.
Overrides:
Creates a deep copy of the document.
public override DocumentElement CreateDeepCopy()
The copied element.
Overrides:
Creates a DocumentLayoutBox for the element.
public override LayoutBox CreateLayoutBox(DocumentStructureCollection documentCollection)
The document collection.
Returns:Thew new DocumentLayoutBox.
Overrides:
Creates a new RadDocument instance.
protected override DocumentElement CreateNewElementInstance()
The new instance.
Overrides:
Marks the end of styles editing and resumes the updates of the styles.
public void EndStylesUpdate()
Ensures document layout is performed and layout-boxes have been created.
public void EnsureDocumentMeasuredAndArranged()
Call this method if the document is created in code and you need to access document's layout boxes.
Gets all bookmarks in the document.
public IEnumerable<BookmarkRangeStart> GetAllBookmarks()
IEnumerable<BookmarkRangeStart>
A collection of BookmarkRangeStart objects.
Gets all PermissionRangeInfos for this document.
public IEnumerable<PermissionRangeInfo> GetAllPermissionInfos()
IEnumerable<PermissionRangeInfo>
A collecction of PermissionRangeInfo objects.
Gets all revisions.
Gets all annotation markers of type T in the document.
public IEnumerable<T> GetAnnotationMarkersOfType<T>() where T : AnnotationMarkerBase
IEnumerable<T>
Tries to find a Bibliographic Source in the document. Returns null if none is found.
public BibliographicSource GetBibliographicSource(string tagName)
The tag name of the Source to be found.
Returns:Gets a bookmark by its name.
public BookmarkRangeStart GetBookmarkByName(string bookmarkName)
The name of the bookmark.
Returns:The BookmarkRangeStart representing the bookmark.
Gets the CommentRangeStart by comment.
public CommentRangeStart GetCommentRangeStartByComment(Comment comment)
The comment.
Returns:Gets the annotation ranges of type TRangeStart surrounding specific positions.
public IEnumerable<TRangeStart> GetContainingAnnotationRanges<TRangeStart>(HierarchicalIndex start, HierarchicalIndex end) where TRangeStart : AnnotationRangeStart
The start.
endHierarchicalIndexThe end.
Returns:IEnumerable<TRangeStart>
Gets the annotation ranges of type TRangeStart surrounding an inline.
public IEnumerable<TRangeStart> GetContainingAnnotationRanges<TRangeStart>(Inline inline, bool inclusive = false) where TRangeStart : AnnotationRangeStart
The inline.
inclusiveboolSpecifies whether to return the inline itself if it is a TRangeStart.
Returns:IEnumerable<TRangeStart>
Gets the annotation ranges of type TRangeStart surrounding an inline that match a condition.
public IEnumerable<TRangeStart> GetContainingAnnotationRanges<TRangeStart>(Inline inline, Predicate<TRangeStart> filter, bool inclusive = false) where TRangeStart : AnnotationRangeStart
The inline.
filterPredicate<TRangeStart>The filter.
inclusiveboolSpecifies whether to return the inline itself if it is a TRangeStart.
Returns:IEnumerable<TRangeStart>
Gets the permission ranges included in the Selection. If the Selection is empty, the GetPermissions(Inline) method is invoked with the Inline under the CaretPosition.
public IEnumerable<PermissionRangeInfo> GetCurrentPermissions()
IEnumerable<PermissionRangeInfo>
A collection of PermissionRangeInfo objects.
Gets the current revision.
Gets the next comment.
Gets the next revision.
Gets the permission ranges included in a specified Inline.
public IEnumerable<PermissionRangeInfo> GetPermissions(Inline inline)
The inline element from which PermissionRangeInfos should be obtained.
Returns:IEnumerable<PermissionRangeInfo>
A collection of PermissionRangeInfos inside the inline.
Gets the previous comment.
Gets the previous revision.
Gets the statistical information about the document.
Moves the CaretPosition to the beginning of a bookmark.
public void GoToBookmark(BookmarkRangeStart bookmarkStart)
The bookmark start.
Moves the CaretPosition to the beginning of a bookmark.
public void GoToBookmark(string bookmarkName)
The name of the bookmark.
Selects a comment.
Selects a comment.
public void GoToComment(CommentRangeStart commentRangeStart)
The comment range start.
Selects next comment.
Moves current position to the next endnote.
public void GoToNextEndnote()
Moves current position to the next footnote.
public void GoToNextFootnote()
Selects next revision.
Selects previous comment.
Moves current position to the previous endnote.
public void GoToPreviousEndnote()
Moves current position to the previous footnote.
public void GoToPreviousFootnote()
Selects previous revision.
Selects revision.
Determines whether the specified inline is in annotation range of type TRangeStart.
Determines whether the specified inline is in annotation range of type TRangeStart that matches a condition.
public bool IsInAnnotationRange<TRangeStart>(Inline inline, Predicate<TRangeStart> filter, bool inclusive = false) where TRangeStart : AnnotationRangeStart
The inline.
filterPredicate<TRangeStart>The filter.
inclusiveboolSpecifies whether to return the inline itself if it is a TRangeStart.
Returns:Mail merges the document using the MailMergeDataSource.
public RadDocument MailMerge(bool startEachRecordOnNewPage = true)
A boolean value indicating whether the records should start each on a new page.
Returns:A RadDocument instance representing the result of the merge.
Mail merges the document using the current record from the MailMergeDataSource.
public RadDocument MailMergeCurrentRecord()
A RadDocument instance representing the result of the merge.
Measures the document.
Forces document layout update, measuring document in MAX_DOCUMENT_SIZE.
public void MeasureAndArrangeInDefaultSize()
Merges adjacent spans with same style properties into one.
public void MergeSpansWithSameStyles()
This method is automatically called when document is measured during the layout process.
Calling it explicitly is generally not needed and may only be useful in case spans are manually added to Paragraph.Inlines collection.
Called after arranging the document.
protected virtual void OnDocumentArranged()
Called when document content has been changed.
protected virtual void OnDocumentContentChanged()
Called after changing the LayoutMode. Raises LayoutModeChanged event.
protected virtual void OnLayoutModeChanged()
Raises the event.
protected virtual void OnMergeFieldToStringConverting(MergeFieldToStringConvertingEventArgs e)
The MergeFieldToStringConvertingEventArgs instance containing the event data.
Raises the event.
protected virtual void OnPresentationChanged(PresentationChangedEventArgs e)
The PresentationChangedEventArgs instance containing the event data.
Called when changing the document presentation.
protected virtual void OnPresentationChanging()
Called when the protection settings of the document has been changed.
protected virtual void OnProtectionSettingsChanged()
Raises the event.
protected virtual void OnRequestCurrentUserInfo(RequestCurrentUserInfoEventArgs e)
The RequestCurrentUserInfoEventArgs instance containing the event data.
Raises the event.
protected virtual void OnStreamFromUriResolving(StreamFromUriResolvingEventArgs e)
The StreamFromUriResolvingEventArgs instance containing the event data.
Called after the style of a document element has been changed.
protected override void OnStyleChanged()
Overrides:
Raises the event.
protected virtual void OnUserAuthenticationRequest(UserAuthenticationRequestEventArgs e)
The UserAuthenticationRequestEventArgs instance containing the event data.
Protects the document.
public void ProtectDocument(DocumentProtectionMode protectionMode, string password)
The protection mode.
passwordstringThe password.
Exceptions:Cannot protect a document that is already protected.
Removes the protection from the document.
public bool UnprotectDocument(string password)
The password.
Returns: Exceptions:Cannot unprotect a document that is not protected.
Forces the document to update its layout.
public void UpdateLayout()
Updates the styles inside the document.
public void UpdateStyles()
Events
public event EventHandler<DocumentCommandExecutedEventArgs> CommandExecuted
Occurs when the document has been arranged.
public event EventHandler DocumentArranged
Occurs when the document content has changed.
public event EventHandler DocumentContentChanged
Occurs when a document element is added in the whole document tree.
public event EventHandler<DocumentElementAddedEventArgs> DocumentElementAdded
Occurs when a document element is removed from the whole document tree.
public event EventHandler<DocumentElementRemovedEventArgs> DocumentElementRemoved
Occurs when the result of a document variable is being evaluated.
public event EventHandler<DocumentVariableEvaluatingEventArgs> DocumentVariableEvaluating
Occurs when the users clicks on a hyperlink in the current document.
public event EventHandler<HyperlinkClickedEventArgs> HyperlinkClicked
Occurs when the LayoutMode property value has changed.
public event EventHandler LayoutModeChanged
Occurs when merge field is being converted to string.
public event EventHandler<MergeFieldToStringConvertingEventArgs> MergeFieldToStringConverting
Occurs when document presentation is changed.
public event EventHandler<PresentationChangedEventArgs> PresentationChanged
Occurs when the document presenter is changing.
public event EventHandler PresentationChanging
Occurs when the protection settings of the document has been changed.
public event EventHandler ProtectionSettingsChanged
Occurs when an information for the current user is needed.
public event EventHandler<RequestCurrentUserInfoEventArgs> RequestCurrentUserInfo
Occurs when a user should be authenticated.
public event EventHandler<UserAuthenticationRequestEventArgs> UserAuthenticationRequest