Search Results for

    Show / Hide Table of Contents

    Class AdvancedTextRenderer

    Advanced text renderer is used to perform the following tasks:

    • draw justified text, text with custom line height, text containing html tags;
    • calculate text height, get part of text that does not fit in the display rectangle;
    • get paragraphs, lines, words and char sequence to perform accurate export to such formats as PDF, TXT, RTF
    Inheritance
    System.Object
    AdvancedTextRenderer
    Namespace: FastReport.Utils
    Assembly: FastReport.Base.dll
    Syntax
    public class AdvancedTextRenderer
    Examples

    Here is how one may operate the renderer items:

    foreach (AdvancedTextRenderer.Paragraph paragraph in renderer.Paragraphs)
    {
      foreach (AdvancedTextRenderer.Line line in paragraph.Lines)
      {
        foreach (AdvancedTextRenderer.Word word in line.Words)
        {
          if (renderer.HtmlTags)
          {
            foreach (AdvancedTextRenderer.Run run in word.Runs)
            {
              using (Font f = run.GetFont())
              using (Brush b = run.GetBrush())
              {
                g.DrawString(run.Text, f, b, run.Left, run.Top, renderer.Format);
              }  
            }
          }
          else
          {
            g.DrawString(word.Text, renderer.Font, renderer.Brush, word.Left, word.Top, renderer.Format);
          }
        }
      }
    }

    Constructors

    AdvancedTextRenderer(String, IGraphics, Font, Brush, Pen, RectangleF, StringFormat, HorzAlign, VertAlign, Single, Int32, Single, Boolean, Boolean, Boolean, Boolean, Single, Single, InlineImageCache, Boolean)

    Declaration
    public AdvancedTextRenderer(string text, IGraphics g, Font font, Brush brush, Pen outlinePen, RectangleF rect, StringFormat format, HorzAlign horzAlign, VertAlign vertAlign, float lineHeight, int angle, float widthRatio, bool forceJustify, bool wysiwyg, bool htmlTags, bool pdfMode, float scale, float fontScale, InlineImageCache cache, bool isPrinting = false)
    Parameters
    Type Name Description
    System.String text
    IGraphics g
    Font font
    Brush brush
    Pen outlinePen
    RectangleF rect
    StringFormat format
    HorzAlign horzAlign
    VertAlign vertAlign
    System.Single lineHeight
    System.Int32 angle
    System.Single widthRatio
    System.Boolean forceJustify
    System.Boolean wysiwyg
    System.Boolean htmlTags
    System.Boolean pdfMode
    System.Single scale
    System.Single fontScale
    InlineImageCache cache
    System.Boolean isPrinting

    Properties

    Angle

    Declaration
    public int Angle { get; }
    Property Value
    Type Description
    System.Int32

    Brush

    Declaration
    public Brush Brush { get; }
    Property Value
    Type Description
    Brush

    BrushColor

    Declaration
    public Color BrushColor { get; }
    Property Value
    Type Description
    Color

    Cache

    Declaration
    public InlineImageCache Cache { get; }
    Property Value
    Type Description
    InlineImageCache

    DisplayRect

    Declaration
    public RectangleF DisplayRect { get; }
    Property Value
    Type Description
    RectangleF

    Font

    Declaration
    public Font Font { get; }
    Property Value
    Type Description
    Font

    FontLineHeight

    Declaration
    public float FontLineHeight { get; }
    Property Value
    Type Description
    System.Single

    FontScale

    The scale for font tag

    Declaration
    public float FontScale { get; set; }
    Property Value
    Type Description
    System.Single

    ForceJustify

    Declaration
    public bool ForceJustify { get; }
    Property Value
    Type Description
    System.Boolean

    Format

    Declaration
    public StringFormat Format { get; }
    Property Value
    Type Description
    StringFormat

    Graphics

    Declaration
    public IGraphics Graphics { get; }
    Property Value
    Type Description
    IGraphics

    HasLineHeight

    Declaration
    public bool HasLineHeight { get; }
    Property Value
    Type Description
    System.Boolean

    HorzAlign

    Declaration
    public HorzAlign HorzAlign { get; }
    Property Value
    Type Description
    HorzAlign

    HtmlTags

    Declaration
    public bool HtmlTags { get; }
    Property Value
    Type Description
    System.Boolean

    LineHeight

    Declaration
    public float LineHeight { get; }
    Property Value
    Type Description
    System.Single

    OutlinePen

    Declaration
    public Pen OutlinePen { get; }
    Property Value
    Type Description
    Pen

    Paragraphs

    Declaration
    public List<AdvancedTextRenderer.Paragraph> Paragraphs { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<AdvancedTextRenderer.Paragraph>

    PDFMode

    Declaration
    public bool PDFMode { get; }
    Property Value
    Type Description
    System.Boolean

    RightToLeft

    Declaration
    public bool RightToLeft { get; }
    Property Value
    Type Description
    System.Boolean

    Scale

    Declaration
    public float Scale { get; set; }
    Property Value
    Type Description
    System.Single

    TabOffset

    Declaration
    public float TabOffset { get; }
    Property Value
    Type Description
    System.Single

    TabSize

    Declaration
    public float TabSize { get; }
    Property Value
    Type Description
    System.Single

    VertAlign

    Declaration
    public VertAlign VertAlign { get; }
    Property Value
    Type Description
    VertAlign

    WidthRatio

    Declaration
    public float WidthRatio { get; }
    Property Value
    Type Description
    System.Single

    WordWrap

    Declaration
    public bool WordWrap { get; }
    Property Value
    Type Description
    System.Boolean

    Wysiwyg

    Declaration
    public bool Wysiwyg { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    CalcHeight()

    Declaration
    public float CalcHeight()
    Returns
    Type Description
    System.Single

    CalcHeight(out Int32, out AdvancedTextRenderer.StyleDescriptor)

    Declaration
    public float CalcHeight(out int charsFit, out AdvancedTextRenderer.StyleDescriptor style)
    Parameters
    Type Name Description
    System.Int32 charsFit
    AdvancedTextRenderer.StyleDescriptor style
    Returns
    Type Description
    System.Single

    CalcWidth()

    Declaration
    public float CalcWidth()
    Returns
    Type Description
    System.Single

    Draw()

    Declaration
    public void Draw()
    Back to top © 1998-2025 Copyright Fast Reports Inc.