DocxText class
A styled text run within a paragraph.
Basic
DocxText('Hello')
Styled
DocxText.bold('Important')
DocxText.italic('Emphasis')
DocxText('Custom', color: DocxColor.red, fontSize: 14)
DocxText('Brand', color: DocxColor('#4285F4'))
- Inheritance
-
- Object
- DocxNode
- DocxInline
- DocxText
Constructors
-
DocxText(String content, {DocxFontWeight fontWeight = DocxFontWeight.normal, DocxFontStyle fontStyle = DocxFontStyle.normal, List<
DocxTextDecoration> decorations = const [], DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? themeColor, String? themeTint, String? themeShade, String? themeFill, String? themeFillTint, String? themeFillShade, String? fontFamily, DocxFont? fonts, double? characterSpacing, String? href, bool isSuperscript = false, bool isSubscript = false, bool isAllCaps = false, bool isSmallCaps = false, bool isDoubleStrike = false, bool isOutline = false, bool isShadow = false, bool isEmboss = false, bool isImprint = false, DocxBorderSide? textBorder, String? id}) -
const
- DocxText.allCaps(String content, {double? fontSize, String? fontFamily, DocxFont? fonts, String? shadingFill, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
ALL CAPS text.
const
- DocxText.bold(String content, {DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Bold text.
const
- DocxText.boldItalic(String content, {DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Bold and italic text.
const
- DocxText.code(String content, {double? fontSize, String? shadingFill, DocxColor? color, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Inline code text.
const
- DocxText.highlighted(String content, {DocxHighlight highlight = DocxHighlight.yellow, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, DocxColor? color = DocxColor.black, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Highlighted text.
const
- DocxText.italic(String content, {DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Italic text.
const
- DocxText.link(String content, {required String? href, double? fontSize, String? fontFamily, DocxFont? fonts, String? shadingFill, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Hyperlink text.
const
- DocxText.smallCaps(String content, {double? fontSize, String? fontFamily, DocxFont? fonts, String? shadingFill, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Small Caps text.
const
- DocxText.strike(String content, {DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Strikethrough text.
const
- DocxText.subscript(String content, {double? fontSize, String? shadingFill, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Subscript text (e.g., H₂O).
const
- DocxText.superscript(String content, {double? fontSize, String? shadingFill, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Superscript text (e.g., x²).
const
- DocxText.underline(String content, {DocxColor? color, DocxHighlight highlight = DocxHighlight.none, String? shadingFill, double? fontSize, String? fontFamily, DocxFont? fonts, String? themeFill, String? themeFillTint, String? themeFillShade, String? id})
-
Underlined text.
const
Properties
- characterSpacing → double?
-
final
- color → DocxColor?
-
final
- content → String
-
final
- decoration → DocxTextDecoration
-
no setter
-
decorations
→ List<
DocxTextDecoration> -
final
- effectiveColorHex → String?
-
no setter
- fontFamily → String?
-
Legacy font family (single string). Use fonts for granular control.
final
- fonts → DocxFont?
-
granular font properties.
final
- fontSize → double?
-
final
- fontStyle → DocxFontStyle
-
final
- fontWeight → DocxFontWeight
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlight → DocxHighlight
-
final
- href → String?
-
final
- id → String?
-
Unique identifier for this node (for debugging/tracking).
finalinherited
- isAllCaps → bool
-
final
- isBold → bool
-
no setter
- isDoubleStrike → bool
-
final
- isEmboss → bool
-
final
- isImprint → bool
-
final
- isItalic → bool
-
no setter
- isLink → bool
-
no setter
- isOutline → bool
-
final
- isShadow → bool
-
final
- isSmallCaps → bool
-
final
- isStrike → bool
-
no setter
- isSubscript → bool
-
final
- isSuperscript → bool
-
final
- isUnderline → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadingFill → String?
-
final
- textBorder → DocxBorderSide?
-
Text border (box around text), from w:bdr element
final
- themeColor → String?
-
Theme color reference (e.g. 'accent1').
final
- themeFill → String?
-
Theme fill (shading) for background.
final
- themeFillShade → String?
-
final
- themeFillTint → String?
-
final
- themeShade → String?
-
Theme color shade.
final
- themeTint → String?
-
Theme color tint.
final
Methods
-
accept(
DocxVisitor visitor) → void -
Accepts a visitor for traversing the AST.
override
-
buildXml(
XmlBuilder builder) → void -
Converts this node to its XML representation.
override
-
copyWith(
{String? content, DocxFontWeight? fontWeight, DocxFontStyle? fontStyle, List< DocxTextDecoration> ? decorations, DocxColor? color, DocxHighlight? highlight, String? shadingFill, double? fontSize, String? themeColor, String? themeTint, String? themeShade, String? themeFill, String? themeFillTint, String? themeFillShade, String? fontFamily, DocxFont? fonts, double? characterSpacing, String? href, bool? isSuperscript, bool? isSubscript, bool? isAllCaps, bool? isSmallCaps, bool? isDoubleStrike, bool? isOutline, bool? isShadow, bool? isEmboss, bool? isImprint, DocxBorderSide? textBorder}) → DocxText -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited