HtmlForgeX

API Reference

Class

EmailPreformatted

Namespace HtmlForgeX.Email
Assembly HtmlForgeX.Email
Base Element
Implements
ILayoutAware ITextElement<EmailPreformatted> IVisualElement<EmailPreformatted> IRoundable<EmailPreformatted> IRoundable

Represents a preformatted text element (<pre>) for email layouts with email-safe styling. Provides monospace text display ideal for code blocks and formatted text.

Inheritance

Constructors

EmailPreformatted 2 overloads
public EmailPreformatted() #

Initializes a new instance of the EmailPreformatted class.

public EmailPreformatted(String content) #

Initializes a new instance of the EmailPreformatted class with content.

Parameters

content System.String requiredposition: 0
The preformatted content.

Methods

public override Void EvaluateLayout(LayoutContext context) #
Returns: Void

Applies default border radius for preformatted blocks.

Parameters

context HtmlForgeX.Email.LayoutContext requiredposition: 0
Layout evaluation context.
public override String ToString() #
Returns: String

Renders the preformatted text as HTML. Uses table-based layout for better email client compatibility.

public virtual EmailPreformatted WithAlignment(Alignment alignment) #
Returns: EmailPreformatted

Sets the text alignment.

Parameters

alignment HtmlForgeX.Email.Alignment requiredposition: 0
WithBackground 2 overloads
public virtual EmailPreformatted WithBackground(RGBColor color) #
Returns: EmailPreformatted

Sets the background color.

Parameters

color System.String requiredposition: 0
WithBackground(HtmlForgeX.Email.RGBColor color) #

Sets the background color using RGBColor.

Parameters

color HtmlForgeX.Email.RGBColor required
WithBorder 2 overloads
public virtual EmailPreformatted WithBorder(BorderWidth width, String customValue = null) #
Returns: EmailPreformatted

Sets the border width using a predefined size.

Parameters

width HtmlForgeX.Email.BorderWidth requiredposition: 0
customValue System.String = null optionalposition: 1
public virtual EmailPreformatted WithBorder(Boolean enabled) #
Returns: EmailPreformatted

Enables or disables the border on this element.

Parameters

enabled System.Boolean requiredposition: 0
WithBorderColor 2 overloads
public virtual EmailPreformatted WithBorderColor(RGBColor color) #
Returns: EmailPreformatted

Sets the border color.

Parameters

color System.String requiredposition: 0
WithBorderColor(HtmlForgeX.Email.RGBColor color) #

Sets the border color using RGBColor.

Parameters

color HtmlForgeX.Email.RGBColor required
public virtual EmailPreformatted WithBorderRadius(String radius) #
Returns: EmailPreformatted

Sets the border radius.

Parameters

radius System.String requiredposition: 0
WithColor 2 overloads
public virtual EmailPreformatted WithColor(RGBColor color) #
Returns: EmailPreformatted

Sets the text color.

Parameters

color System.String requiredposition: 0
WithColor(HtmlForgeX.Email.RGBColor color) #

Sets the text color using RGBColor.

Parameters

color HtmlForgeX.Email.RGBColor required
public EmailPreformatted WithContent(String content) #
Returns: EmailPreformatted

Sets the preformatted content.

Parameters

content System.String requiredposition: 0
public EmailPreformatted WithDarkTheme() #
Returns: EmailPreformatted

Applies dark code theme styling.

public virtual EmailPreformatted WithFontFamily(String fontFamily) #
Returns: EmailPreformatted

Sets the font family.

Parameters

fontFamily System.String requiredposition: 0
WithFontSize 2 overloads
public virtual EmailPreformatted WithFontSize(EmailFontSize fontSize) #
Returns: EmailPreformatted

Sets the font size.

Parameters

fontSize System.String requiredposition: 0
WithFontSize(HtmlForgeX.Email.EmailFontSize fontSize) #

Sets the font size using predefined values.

Parameters

fontSize HtmlForgeX.Email.EmailFontSize required
WithFontWeight 2 overloads
public virtual EmailPreformatted WithFontWeight(FontWeight fontWeight) #
Returns: EmailPreformatted

Sets the font weight.

Parameters

fontWeight System.String requiredposition: 0
WithFontWeight(HtmlForgeX.Email.FontWeight fontWeight) #

Sets the font weight using predefined values.

Parameters

fontWeight HtmlForgeX.Email.FontWeight required
public EmailPreformatted WithLightTheme() #
Returns: EmailPreformatted

Applies light code theme styling.

public virtual EmailPreformatted WithLineHeight(String lineHeight) #
Returns: EmailPreformatted

Sets the line height.

Parameters

lineHeight System.String requiredposition: 0
WithRounded 2 overloads
public virtual EmailPreformatted WithRounded(Radius radius, String customValue = null) #
Returns: EmailPreformatted

Sets the border radius using a predefined size.

Parameters

radius HtmlForgeX.Email.Radius requiredposition: 0
customValue System.String = null optionalposition: 1
public virtual EmailPreformatted WithRounded() #
Returns: EmailPreformatted

Applies the default border radius (6px) for rounded corners.

public virtual EmailPreformatted WithRoundingMode(RoundingMode mode) #
Returns: EmailPreformatted

Sets the rounding mode for this preformatted block.

Parameters

mode HtmlForgeX.Email.RoundingMode requiredposition: 0
Rounding mode.

Returns

The current instance.

WithTextDecoration 2 overloads
public virtual EmailPreformatted WithTextDecoration(TextDecoration decoration) #
Returns: EmailPreformatted

Sets the text decoration.

Parameters

textDecoration System.String requiredposition: 0
WithTextDecoration(HtmlForgeX.Email.TextDecoration decoration) #

Sets the text decoration using predefined options.

Parameters

decoration HtmlForgeX.Email.TextDecoration required

Properties

public String Content { get; set; } #

Gets or sets the preformatted content.

public virtual String FontFamily { get; set; } #

Gets or sets the font family (defaults to monospace).

public virtual String FontSize { get; set; } #

Gets or sets the font size.

public virtual String LineHeight { get; set; } #

Gets or sets the line height.

public virtual String Color { get; set; } #

Gets or sets the text color.

public virtual String TextAlign { get; set; } #

Gets or sets the text alignment.

public virtual String FontWeight { get; set; } #

Gets or sets the font weight.

public virtual String TextDecoration { get; set; } #

Gets or sets the text decoration.

public virtual String BackgroundColor { get; set; } #

Gets or sets the background color.

public virtual String BorderRadius { get; set; } #

Gets or sets the border radius.

public virtual RoundingMode RoundingMode { get; set; } #

Controls how rounding is applied when no explicit radius is set.

public virtual String BorderColor { get; set; } #

Gets or sets the border color.

public virtual String BorderWidth { get; set; } #

Gets or sets the border width.