Click or drag to resize
DocumentModel Class
Represents a document.
Inheritance Hierarchy

Namespace: GemBox.Document
Assembly: GemBox.Document (in GemBox.Document.dll) Version: 25.3.30.1231
Syntax
public sealed class DocumentModel : Element, 
	IContentElement

The DocumentModel type exposes the following members.

Constructors
  NameDescription
Public methodDocumentModel
Initializes a new instance of the DocumentModel class.
Top
Methods
  NameDescription
Public methodCalculateListItems
Calculates the list items contained in this document.
Public methodClone
Clones this DocumentModel instance.
Public methodConvertToImageSource
Converts single page specified in options of this DocumentModel instance to an ImageSource instance.
Public methodConvertToXpsDocument
Converts this DocumentModel instance to an XpsDocument instance.
Public methodGetChildElements(Boolean)
Gets the child elements.
(Inherited from Element.)
Public methodGetChildElements(Boolean, ElementType)
Gets the child elements filtered by ElementType.
(Inherited from Element.)
Public methodGetPaginator
Gets the document paginator.
Public methodGetPaginator(PaginatorOptions)
Gets the document paginator and updates the document based on the specified options.
Public methodImportT(T, Boolean)
Imports (clones) the specified source element to this DocumentModel instance so it can be inserted into document content.
Public methodImportT(T, Boolean, ImportMapping)
Imports (clones) the specified source element to this DocumentModel instance so it can be inserted into document content.
Public methodImportT(T, Boolean, Boolean)
Imports (clones) the specified source element to this DocumentModel instance so it can be inserted into document content.
Public methodStatic memberLoad(String)
Loads a document from a file with the specified path.
Public methodStatic memberLoad(Stream, LoadOptions)
Loads a document from the specified stream.
Public methodStatic memberLoad(String, LoadOptions)
Loads a document from a file with the specified path.
Public methodPrint
Prints the document to the default printer.
Public methodPrint(String)
Prints the document to the specified printer.
Public methodPrint(String, PrintOptions)
Prints the document to the specified printer according to specified options.
Public methodSave(String)
Saves the document to a file with the specified path. Path must include file extension.
Public methodSave(Stream, SaveOptions)
Saves the document in the specified stream.
Public methodCode exampleSave(Object, String)
Saves the document to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the document to a client browser. File format is resolved from fileName extension. See remarks why httpResponse parameter is of type Object.
Public methodSave(String, SaveOptions)
Saves the document to a file with the specified path.
Public methodSave(XmlWriter, HtmlSaveOptions)
Save the document to HTML format using the specified writer.
Public methodCode exampleSave(Object, String, SaveOptions)
Saves the document to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the document to a client browser. File format is defined with options parameter. See remarks why httpResponse parameter is of type Object.
Top
Properties
  NameDescription
Public propertyBookmarks
Gets the document bookmarks.
Public propertyContent
Gets the content of the current Element.
(Inherited from Element.)
Public propertyDefaultCharacterFormat
Gets or sets the default character format.
Public propertyDefaultParagraphFormat
Gets or sets the default paragraph format.
Public propertyDocument
Gets the owner document.
(Inherited from Element.)
Public propertyDocumentProperties
Gets the document properties.
Public propertyElementType
Gets the ElementType of this Element instance.
(Overrides ElementElementType.)
Public propertyMailMerge
Gets the object that exposes mail merge operations and options for a document.
Public propertyParent
Gets the parent of this Element instance.
(Inherited from Element.)
Public propertyParentCollection
Gets the ElementCollection that contains this Element instance.
(Inherited from Element.)
Public propertyProtection
Gets or sets the document protection settings used to restrict editing and formatting of document content. Supported in DOCX and DOC formats.
Public propertySections
Gets the document sections.
Public propertySettings
Gets or sets the document settings.
Public propertyStyles
Gets the document styles.
Public propertyViewOptions
Gets or sets the document view options.
Public propertyWriteProtection
Gets or sets the document write protection options. Supported only in DOCX and DOC formats.
Top
Explicit Interface Implementations
Remarks

DocumentModel is a central class in GemBox.Document component. It is an in-memory representation of a document file.

Document content can be retrieved through DocumentModel.Sections property. For more information, see content model.

To load / read a document from a file or a stream, use static DocumentModel.Load methods. To preserve unsupported file format features, set PreserveUnsupportedFeatures to . For more information, see preservation.

To save / write a document to a file or a stream use DocumentModel.Save methods. For more information, see supported file formats.

DocumentModel contains also following members:

See Also