Vega.VDocs
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 overloadsVDocs()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
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.
Gets or sets the direct children elements of this top-level document object. Setting this property delegates to the underlying document's children collection.
Gets or sets the document grid settings used for character/line layout.
Explicit interface implementation for. Left unimplemented intentionally — callers should use the public style accessors on the underlying document.
Gets or sets the document footer. Delegates to the underlying document instance.
Gets or sets the document header. Delegates to the underlying document instance.
Gets the images contained in the document.
Gets the index of this element in its parent's child collection.
Optional path to a license file. When set, methods that persist or export will validate the license using.
Gets or sets the column settings for the document sections.
Gets the pages contained by the document.
Gets or sets page setup options for the document (size, margins, orientation). Delegates to the underlying document instance.
Gets the paragraphs contained in the document.
Returns the parent element. For the top-level document this instance acts as its own parent for child elements that require anreference.
Gets the SVG paths contained in the document.
Gets or sets whether the document layout is right-to-left.
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.
Gets the top-level sections of the document.
Gets the shapes contained in the document.
Status of this document element (New, Updated, Deleted, etc.).
Gets the tables contained in the document.
Gets or sets the text flow direction used by the document (LTR/RTL).
Gets the text elements contained in the document.
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 overloadsIImage 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 overloadsIDocumentSection AddSectionAdds 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 overloadsIText 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 CloneCreates a deep clone of this document element by delegating to the underlying document.
Returns
IBaseElement
A clonedinstance.
Elements``1
T Elements``1Returns 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 GetActiveThemeGets 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
GetHTMLReturns 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 overloadsInsertAfter(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 overloadsInsertBefore(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
LogObjectTreeProduces a debug-friendly representation of the document object tree.
Returns
A string that describes the object tree.
Remove
RemoveRemoves this element from its parent's child collection.
RemoveAllChildren
RemoveAllChildrenRemoves 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 overloadsSavePersists 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
The underlying document implementation that actually stores elements and state. All IDocument calls are delegated to this instance.
Service used to convert the document to HTML or save as HTML.
Service used to save documents as PDF.
Service responsible for opening and saving documents in the native XML format.