VDocs.NET
HomeAPI Reference
Back to VDocs

Vega.VDocs

Namespace: Vega

Concrete implementation that delegates actual document operations to an internalinstance created or loaded by the configured document services.

This class acts as a façade around the underlying XML-based document services and provides convenience methods for common document operations such as images, paragraphs, sections and persistence. It also exposes export helpers (HTML and PDF) that delegate to the configured export services. License validation is performed before operations that persist or export content.

63 members

Constructors

VDocs

2 overloads
VDocs()

Initializes a new, emptyusing the default document services. The underlying document is created via the XML document service.

VDocs(string filePath)

Opens an existing document fromusing the XML document service.

Parameters

filePath
File path of the document to open.

Properties

BackgroundColor

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.

Children

Gets or sets the direct children elements of this top-level document object. Setting this property delegates to the underlying document's children collection.

DocumentGrid

Gets or sets the document grid settings used for character/line layout.

DocumentStylesIDocumentStyles

Explicit interface implementation for. Left unimplemented intentionally — callers should use the public style accessors on the underlying document.

Footers

Gets or sets the document footer. Delegates to the underlying document instance.

Headers

Gets or sets the document header. Delegates to the underlying document instance.

Images

Gets the images contained in the document.

Index

Gets the index of this element in its parent's child collection.

LicensePathLicenseManager

Optional path to a license file. When set, methods that persist or export will validate the license using.

PageColumns

Gets or sets the column settings for the document sections.

Pages

Gets the pages contained by the document.

PageSettings

Gets or sets page setup options for the document (size, margins, orientation). Delegates to the underlying document instance.

Paragraphs

Gets the paragraphs contained in the document.

ParentIParentElement

Returns the parent element. For the top-level document this instance acts as its own parent for child elements that require anreference.

Paths

Gets the SVG paths contained in the document.

RightToLeftLayout

Gets or sets whether the document layout is right-to-left.

SectionBreakTypeIDocumentSection

Gets or sets the section break type for this document when accessed through theinterface.

This is an explicit interface implementation and delegates directly to the underlying document instance.

Sections

Gets the top-level sections of the document.

Shapes

Gets the shapes contained in the document.

Status

Status of this document element (New, Updated, Deleted, etc.).

Tables

Gets the tables contained in the document.

TextFlowDirection

Gets or sets the text flow direction used by the document (LTR/RTL).

Texts

Gets the text elements contained in the document.

VerticalTextAlignmentOnPage

Gets or sets vertical alignment of text on the page.

Methods

AddChild

AddChild(IElement[] children)

Adds one or more child elements to the document.

Parameters

children
Elements to add as children.

AddImage

3 overloads
IImage AddImage(IImage image)

Adds an image element to the document.

Parameters

image
Image element to add.

Returns

IImage

The addedinstance.

IImage AddImage(Stream imageStream)

Adds an image to the document from a stream.

Parameters

imageStream
Stream containing image data.

Returns

IImage

The createdinstance.

IImage AddImage(string imagePath)

Adds an image to the document from a file path.

Parameters

imagePath
Path to the image file to add.

Returns

IImage

The createdinstance.

AddParagraph

IParagraph AddParagraph(IParagraph paragraph)

Adds a paragraph to the document. Ifis null, the implementation may create a new empty paragraph.

Parameters

paragraph
Optional paragraph to add.

Returns

IParagraph

The addedinstance.

AddPath

ISVGPath AddPath(ISVGPath path)

Adds an SVG path element to the document.

Parameters

path
Path element to add.

Returns

ISVGPath

The addedinstance.

AddSection

2 overloads
IDocumentSection AddSection

Adds and returns a new section in the document.

Returns

IDocumentSection

The newly added.

IDocumentSection AddSection(IDocumentSection documentSection)

Adds the supplied section to the document.

Parameters

documentSection
Section instance to add.

Returns

IDocumentSection

The addedinstance.

AddShape

IShape AddShape(IShape shape)

Adds a shape element to the document.

Parameters

shape
Shape to add.

Returns

IShape

The addedinstance.

AddTable

ITable AddTable(ITable table)

Adds a table to the document.

Parameters

table
Table to add.

Returns

ITable

The addedinstance.

AddText

2 overloads
IText AddText(string text)

