VegaRise.NET
HomeAPI Reference
Back to DOM

DocumentClass

Definition

Namespace
DOM.Elements
Assembly
DOM.dll

Represents the root document element in the Vega DOM.

Remarks

is the top-level container for all document content and extends to allow direct composition of sections, pages, and other elements. Document DocumentSection This class provides access to document-wide settings such as styles, themes, background color, and persistence operations (save/export). Note: Document is a format-agnostic in-memory DOM model. It does not implement format-specific persistence itself — the Save/Export methods are virtual and expected to be implemented by concrete services (for example, DocumentServices, WordXmlDocument or the VDocs façade). Consumers who need to create and persist documents should typically use those service classes rather than calling Save on this base class directly.

Examples

csharp
1// Basic usage: create a document, add a section and paragraph, then save
2var doc = new Document();
3
4// Add a section (a section contains pages, headers, footers, etc.)
5var section = doc.AddSection();
6
7// Add a paragraph to the section and append text
8var paragraph = section.AddParagraph();
9paragraph.AddText("Hello, World!");
10
11// Persist the document using the default Save implementation (override required in concrete implementations)
12doc.Save("output.docx");
13

Constructors

Document()

Initializes a new, empty instance. Document

Document(string filePath)

Initializes a new instance from an existing file. Document

Properties

BackgroundColor

Gets or sets the background color of the document pages.

When set, this value is applied at the document level and mapped to the corresponding background representation in the target format (for example, WordprocessingML page background).

DocumentStyles

Gets or sets the collection of styles associated with this document.

This property provides access to document-level styles, including paragraph styles, character styles, and theme definitions.

Sections

Gets the collection of sections contained in this document.

Each section represents a logical division of the document and may define its own page layout, margins, headers, and footers.

Methods

Creates and adds a new section to the document.

Exports the document to the specified file format.

Gets the currently active theme of the document.

Returns the Document value.

Saves the document using the default persistence mechanism.

Performs the Save As HTML operation.

Performs the Save As Pdf operation.

Performs the Save As Word operation.

Sets the active theme for the document by name.