VegaRise.NET
Back to DOM

ParagraphClass

Definition

Namespace
DOM.Elements.TextElements
Assembly
DOM.dll

Represents a paragraph within the document model.

Remarks

A is a fundamental block-level container that groups inline content such as text runs, images, and shapes into a single logical unit. It corresponds to a <w:p> element in WordprocessingML and to <p> in HTML. Paragraph Paragraphs are always added to a container (document, section, header, footer, or table cell) via methods like and can be styled using to control alignment, indentation, spacing, borders, pagination, and East-Asian typographic behaviour. AddParagraph() ParagraphStyle Inline content is added with,, and . The paragraph participates in layout as a single block; line breaking occurs inside the paragraph based on its width and style. AddText(string) AddImage(IImage) AddShape(IShape)

Examples

csharp
1// 1. Simple paragraph with text
2var doc = new VDocs();
3var p = doc.AddParagraph();
4p.AddText("Hello, paragraph!");
5
csharp
1// 2. Paragraph with multiple styled runs
2var p = doc.AddParagraph();
3p.AddText("Important: ").Style = new TextStyle
4{
5 Font = new Font
6 {
7 Latin = new FontPart { FontName = "Calibri", Size = new FontSize(12), IsBold = true },
8 Color = Color.Red,
9 }
10};
11p.AddText("Please read the safety instructions.");
12
csharp
1// 3. Paragraph with a ParagraphStyle
2var p = doc.AddParagraph();
3p.AddText("This paragraph is indented and has extra spacing.");
4p.Style = new ParagraphStyle
5{
6 Indent = new ParagraphIndentation
7 {
8 Left = new DocumentUnit(0.5, Units.inch),
9 FirstLine = new DocumentUnit(0.25, Units.inch),
10 },
11 SpacingBetweenLines = new Spacing { Before = 6, After = 6, Line = 1.15 }
12};
13
csharp
1// 4. Paragraph with inline image
2var p = doc.AddParagraph();
3p.AddText("Company logo: ");
4p.AddImage("logo.png").SetDimensions(60, 30, Units.pt);
5

Properties

Gets or sets the paragraph-level style applied to this paragraph.

The style affects the entire paragraph block, as opposed to character-level styling which is applied per text run through . Style

Methods

Adds an image to the paragraph's content flow.

Adds a vector or drawing shape to the paragraph.

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.