Click or drag to resize

Document Class

Inheritance Hierarchy

Namespace: Spire.Doc
Assembly: Spire.Doc (in Spire.Doc.dll) Version: 13.2.3.0 (13.2.3.3046)
Syntax
public class Document : DocumentContainer, IDocument, 
	ICompositeObject, IDocumentObject, IXmlSerializable, IDisposable

The Document type exposes the following members.

Constructors
Name Description
Public method Document
Initializes a new instance of the Document class.
Public method Document(Boolean)
Initializes a new instance of the Document class.
Public method Document(Stream)
Initializes a new instance of the Document class from the stream.
Public method Document(String)
Initializes a new instance of the Document class from Word document.
Protected method Document(Document)
Initializes a new instance of the Document class
Public method Document(Stream, FileFormat)
Initializes a new instance of the Document class from the stream.
Public method Document(Stream, Boolean)
Initializes a new instance of the Document class using the specified stream and engine settings.
Public method Document(Stream, String)
Initializes a new instance of the Document class from the Word document stream, which is protected with password.
Public method Document(String, FileFormat)
Initializes a new instance of the Document class.
Public method Document(String, Boolean)
Initializes a new instance of the Document class with the specified file name and engine usage flag.
Public method Document(String, String)
Initializes a new instance of the Document class from existing Word document, which is protected with password.
Public method Document(Stream, FileFormat, XHTMLValidationType)
Initializes a new instance of the Document class
Public method Document(Stream, FileFormat, Boolean)
Initializes a new instance of the Document class with the specified stream, file format, and engine usage.
Public method Document(Stream, FileFormat, String)
Initializes a new instance of the Document class from the stream of specified type protected with password.
Public method Document(Stream, String, Boolean)
Initializes a new instance of the Document class with the specified stream, password, and engine usage.
Public method Document(String, FileFormat, XHTMLValidationType)
Initializes a new instance of the Document class.
Public method Document(String, FileFormat, Boolean)
Initializes a new instance of the Document class with the specified file name, file format, and flag indicating whether to use the new engine.
Public method Document(String, FileFormat, String)
Initializes a new instance of the Document class from existing file of specified type protected with password.
Public method Document(String, String, Boolean)
Initializes a new instance of the Document class with the specified file name, password, and engine usage.
Public method Document(Stream, FileFormat, XHTMLValidationType, Boolean)
Initializes a new instance of the Document class with the specified stream, file format, XHTML validation type, and use new engine flag.
Public method Document(Stream, FileFormat, String, Boolean)
Initializes a new instance of the Document class with the specified stream, file format, password, and new engine option.
Public method Document(String, FileFormat, XHTMLValidationType, Boolean)
Initializes a new instance of the Document class with the specified file name, file format, XHTML validation type, and flag indicating whether to use the new engine.
Public method Document(String, FileFormat, String, Boolean)
Initializes a new instance of the Document class with the specified file name, file format, password, and whether to use the new engine.
Top
Properties
Name Description
Public property AutoUpdateStylesByTemplate
Gets or sets a value indicating whether updating the styles in this document to match the styles in the attached template each time you open .
Public property Background
Gets document's background
Public property Bookmarks
Gets document bookmarks.
Public property BuiltinDocumentProperties
Gets document built-in properties object.
Public property ChildObjects
Gets the child entities.
(Overrides DocumentObject ChildObjects .)
Public property Comments
Gets comments item of the document.
Public property Count
Gets count of child object.
(Inherited from DocumentContainer .)
Public property CustomDocumentProperties
Gets document custom properties object.
Public property DetectedFormatType
Returns the detected format type of the document which was loaded. .
Public property DigitalSignatures
Gets the collection of digital signatures in the current document.
Public property Document
Gets the document.
(Inherited from OwnerHolder .)
Public property DocumentObjectType
Gets the type of the document object.
(Overrides DocumentObject DocumentObjectType .)
Public property EmbedFontsInFile
Gets or sets a value indicating whether save fonts that are used in the document in the file. Only support for the DOCX file format.
Public property EmbedSystemFonts
Gets or sets a value indicating whether save system fonts that are used in the document in the file.
Public property EndnoteOptions
Gets or sets options that control numbering and positioning of endnotes in this document.
Public property Endnotes
Gets document endnotes.
Public property FieldOptions
Gets or sets the options for the field.
Public property Fields
Gets fields of the documnet.
Public property FirstChild
Gets the first child of the Element.
(Inherited from DocumentObject .)
Public property FootnoteOptions
Gets or sets options that control numbering and positioning of footnotes in this document.
Public property Footnotes
Gets document footnotes.
Public property ForceTableRelayout
Gets or sets a value indicating whether to force a table relayout.
Public property HasChanges
Gets a value indicating whether the document has tracked changes.
Public property HtmlBaseUrl
Gets or sets the Base path which is used to convert the relative path to absolute path.
Public property HTMLCustomComment

