VegaRise.NET

Quick Start

The snippet below builds a document with a styled paragraph, a table, an image, and a shape, then exports it to Word, PDF, and HTML — all from the same DOM.

C#
1using Vega;
2using Vega.DOM;
3using DOM.Enums;
4
5// 1. Create the document
6using var doc = new VDocs
7{
8 LicensePath = "license.vegalic"
9};
10
11// 2. Add a styled paragraph
12var p = doc.AddParagraph();
13p.AddText("Hello ").Style = new TextStyle
14{
15 Font = new Font
16 {
17 Latin = new FontPart { FontName = "Calibri", Size = new FontSize(14), IsBold = true },
18 Color = Color.DarkBlue,
19 }
20};
21p.AddText("VDocs!");
22
23// 3. Add a table
24var table = new Table(2, 2);
25table[0, 0].AddText("Name");
26table[0, 1].AddText("Value");
27table[1, 0].AddText("Product");
28table[1, 1].AddText("VDocs");
29doc.AddTable(table);
30
31// 4. Add an image
32doc.AddImage("logo.png")
33.SetDimensions(120, 60, Units.pt)
34.SetPosition(50, 50, Units.pt);
35
36// 5. Export to all three formats
37doc.SaveAsWord("Sample.docx");
38doc.SaveAsPdf("Sample.pdf");
39doc.SaveAsHTML("Sample.html");

What's happening here?

  1. 1.`new VDocs()` — Creates an empty document. `LicensePath` is optional.
  2. 2.`AddParagraph()` — Creates and appends a paragraph. Chained `AddText` adds styled runs.
  3. 3.`new Table(rows, cols)` — Creates a 2×2 table. Cells are accessed via `table[row, col]`.
  4. 4.`AddImage(path)` — Loads the image and returns it so you can size/position it.
  5. 5.`SaveAsWord / SaveAsPdf / SaveAsHTML` — Exports the same document to all three formats.

Frequently asked questions

Can I open an existing .docx and re-save it?

Yes — use VDocs.OpenFromWord("input.docx"). See the Word topic for a full example.

Where is the license path applied?

License validation happens inside SaveAs*. Assign LicensePath before calling any save/export method.

How do I reset content and rebuild?

Call doc.RemoveAllChildren() to clear the document body while keeping styles, page setup and settings.

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in