Adds a text node with the specified string content to the document.

Parameters

text
Text to add.

Returns

IText

The createdinstance.

IText AddText(IText text)

Adds an existing text element to the document.

Parameters

text
Text element to add.

Returns

IText

The addedinstance.

Clone

IBaseElement Clone

Creates a deep clone of this document element by delegating to the underlying document.

Returns

IBaseElement

A clonedinstance.

Elements``1

T Elements``1

Returns a list of child elements of type.

Returns

T

List of elements of type.

ExportAs

ExportAs(DocumentFileType DestinationFileFormat, string filePath)

Exports the document to the specified file format and path.

Not yet implemented in this façade — callers should use the underlying services or the concrete implementation directly.

Parameters

DestinationFileFormat
Target file format.
filePath
Path where the exported file will be saved.

GetActiveTheme

ITheme GetActiveTheme

Gets the currently active theme for the document.

Returns

ITheme

The activeinstance.

GetChildByIndex``1

T GetChildByIndex``1(int index)

Gets a child element of typeby its index.

Parameters

index
Zero-based index of the child element.

Returns

T

The child element at the given index.

GetHTML

GetHTML

Returns an HTML representation of the document by delegating to the HTML service. Validates license before conversion. If license validation fails a warning is written to the console but the conversion is still delegated to the HTML service.

Returns

HTML string representing the document.

InsertAfter

2 overloads
InsertAfter(IElement sourceElement, IElement[] elementsToInsert)

Inserts elements after the specified source element.

Parameters

sourceElement
Element after which new elements will be inserted.
elementsToInsert
Elements to insert.
InsertAfter(IElement[] elementsToInsert)

Inserts one or more elements after the last child of the document.

If the document already has child elements, the new elements are inserted after the last child. Otherwise, the elements are added as new children.

Parameters

elementsToInsert
Elements to insert.

InsertBefore

2 overloads
InsertBefore(IElement sourceElement, IElement[] elementsToInsert)

Inserts elements before the specified source element.

Parameters

sourceElement
Element before which new elements will be inserted.
elementsToInsert
Elements to insert.
InsertBefore(IElement[] elementsToInsert)

Inserts one or more elements before the first child of the document.

If the document already has child elements, the new elements are inserted before the first child. Otherwise, the elements are added as new children.

Parameters

elementsToInsert
Elements to insert.

InsertChildToIndex

InsertChildToIndex(int index, IElement[] children)

Inserts child elements at the specified child index.

Parameters

index
Index at which to insert child elements.
children
Children to insert.

LogObjectTree

LogObjectTree

Produces a debug-friendly representation of the document object tree.

Returns

A string that describes the object tree.

Remove

Remove

Removes this element from its parent's child collection.

RemoveAllChildren

RemoveAllChildren

Removes all child elements from this document.

RemoveChildren

RemoveChildren(IElement[] children)

Removes the specified child elements from the document.

Parameters

children
Children to remove.

Replace

Replace(IElement newChild)

Replaces this element within the parent collection.

Parameters

newChild
Element that will replace this element.

Save

2 overloads
Save

Persists the current document using the configured XML document service. License validation is performed prior to saving.

Save(string filePath)

Persists the current document to the specified path using the configured XML document service. License validation is performed prior to saving.

Parameters

filePath
Destination path for the saved document.

SaveAsHTML

SaveAsHTML(string filePath)

Saves the document as an HTML file tousing the HTML service. Validates license before saving.

Parameters

filePath
Target file path for the HTML output.

SaveAsPdf

SaveAsPdf(string filePath)

Saves the document as a PDF file tousing the configured PDF service. Validates license before performing the export; if license validation fails a warning is written to the console but the operation is still delegated to the PDF service.

Parameters

filePath
Destination path for the generated PDF file.

SetActiveTheme

SetActiveTheme(string themeName)

Sets the active theme for the document by name.

Parameters

themeName
Name of the theme to activate.

Fields

_document

The underlying document implementation that actually stores elements and state. All IDocument calls are delegated to this instance.

_HTMLDocumentServices

Service used to convert the document to HTML or save as HTML.

_PdfDocumentServices

Service used to save documents as PDF.

_xmlDocument

Service responsible for opening and saving documents in the native XML format.