menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class Document - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class Document

    Represents a DLS document.

    Inheritance
    System.Object
    EntityBase
    XDLSSerializableBase
    WidgetBase
    WidgetContainer
    Document
    Implements
    IXDLSSerializable
    IDocument
    IEntityBase
    System.Xml.Serialization.IXmlSerializable
    IWidgetContainer
    IWidget
    Inherited Members
    EntityBase.Document
    EntityBase.DocumentEx
    EntityBase.Owner
    EntityBase.SetOwner(IEntityBase)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    WidgetBase.DrawImpl(CustomGraphics, LayoutedWidget)
    WidgetBase.IWidget.Draw(CustomGraphics, LayoutedWidget)
    WidgetBase.IWidget.LayoutInfo
    WidgetBase.m_layoutInfo
    WidgetContainer.Count
    WidgetContainer.Item[Int32]
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.m_id
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.XDLSHolder
    Namespace: Syncfusion.DLS
    Assembly: Syncfusion.DLS.Base.dll
    Syntax
    public class Document : WidgetContainer, IXDLSSerializable, IDocument, IEntityBase, IXmlSerializable, IWidgetContainer, IWidget

    Constructors

    Document()

    Creates document instance.

    Declaration
    public Document()

    Document(IDocument)

    Make deep copy data from specified document.

    Declaration
    protected Document(IDocument doc)
    Parameters
    Type Name Description
    IDocument doc

    Document(Boolean)

    Initializes a new instance of the Document class.

    Declaration
    public Document(bool ensureMinimal)
    Parameters
    Type Name Description
    System.Boolean ensureMinimal

    if set to true [ensure minimal].

    Fields

    DEF_BULLETS_STYLE

    Declaration
    protected const string DEF_BULLETS_STYLE = "Bulleted"
    Field Value
    Type
    System.String

    DEF_NUMBERING_STYLE

    Declaration
    protected const string DEF_NUMBERING_STYLE = "Numbered"
    Field Value
    Type
    System.String

    m_listStyles

    Collection of list styles

    Declaration
    protected ListStyleCollection m_listStyles
    Field Value
    Type
    ListStyleCollection

    m_sections

    Collection of document sections

    Declaration
    protected ISectionCollection m_sections
    Field Value
    Type
    ISectionCollection

    m_styles

    Collection of document styles

    Declaration
    protected IStyleCollection m_styles
    Field Value
    Type
    IStyleCollection

    Properties

    BackgroundImage

    Gets / sets image that represents background the image of a document.

    Declaration
    public Image BackgroundImage { get; set; }
    Property Value
    Type
    System.Drawing.Image

    Bookmarks

    Gets document bookmarks.

    Declaration
    public BookmarkCollection Bookmarks { get; }
    Property Value
    Type
    BookmarkCollection

    LastParagraph

    Gets last paragraph of last section.

    Declaration
    public IParagraph LastParagraph { get; }
    Property Value
    Type
    IParagraph

    LastSection

    Gets last section of the document.

    Declaration
    public ISection LastSection { get; }
    Property Value
    Type
    ISection

    ListStyles

    Gets document list styles.

    Declaration
    public ListStyleCollection ListStyles { get; }
    Property Value
    Type
    ListStyleCollection

    Sections

    Gets document sections.

    Declaration
    public ISectionCollection Sections { get; }
    Property Value
    Type
    ISectionCollection

    Styles

    Gets document styles.

    Declaration
    public IStyleCollection Styles { get; }
    Property Value
    Type
    IStyleCollection

    TextBoxCollection

    Get/set textbox items of main document

    Declaration
    public TextBoxCollection TextBoxCollection { get; set; }
    Property Value
    Type
    TextBoxCollection

    WidgetCollection

    Gets subwidgets

    Declaration
    protected override ICollectionBase WidgetCollection { get; }
    Property Value
    Type
    ICollectionBase
    Overrides
    WidgetContainer.WidgetCollection

    Methods

    AddListStyle(ListType, String)

    Adds new list style to document.

    Declaration
    public ListStyle AddListStyle(ListType listType, string styleName)
    Parameters
    Type Name Description
    ListType listType

    List type

    System.String styleName

    Paragraph style name

    Returns
    Type
    ListStyle

    AddParagraphStyle(String)

    Adds new paragraph style to the document.

    Declaration
    public IParagraphStyle AddParagraphStyle(string styleName)
    Parameters
    Type Name Description
    System.String styleName

    Paragraph style name

    Returns
    Type
    IParagraphStyle

    AddSection()

    Adds new section to document.

    Declaration
    public ISection AddSection()
    Returns
    Type
    ISection

    AddStyle(StyleType, String)

    Adds new style to document.

    Declaration
    public IStyle AddStyle(StyleType styleType, string styleName)
    Parameters
    Type Name Description
    StyleType styleType

    Style type

    System.String styleName

    Style name

    Returns
    Type
    IStyle

    Clone()

    Clones itself.

    Declaration
    public IDocument Clone()
    Returns
    Type
    IDocument

    CloneImpl()

    Declaration
    protected virtual IDocument CloneImpl()
    Returns
    Type
    IDocument

    CreateCellFormatImpl()

    Implementation of cell format creating

    Declaration
    protected virtual CellFormat CreateCellFormatImpl()
    Returns
    Type
    CellFormat

    CreateCharacterFormatImpl()

    Implementation of character foprmat creating

    Declaration
    protected virtual CharacterFormat CreateCharacterFormatImpl()
    Returns
    Type Description
    CharacterFormat

    Character format object.

    CreateColumnCollectionImpl(ISection)

    Implementation of section collection creating

    Declaration
    protected virtual ColumnCollection CreateColumnCollectionImpl(ISection owner)
    Parameters
    Type Name Description
    ISection owner
    Returns
    Type
    ColumnCollection

    CreateColumnImpl()

    Implementation of style creation.

    Declaration
    protected virtual Column CreateColumnImpl()
    Returns
    Type
    Column

    CreateHeadersFootersImpl()

    Declaration
    protected virtual HeadersFooters CreateHeadersFootersImpl()
    Returns
    Type
    HeadersFooters

    CreateLayoutInfo()

    Creates and initializes layouting data

    Declaration
    protected override void CreateLayoutInfo()
    Overrides
    WidgetBase.CreateLayoutInfo()

    CreateListFormatImpl(IParagraph)

    Declaration
    protected virtual ListFormat CreateListFormatImpl(IParagraph owner)
    Parameters
    Type Name Description
    IParagraph owner
    Returns
    Type
    ListFormat

    CreateListLevelImpl(ListStyle)

    Declaration
    protected virtual ListLevel CreateListLevelImpl(ListStyle style)
    Parameters
    Type Name Description
    ListStyle style
    Returns
    Type
    ListLevel

    CreateListStyleImpl()

    Declaration
    protected virtual ListStyle CreateListStyleImpl()
    Returns
    Type
    ListStyle

    CreatePageSetupImpl()

    Declaration
    protected virtual PageSetup CreatePageSetupImpl()
    Returns
    Type
    PageSetup

    CreateParagraph()

    Creates new pargraph instance.

    Declaration
    public IParagraph CreateParagraph()
    Returns
    Type
    IParagraph

    CreateParagraphCollectionImpl()

    Implementation of paragraph collection creating

    Declaration
    protected virtual IParagraphCollection CreateParagraphCollectionImpl()
    Returns
    Type
    IParagraphCollection

    CreateParagraphCollectionImpl(IEntityBase)

    Implementation of paragraph collection creating

    Declaration
    protected virtual IParagraphCollection CreateParagraphCollectionImpl(IEntityBase owner)
    Parameters
    Type Name Description
    IEntityBase owner
    Returns
    Type
    IParagraphCollection

    CreateParagraphFormatImpl()

    Implementation of paragraph foprmat creating

    Declaration
    protected virtual ParagraphFormat CreateParagraphFormatImpl()
    Returns
    Type Description
    ParagraphFormat

    Paragraph format object.

    CreateParagraphImpl()

    Implementation of paragraph creation.

    Declaration
    protected virtual IParagraph CreateParagraphImpl()
    Returns
    Type
    IParagraph

    CreateParagraphItem(ParagraphItemType)

    Creates new paragraph item instance.

    Declaration
    public IParagraphItem CreateParagraphItem(ParagraphItemType itemType)
    Parameters
    Type Name Description
    ParagraphItemType itemType

    Paragraph item type

    Returns
    Type
    IParagraphItem

    CreateParagraphItem(Object)

    Creates new paragraph item instance.

    Declaration
    protected virtual IParagraphItem CreateParagraphItem(object itemType)
    Parameters
    Type Name Description
    System.Object itemType

    Paragraph item type

    Returns
    Type
    IParagraphItem

    CreateParagraphItemCollectionImpl(IParagraph)

    Creates the paragraph item collection.

    Declaration
    protected virtual IParagraphItemCollection CreateParagraphItemCollectionImpl(IParagraph owner)
    Parameters
    Type Name Description
    IParagraph owner

    The owner.

    Returns
    Type
    IParagraphItemCollection

    CreateParagraphItemImpl(ParagraphItemType)

    Implementation of paragraph item creating

    Declaration
    protected virtual IParagraphItem CreateParagraphItemImpl(ParagraphItemType itemType)
    Parameters
    Type Name Description
    ParagraphItemType itemType
    Returns
    Type
    IParagraphItem

    CreateSectionCollectionImpl()

    Implementation of section collection creating

    Declaration
    protected virtual ISectionCollection CreateSectionCollectionImpl()
    Returns
    Type
    ISectionCollection

    CreateSectionImpl()

    Implementation of section creating

    Declaration
    protected virtual ISection CreateSectionImpl()
    Returns
    Type
    ISection

    CreateShape(ShapeType, Canvas)

    Creates new shape instance.

    Declaration
    public Shape CreateShape(ShapeType shapeType, Canvas canvas)
    Parameters
    Type Name Description
    ShapeType shapeType
    Canvas canvas
    Returns
    Type
    Shape

    CreateShapeFormatImpl()

    Implementation of shape format creating

    Declaration
    protected virtual ShapeFormat CreateShapeFormatImpl()
    Returns
    Type Description
    ShapeFormat

    Shape format object.

    CreateShapeImpl(ShapeType, Canvas)

    Implementation of shape creating

    Declaration
    protected virtual Shape CreateShapeImpl(ShapeType shapeType, Canvas canvas)
    Parameters
    Type Name Description
    ShapeType shapeType

    Shape type

    Canvas canvas
    Returns
    Type
    Shape

    CreateStyleCollectionImpl()

    Implementation of style collection creating

    Declaration
    protected virtual IStyleCollection CreateStyleCollectionImpl()
    Returns
    Type
    IStyleCollection

    CreateStyleImpl(StyleType)

    Implementation of style creating

    Declaration
    protected virtual IStyle CreateStyleImpl(StyleType styleType)
    Parameters
    Type Name Description
    StyleType styleType
    Returns
    Type
    IStyle

    CreateTabCollectionImpl(ParagraphFormat)

    Creates the tab collection impl.

    Declaration
    protected virtual TabCollection CreateTabCollectionImpl(ParagraphFormat paragraph)
    Parameters
    Type Name Description
    ParagraphFormat paragraph

    The paragraph.

    Returns
    Type
    TabCollection

    CreateTableCellCollectionImpl(TableRow)

    Declaration
    protected virtual CellCollection CreateTableCellCollectionImpl(TableRow row)
    Parameters
    Type Name Description
    TableRow row
    Returns
    Type
    CellCollection

    CreateTableCellImpl(TableRow)

    Declaration
    protected virtual TableCell CreateTableCellImpl(TableRow row)
    Parameters
    Type Name Description
    TableRow row
    Returns
    Type
    TableCell

    CreateTableColumnCollectionImpl(Table)

    Declaration
    protected virtual TableColumnCollection CreateTableColumnCollectionImpl(Table table)
    Parameters
    Type Name Description
    Table table
    Returns
    Type
    TableColumnCollection

    CreateTableColumnImpl(ITable)

    Declaration
    protected virtual TableColumn CreateTableColumnImpl(ITable table)
    Parameters
    Type Name Description
    ITable table
    Returns
    Type
    TableColumn

    CreateTableFormatImpl()

    Implementation of table format creating

    Declaration
    protected virtual TableFormat CreateTableFormatImpl()
    Returns
    Type Description
    TableFormat

    Table format instance

    CreateTableRowCollectionImpl(Table)

    Declaration
    protected virtual RowCollection CreateTableRowCollectionImpl(Table table)
    Parameters
    Type Name Description
    Table table
    Returns
    Type
    RowCollection

    CreateTableRowImpl(Table)

    Declaration
    protected virtual TableRow CreateTableRowImpl(Table table)
    Parameters
    Type Name Description
    Table table
    Returns
    Type
    TableRow

    CreateTextBodyImpl()

    Implementation of character foprmat creating

    Declaration
    protected virtual TextBody CreateTextBodyImpl()
    Returns
    Type
    TextBody

    CreateTextBoxCollectionImpl()

    Text

    Declaration
    protected virtual TextBoxCollection CreateTextBoxCollectionImpl()
    Returns
    Type
    TextBoxCollection

    CreateTextboxFormatImpl()

    Implementation of textbox format creating

    Declaration
    protected virtual TextBoxFormat CreateTextboxFormatImpl()
    Returns
    Type Description
    TextBoxFormat

    textbox format object.

    EnsureListStyles()

    Create default liststyles and add them to ListStyleCollection

    Declaration
    protected void EnsureListStyles()

    EnsureMinimal()

    Adds one section and one paragraph to the document.

    Declaration
    public void EnsureMinimal()

    EnsureParagraphStyle(IParagraph)

    Declaration
    protected void EnsureParagraphStyle(IParagraph paragraph)
    Parameters
    Type Name Description
    IParagraph paragraph

    Find(String, Boolean, Boolean)

    Returns first entry of given string, taking into consideration caseSensitive and wholeWord options.

    Declaration
    public TextRangesHolder Find(string given, bool caseSensitive, bool wholeWord)
    Parameters
    Type Name Description
    System.String given
    System.Boolean caseSensitive
    System.Boolean wholeWord
    Returns
    Type
    TextRangesHolder
    Remarks

    Result TextRangesHolder is expected to use as parameter for Replace method. Each text ranges from TextRangesHolder is only reference to original textrange in document.

    Find(Regex)

    Returns first entry of given regex.

    Declaration
    public TextRangesHolder Find(Regex pattern)
    Parameters
    Type Name Description
    System.Text.RegularExpressions.Regex pattern
    Returns
    Type
    TextRangesHolder

    FindAll(String, Boolean, Boolean)

    Returns all entries of given string, taking into consideration caseSensitive and wholeWord options.

    Declaration
    public TextRangesHolder[] FindAll(string given, bool caseSensitive, bool wholeWord)
    Parameters
    Type Name Description
    System.String given
    System.Boolean caseSensitive
    System.Boolean wholeWord
    Returns
    Type
    TextRangesHolder[]

    FindAll(Regex)

    Returns all entries of given regex.

    Declaration
    public TextRangesHolder[] FindAll(Regex pattern)
    Parameters
    Type Name Description
    System.Text.RegularExpressions.Regex pattern
    Returns
    Type
    TextRangesHolder[]

    GetBackGndImage()

    Declaration
    protected virtual Image GetBackGndImage()
    Returns
    Type
    System.Drawing.Image

    GetSchema()

    Declaration
    protected virtual XmlSchema GetSchema()
    Returns
    Type
    System.Xml.Schema.XmlSchema

    GetText()

    Gets the document's text.

    Declaration
    public string GetText()
    Returns
    Type
    System.String

    ImportContent(IDocument)

    Declaration
    public void ImportContent(IDocument doc)
    Parameters
    Type Name Description
    IDocument doc

    ImportSection(ISection)

    Imports section into document.

    Declaration
    public void ImportSection(ISection section)
    Parameters
    Type Name Description
    ISection section

    InitXDLSHolder()

    Adds serializable elements to XDLS holder.

    Declaration
    protected override void InitXDLSHolder()
    Overrides
    XDLSSerializableBase.InitXDLSHolder()

    OnSetBackgroundImage()

    Declaration
    protected virtual void OnSetBackgroundImage()

    OpenXml(Stream)

    Opens the XML document from stream.

    Declaration
    public void OpenXml(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream object

    OpenXml(String)

    Opens the document from xml format file.

    Declaration
    public void OpenXml(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    The name of file

    Replace(String, TextRangesHolder, Boolean, Boolean)

    Replaces all entries of given string with TextRangesHolder, taking into consideration caseSensitive and wholeWord options.

    Declaration
    public void Replace(string given, TextRangesHolder textRangesHolder, bool caseSensitive, bool wholeWord)
    Parameters
    Type Name Description
    System.String given
    TextRangesHolder textRangesHolder
    System.Boolean caseSensitive
    System.Boolean wholeWord

    Replace(String, String, Boolean, Boolean)

    Replaces all entries of given string with replace string, taking into consideration caseSensitive and wholeWord options.

    Declaration
    public int Replace(string given, string replace, bool caseSensitive, bool wholeWord)
    Parameters
    Type Name Description
    System.String given
    System.String replace
    System.Boolean caseSensitive
    System.Boolean wholeWord
    Returns
    Type
    System.Int32

    Replace(Regex, TextRangesHolder)

    Replaces all entries of given regular expression with TextRangesHolder.

    Declaration
    public void Replace(Regex pattern, TextRangesHolder textRangesHolder)
    Parameters
    Type Name Description
    System.Text.RegularExpressions.Regex pattern
    TextRangesHolder textRangesHolder

    Replace(Regex, String)

    Replaces all entries of given regular expression with replace string.

    Declaration
    public int Replace(Regex pattern, string replace)
    Parameters
    Type Name Description
    System.Text.RegularExpressions.Regex pattern
    System.String replace
    Returns
    Type
    System.Int32

    SaveTxt(Stream)

    Saves the document in text format.

    Declaration
    public void SaveTxt(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The name of target file

    SaveTxt(String)

    Saves the document in text format.

    Declaration
    public void SaveTxt(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    The name of target file

    SaveXml(Stream)

    Saves the document in xml format.

    Declaration
    public void SaveXml(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The target stream

    SaveXml(String)

    Saves the document in xml format.

    Declaration
    public void SaveXml(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    The name of target file

    Implements

    IXDLSSerializable
    IDocument
    IEntityBase
    System.Xml.Serialization.IXmlSerializable
    IWidgetContainer
    IWidget
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved