VDocsClass
Definition
- Namespace
- DOM
- Assembly
- VDocs.dll
The main entry point for the VDocs document processing framework.
Remarks
serves as the primary façade for creating, opening, editing, and exporting documents in various formats including Word (DOCX), HTML, and PDF. It provides a unified API for all document operations while handling license validation and delegating to appropriate backend services. VDocs The class supports: Creating new documents from scratch Opening existing Word documents Adding and manipulating document elements (paragraphs, tables, images, shapes, etc.) Exporting to HTML and PDF formats Saving back to Word format Theme management All export and save operations are protected by license validation through . If a license is not validated, warning messages are written to the console but operations continue (for evaluation purposes). LicenseManager instances are not thread-safe; do not share one between threads. Separate instances are fully independent (each owns its own package parts and services), so generating documents in parallel with one instance per thread or task is safe. License validation keeps no shared mutable state beyond write-once flags. Thread safety: VDocs
Examples
Constructors
Initializes a new, empty document using the default document services. VDocs
Opens an existing Word document from the specified file path.
Opens an existing Word document from a stream.
Properties
Gets or sets the background color of the document.
This value typically maps to the document-level background or page color in the underlying XML representation. It affects all pages of the document.
Gets or sets the direct children elements of this top-level document object.
Child elements typically include sections, paragraphs, tables, and other block-level elements that make up the document content.
Gets or sets the document grid settings used for character/line layout.
The document grid provides a consistent baseline for character and line positioning. It is commonly used in East Asian typography to align text and improve readability.
Gets or sets the document styles.
Document styles define the formatting for paragraphs, characters, tables, and lists. Styles provide a consistent way to apply formatting and enable easy updates across the entire document.
Gets the document footers.
Footers appear at the bottom of pages and can contain text, images, page numbers, and other content that repeats across pages. Different footers can be defined for odd/even pages or the first page.
Gets the document headers.
Headers appear at the top of pages and can contain text, images, page numbers, and other content that repeats across pages. Different headers can be defined for odd/even pages or the first page.
Gets the images contained in the document.
Gets the index of this element in its parent's child collection.
For the top-level document, this property may return 0 or -1 depending on the underlying implementation.
Gets or sets the optional path to a license file.
When set, this path is used by to validate the license before any save or export operation. If the license is invalid, warning messages are displayed but operations continue (evaluation mode). LicenseManager
Gets or sets the column settings for the document sections.
This property controls how text flows across multiple columns on the page. It allows you to define the number of columns, their width, spacing between columns, and whether a vertical line separates them.
Gets the pages contained by the document.
This property provides access to page-level properties and content. Pages are automatically created based on content flow and section breaks.
Gets the paragraphs contained in the document.
Returns the parent element of this document.
Gets the SVG paths contained in the document.
Gets or sets whether the document layout is right-to-left.
This property is used for languages that are written right-to-left, such as Arabic, Hebrew, and Persian. When enabled, text and elements flow from right to left.
Gets or sets the section break type for this document when accessed through the interface. IDocumentSection
Gets the top-level sections of the document.
Sections represent major structural divisions in a document, similar to chapters or parts. Each section can have its own page settings, headers, footers, and columns.
Gets the shapes contained in the document.
Gets or sets the status of this document element.
Gets the tables contained in the document.
Gets or sets the text flow direction used by the document.
Gets the text elements contained in the document.
Gets or sets the vertical alignment of text on the page.
This property controls how text is distributed vertically within the page margins. For example, "center" will center the text block vertically on the page, which is commonly used for title pages.
Methods
Adds one or more child elements to the document.
Adds a footer to the document.
Adds a header to the document.
Adds an image element to the document.
Adds a new paragraph to the document.
Adds an SVG path element to the document.
Creates and adds a new section to the document.
Adds a shape element to the document.
Adds a table to the document.
Adds a text node with the specified string content to the document.
Creates a deep clone of this document element.
Releases the resources (pooled package part streams) owned by this document.
Exports the document to the specified file format and path.
Gets the currently active theme for the document.
Gets a child element of type by its index. T
Returns an HTML representation of the document.
Obsolete alias of . GetHtml
Inserts elements after the specified source element.
Inserts elements before the specified source element.
Inserts child elements at the specified child index.
Produces a debug-friendly representation of the document object tree.
Opens an existing HTML document.
Asynchronously opens an HTML document from a stream. Not yet implemented.
Opens an existing PDF document.
Asynchronously opens a PDF document from a stream. Not yet implemented.
Opens an existing Word document using a static factory method.
Asynchronously opens an existing Word document from a stream.
Removes this element from its parent's child collection.
Removes all child elements from this document.
Removes the specified child elements from the document.
Replaces this element with in the parent collection. newChild
Saves the document as an HTML file.
Obsolete alias of . SaveAsHtml(string)
Asynchronously saves the document to a stream. Rendering is synchronous (CPU-bound) into a buffer; only the write to is asynchronous. The stream is left open. output
Saves the document as a PDF file.
Asynchronously saves the document to a stream. Rendering is synchronous (CPU-bound) into a buffer; only the write to is asynchronous. The stream is left open. output
Saves the document as a Word (.docx) file.
Asynchronously saves the document to a stream. Rendering is synchronous (CPU-bound) into a buffer; only the write to is asynchronous. The stream is left open. output
Sets the active theme for the document by name.
Renders the document as PDF and returns the bytes.
Renders the document as .docx and returns the bytes.