Gets or sets a value specifying whether parsing and writing comment of document in HTML.

Supported HTML Tag : span ,when the value of class attribute is comment

Supported HTML Tag Attribytes : data-comment / data-user / data-cid / data-date.

Public property HtmlExportOptions
Gets the save options.
Public property HTMLIdentifierPunctuations
Set the custom punctuation as sentence indentifier. Full stop, qusetion mark, exclamatory mark are default values.
Public property HTMLSentenceIdentifier

Gets or sets a value specifying whether to add identifier to a sentence when writing to HTML.

Writed HTML Attribyte : sentence.

Writed HTML Value Of Attribyte : start / end / (start,end).

Public property HTMLTrackChanges

Gets or sets a value specifying whether parsing and writing custom Change_Tracking HTML Tags are supported.

Supported HTML Tag : insert / delete.

Supported HTML Tag Attribytes : data-username / data-time.

Public property IsComposite
Indicating whether this instance is composite.
(Inherited from DocumentObject .)
Public property IsContainMacro
Indicates whether the document has macros.
Public property IsUpdateFields
Gets or sets a value indicating whether to update fields in the document.
Public property JPEGQuality
Gets/sets the quality (Q%) of the image of JPEG format, this property is only used for doc to pdf. The default value is 80.
Public property KeepSameFormat
Gets or sets a value that indicates whether to keep same formatting when this document is merged to other document.
Public property LastChild
Gets the last child of the Element.
(Inherited from DocumentObject .)
Public property LastParagraph
Gets last section object.
Public property LastSection
Gets last section of the document.
Public property LayoutOptions
Gets the layout options. The related layout settings are only supported for new engines.
Public property ListStyles
Gets document list styles.
Public property MailMerge
Gets mail merge engine.
Public property NextSibling
Gets the next sibling.
(Inherited from DocumentObject .)
Public property Owner
Gets the owner of this entity.
(Inherited from DocumentObject .)
Public property PageCount
Gets total number of pages for document.
Public property PreviousSibling
Gets the previous sibling.
(Inherited from DocumentObject .)
Public property PrintDialog
Set print parnameters
Public property PrintDocument
Gets the PrintDocument
Public property PrivateFontList
Gets the private font list.
Public property Properties
Gets the document properties.
Public property ProtectionType
Gets or sets the type of protection of the document.
Public property QuiteMode
Get / sets whether is quite mode.
Public property ReplaceFirst
Gets or sets a value indicating whether need first replacing.
Public property Sections
Gets document sections.
Public property Styles
Gets document styles.
Public property TextBoxes
Get/set textbox items of main document
Public property TOC
Gets or sets the TOC element of the word document.
Public property TrackChanges
Gets or sets a value that determines whether changes are tracked when the document is edited in applications like Microsoft Word or WPS.
Public property UseNewEngine Obsolete.
Gets a value indicating whether the new engine layout is enabled. The Spire.Doc product conversion feature has enabled the new engine way layout by default. If you want to switch to the old engine layout, use the Document constructor with the \"useNewEngine\" parameter and set the parameter \"useNewEngine\" to false.
Public property Variables
Gets or sets the document variables.
Public property ViewSetup
Gets view setup options in Microsoft word.
Public property Watermark
Gets or sets document's watermark.
Protected property WidgetCollection (Overrides DocumentContainer WidgetCollection .)
Protected property XDLSHolder (Inherited from DocumentSerializable .)
Public property XHTMLValidateOption
Gets or sets the HTML validate option.the default value is None.
Top
Methods
Name Description
Public method AcceptChanges
Accepts changes tracked from the moment of last change acceptance.
Public method AddListStyle
Adds new list style to document.
Public method AddParagraphStyle
Adds new paragraph style to the document.
Public method AddSection
Adds new section to document.
Public method AddStyle
Adds the style to the document style.
Public method CheckProtectionPassWord
Check that the password entered is the same as the permission protection password
Public method ClearCustomFonts
Clear the custom fonts.
Public method ClearCustomFontsFolders Obsolete.
Clear the custom fonts.
Public method Static member ClearGlobalCustomFonts
Clear the global custom fonts.
Public method Static member ClearGlobalCustomFontsFolders Obsolete.
Clear the global custom fonts.
Public method ClearMacros
Removes the macros from the document.
Public method Static member ClearSystemFontCache
Clears the memory used by cached system fonts.
Public method Clone
Clones itself.
Public method CloneCompatibilityTo
Clones the current document compatibility to the destination document.
Public method CloneDefaultStyleTo
Clones the current document default style to the destination document.
Protected method CloneImpl (Overrides DocumentSerializable CloneImpl .)
Public method CloneThemesTo
Clones the current document theme style to the destination document.
Public method CloneWebSettingsTo
clone Websettings to other document
Public method Close
Closes this instance.
Public method Compare(Document, String)
Compares this document with another document.
Public method Compare(Document, String, CompareOptions)
Compares this document with another document.
Public method Compare(Document, String, DateTime)
Compares this document with another document.
Public method Compare(Document, String, DateTime, CompareOptions)
Compares this document with another document.
Protected method CreateLayoutInfo (Overrides DocumentBase CreateLayoutInfo .)
Protected method CreateListFormatImpl
Public method CreateMinialDocument
Create a minial document,one empty section to the document and one empty paragraph to created section.
Public method CreateParagraph
Creates the paragraph.
Public method CreateParagraphItem
Creates new paragraph item instance.
Protected method CreateTextBoxCollectionImpl
Public method Dispose
Prerforms application-defined tasks associated with freeing,releasing, or resetting unmanaged resources.
Public method Encrypt
Encrypts the document.
Public method Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object .)
Protected method Finalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object .)
Public method FindAllPattern(Regex)
Returns all entries of matchString regex.
Public method FindAllPattern(Regex, Boolean)
Returns all entries of matchString regex.
Public method FindAllString
Returns all entries of matchString string, taking into consideration caseSensitive and wholeWord options.
Public method FindPattern(Regex)
Finds and returns entry of specified regular expression along with formatting.
Public method FindPattern(BodyRegion, Regex)
Finds the next entry of matchString pattern.
Public method FindPatternInLine(Regex)
Finds the first entry of specified pattern in single-line mode.
Public method FindPatternInLine(BodyRegion, Regex)
Finds the text which fit the specified pattern starting from start. using single-line mode.
Public method FindString(String, Boolean, Boolean)
Finds and returns string along with formatting.
Public method FindString(BodyRegion, String, Boolean, Boolean)
Finds the next entry of matchString string, taking into consideration caseSensitive and wholeWord options.
Public method FindStringInLine(String, Boolean, Boolean)
Finds the first entry of matchString text in single-line mode.
Public method FindStringInLine(BodyRegion, String, Boolean, Boolean)
Finds the next matchString text starting from specified using single-line mode.
Public method GetHashCode
Serves as the default hash function.
(Inherited from Object .)
Public method GetIndex
Returns the zero-based index of the specified entity.
(Inherited from DocumentContainer .)
Public method GetNextWidgetSibling
Gets the next sibling.
(Inherited from DocumentObject .)
Public method GetPageCount
Gets total number of pages for document.
Public method GetPreviousWidgetSibling
Gets the previous widget sibling.
(Inherited from DocumentObject .)
Protected method GetSchema
Public method GetText
Gets the document's text.
Public method GetType
Gets the Type of the current instance.
(Inherited from Object .)
Public method Static member HasDigitalSignature(Stream)
Verifies the presence of a digital signature in the specified Doc/Docx stream.
Public method Static member HasDigitalSignature(String)
Verifies the presence of a digital signature in the specified Doc/Docx file.
Public method HasWriteProtection
Checks if the document has write protection.
Public method ImportContent(IDocument)
Imports all content into the document.
Public method ImportContent(IDocument, Boolean)
Imports all content into document.
Public method ImportSection
Imports section into document.
Protected method InitXDLSHolder (Overrides DocumentSerializable InitXDLSHolder .)
Public method InsertTextFromFile
Insert text from a file.
Public method InsertTextFromStream
Insert text from stream.
Public method IntegrateFontTableTo
Integrate the current document font table to the destination document.
Public method Static member IsEncrypted(Stream)
Check that the document is encrypted
Public method Static member IsEncrypted(String)
Check that the document is encrypted
Public method LoadFontFallbackRuleSettings
Load the font fallback rules from the xml
Public method LoadFromFile(String)
Opens doc file.
Public method LoadFromFile(String, FileFormat)
Opens the document from file in Xml or Microsoft Word format.
Public method LoadFromFile(String, FileFormat, XHTMLValidationType)
Opens the HTML document from stream .
Public method LoadFromFile(String, FileFormat, String)
Opens the document from file in Xml or Microsoft Word format.
Public method LoadFromFileInReadMode
LoadFromStream new document in read-only mode.
Public method LoadFromStream(Stream, FileFormat)
Opens the document from stream in Xml or Microsoft Word format.
Public method LoadFromStream(Stream, FileFormat, XHTMLValidationType)
Opens the HTML document from stream .
Public method LoadFromStream(Stream, FileFormat, String)
Opens the document from stream in Xml or Microsoft Word format.
Public method LoadHTML(TextReader, XHTMLValidationType)
Load document in html format
Public method LoadHTML(TextReader, String, XHTMLValidationType)
Load document in html format
Public method LoadRtf(Stream)
Opens the rtf document from a stream.
Public method LoadRtf(TextReader)
Opens the rtf document with specified encoding from a reader.
Public method LoadRtf(String)
Opens the rtf document from a file.
Public method LoadRtf(Stream, Encoding)
Opens the rtf document with specified encoding from a stream.
Public method LoadRtf(String, Encoding)
Opens the rtf document with specified encoding from a file.
Public method LoadText(Stream)
Opens the text document from a stream with default encoding utf-8.
Public method LoadText(TextReader)
Opens the rtf document with specified encoding from a reader.
Public method LoadText(String)
Opens the text document from a file with default encoding utf-8.
Public method LoadText(Stream, Encoding)
Opens the text document with specified encoding from a stream.
Public method LoadText(String, Encoding)
Opens the text document with specified encoding from a file.
Protected method MemberwiseClone
Creates a shallow copy of the current Object .
(Inherited from Object .)
Protected method OnBeginPrint
Protected method OnEndPrint
Protected method OnPrintPage
Protected method OnQueryPageSettings
Public method PrintMultipageToOneSheet(PagesPerSheet)
Print multipage to one sheet
Public method PrintMultipageToOneSheet(PagesPerSheet, Boolean)
Print multipage to one sheet
Public method Protect(ProtectionType)
Protects the document.
Public method Protect(ProtectionType, String)
Protects the document.
Protected method ReadXmlAttributes (Overrides DocumentSerializable ReadXmlAttributes(IXDLSAttributeReader) .)
Protected method ReadXmlContent (Overrides DocumentSerializable ReadXmlContent(IXDLSContentReader) .)
Public method RejectChanges
Rejects changes tracked from the moment of last change acceptance.
Public method RemoveEncryption
Removes the encryption.
Public method RenderToScale
Draws a document page at the specified scale into the System.Drawing.Graphics object.
Public method RenderToSize
Draws a document page at the specified size into the System.Drawing.Graphics object.
Public method Replace(Regex, TextSelection)
Replaces all entries of matchString regular expression with TextRangesHolder.
Public method Replace(Regex, String)
Replaces all entries of matchString regular expression with newValue string.
Public method Replace(String, TextSelection, Boolean, Boolean)
Replaces all entries of matchString string with TextSelection, taking into consideration caseSensitive and wholeWord options.
Public method Replace(String, IDocument, Boolean, Boolean)
Replaces the specified matchString.
Public method Replace(String, String, Boolean, Boolean)
Replaces all entries of matchString string with newValue string, taking into consideration caseSensitive and wholeWord options.
Public method ReplaceInLine(Regex, TextSelection)
Replaces the matchString pattern with matchSelection in single-line mode.
Public method ReplaceInLine(Regex, String)
Replaces all entries with specified pattern with newValue text in single-line mode.
Public method ReplaceInLine(String, TextSelection, Boolean, Boolean)
Replaces the matchString text with matchSelection in single-line mode.
Public method ReplaceInLine(String, String, Boolean, Boolean)
Replaces all entries of matchString text with newValue text in single-line mode.
Public method ResetFindState
Resets the FindPattern.
Public method ResetPageLayoutCache
Reset the page layout cache data of the new engine.
Protected method RestoreReference (Inherited from DocumentSerializable .)
Public method SaveFontFallbackRuleSettings
Save the default font fallback rules to the xml
Public method SaveToEpub(Stream, DocPicture)
Saves the EPUB document.
Public method SaveToEpub(String, DocPicture)
Saves the EPUB document.
Public method SaveToFile(String)
Saves to file in Microsoft Word format.
Public method SaveToFile(Stream, FileFormat)
Saves the document into stream in Xml or Microsoft Word format.
Public method SaveToFile(String, FileFormat)
Saves the document to file in Xml or Microsoft Word format.
Public method SaveToFile(String, ToPdfParameterList)
Saves the document to PDF file.
Public method SaveToFile(String, FileFormat, Byte , String)
Saves document to file and digitally sign, Only DOC and DOCX are supported.
Public method SaveToFile(String, FileFormat, String, String)
Saves document to file and digitally sign, Only DOC and DOCX are supported.
Public method SaveToFile(String, FileFormat, HttpResponse, HttpContentType)
Saves the specified file name.
Public method SaveToImages(ImageType)
Save the whole document into images
Public method SaveToImages(Int32, ImageType)
Save the specified page into image
Public method SaveToImages(Int32, ImageFormat)
Save the specified page into image
Public method SaveToImages(ImageType, ToImageOption)
Save the specified page into image
Public method SaveToImages(ImageType, ToPdfParameterList)
Public method SaveToImages(Int32, Int32, ImageType)
Save the specified range of pages into images
Public method SaveToStream(Stream, FileFormat)
Saves the document into stream in Xml or Microsoft Word format.
Public method SaveToStream(Stream, ToPdfParameterList)
Saves the document into stream.
Public method SaveToStream(Stream, FileFormat, Byte , String)
Saves document to stream and digitally sign, Only DOC and DOCX are supported.
Public method SaveToStream(Stream, FileFormat, String, String)
Saves document to stream and digitally sign, Only DOC and DOCX are supported.
Public method SaveToSVG
Saves the SVG.
Public method SaveToSVG(String)
Saves the SVG.
Public method SaveToTxt
Saves to text document with specified encoding.
Public method SetCustomFonts
Sets the custom font stream array.
Public method SetCustomFontsFolders
Sets the path to the folder where the custom font is located.
Public method SetDateTimeOfUnitTest
Public method Static member SetGlobalCustomFonts
Sets the global custom font stream array.
Public method Static member SetGlobalCustomFontsFolders( Stream ) Obsolete.
Sets the global custom font stream array.
Public method Static member SetGlobalCustomFontsFolders(String)
Sets the path to the folder where the global custom font is located.
Public method SetWatermark
Sets document's Picturewatermark.
Public method SetWriteProtection(String)
Sets the write protection for a document using the provided password.
Public method SetWriteProtection(String, Boolean)
Sets the write protection for a document with an optional password and recommended read-only setting.
Public method Static member Sign(Stream, Byte , String)
Create digitally signed word document. Digital signature of documents support only DOC and DOCX formats.
Public method Static member Sign(Stream, String, String)
Create digitally signed word document. Digital signature of documents support only DOC and DOCX formats.
Public method SprBpcmUuRG9jLkRvY3Vt
Public method StartTrackRevisions(String)
Begins making all subsequent changes made to the document programmatically as revisions.
Public method StartTrackRevisions(String, DateTime)
Begins making all subsequent changes made to the document programmatically as revisions.
Public method StopTrackRevisions
Stops making changes programmatically as revisions.
Public method ToString
Returns a string that represents the current object.
(Inherited from Object .)
Public method ToString(String)
Exports the name and index in container of the object into a string in the specified seperator.
(Inherited from DocumentObject .)
Public method Unprotect
Unprotect the document.
Public method Unprotect(String)
Unprotect the document with a password.
Public method UnWriteProtection
Removes the write protection from a document by clearing the password and disabling the read-only recommendation.
Public method UnWriteProtection(String)
Attempts to remove the write protection from a document by validating the provided password and, if valid, clearing the password and disabling the read-only recommendation.
Public method UpdatePageLayout
Updates the page layout of the document.
Public method UpdateTableLayout
Update table grid before saving the document when using the new engine.
Public method UpdateTableOfContents
Update Table of contents in the document.
Public method UpdateTableOfContents(TableOfContent)
Update specified Table of content in the document.
Public method UpdateTOCPageNumbers
Update Table of contents page numbers in the document.
Public method UpdateTOCPageNumbers(TableOfContent)
Update specified Table of content page numbers in the document.
Public method UpdateWordCount
Update Paragraphs count, Word count and Character count
Public method UpdateWordCount( Char )
Update Paragraphs count, Word count and Character count.
Public method UpdateWordCount( Char , Boolean)
Update Paragraphs count, Word count and Character count.
Protected method WriteXmlAttributes (Overrides DocumentSerializable WriteXmlAttributes(IXDLSAttributeWriter) .)
Protected method WriteXmlContent (Overrides DocumentSerializable WriteXmlContent(IXDLSContentWriter) .)
Top
Events
Name Description
Public event BookmarkLayout
Occurs when draw a bookmark.
Public event EvalInformation
Get Spire.Doc Eval version limit information.
Public event HtmlUrlLoadEvent
Occurs when download a web source.
Public event PageImagePainted
Occurs when creating a new Image painted
Public event PageLayout
Occurs when creating a new page.
Public event UpdateFields
Occurs when update field.
Top
Fields
See Also