VegaRise.NET
HomeAPI Reference
Back to DOM

TextStyleClass

Definition

Namespace
DOM.Styles
Assembly
DOM.dll

Represents character-level styling applied to text runs.

Remarks

aggregates font, color, effects and supplemental settings that control the visual appearance of inline text. Properties are nullable so callers can distinguish between "unspecified" and an explicit value; consumers should apply inheritance and document-default fallback rules when a property is . TextStyle null Text styles are assigned via . Text.Style

Examples

csharp
1// 1. Simple styled text
2var style = new TextStyle
3{
4 Font = new Font { Latin = new FontPart { FontName = "Calibri", Size = 11.0 } }
5};
6
csharp
1// 2. Highlighted warning text
2var style = new TextStyle
3{
4 Font = new Font
5 {
6 Latin = new FontPart { FontName = "Segoe UI", Size = 12.0, IsBold = true },
7 Color = Color.DarkRed
8 },
9 BackgroundColor = Color.Yellow
10};
11
csharp
1// 3. Multilingual text with language preferences
2var style = new TextStyle
3{
4 Font = new Font
5 {
6 Latin = new FontPart { FontName = "Arial", Size = 11.0 },
7 EastAsia = new FontPart { FontName = "Microsoft YaHei", Size = 11.0 },
8 ComplexScriptFont = new FontPart { FontName = "Arial", Size = 11.0 }
9 },
10 Languages = new Languages
11 {
12 Latin = new CultureInfo("en-US"),
13 EastAsia = new CultureInfo("zh-CN"),
14 ComplexScripts = new CultureInfo("ar-SA")
15 }
16};
17
csharp
1// 4. Text with border and text effect
2var style = new TextStyle
3{
4 Border = new BorderStyle { BorderColor = Color.Gray, BorderSize = 1, BorderValue = BorderValues.single },
5 TextEffect = new TextEffect { GradientFill = new Gradient() }
6};
7
csharp
1// 5. Custom width hint for a layout scenario
2var style = new TextStyle { CustomWidth = new DocumentUnit(2.0, Units.inch) };
3
csharp
1// 6. Apply to a text run
2doc.AddParagraph().AddText(new Text("Styled") { Style = new TextStyle { /* ... */ } });
3

Properties

BackgroundColorColor

Gets or sets the background (highlight) color for the text run.

Gets or sets an inline border style applied around the text run.

CustomWidthDocumentUnit

Gets or sets a custom width hint for the text run.

Font

Gets or sets the font formatting to apply to the text run.

Languages

Gets or sets language preferences for the text run.

TextEffect

Gets or sets text effect settings such as shadows, glow or 3D effects.