VegaRise.NET
Back to VDocs

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

csharp
1// Create a new document
2using var doc = new VDocs();
3
4// Add a paragraph with styled text
5var paragraph = doc.AddParagraph();
6paragraph.AddText("Hello, World!").SetBold(true).SetFontSize(16);
7paragraph.AddText(" This is a VDocs document.");
8
9// Add an image
10var image = doc.AddImage("logo.png");
11image.SetPosition(100, 200, Units.Pt);
12image.SetDimensions(300, 200, Units.Pt);
13
14// Add a table
15var table = doc.AddTable();
16table.AddRow().AddCell("Name").AddCell("Value");
17table.AddRow().AddCell("Product").AddCell("VDocs");
18
19// Export to different formats
20doc.SaveAsWord("document.docx");
21doc.SaveAsHtml("document.html");
22doc.SaveAsPdf("document.pdf");
23

Constructors

VDocs()

Initializes a new, empty document using the default document services. VDocs

VDocs(string filePath)

Opens an existing Word document from the specified file path.

VDocs(Stream input)

Opens an existing Word document from a stream.

Properties

BackgroundColorIColor

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.

ChildrenIElement

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.

DocumentGridIDocumentGrid

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.

DocumentStylesIDocumentStyles

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.

ImagesIImage

Gets the images contained in the document.

Index

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.

LicensePathLicenseManager

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

PageColumnsIPageColumns

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.

PageSettingsIPageSetup

Gets or sets the page setup options for the document.

The page setup defines the physical layout of each page in the document. This includes: Page size (A4, Letter, etc.) Margins (top, bottom, left, right) Orientation (portrait or landscape) Page numbering style

ParagraphsIParagraph

Gets the paragraphs contained in the document.

Returns the parent element of this document.

Gets the SVG paths contained in the document.

RightToLeftLayout

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.

SectionBreakTypeSectionMarkValues

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.

ShapesIShape

Gets the shapes contained in the document.

Gets or sets the status of this document element.

TablesITable

Gets the tables contained in the document.

TextFlowDirectionTextDirectionValues

Gets or sets the text flow direction used by the document.

TextsIText

Gets the text elements contained in the document.

VerticalTextAlignmentOnPageVerticalJustificationValues

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.

VegaRise.NET

Sign In

Welcome back. Please sign in to your account.

Forgot password?
or

Don't have an account? Create an account

By signing in, you agree to our Terms of Service and Privacy Policy.