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
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
BrushColor
Declaration
public Color BrushColor { get; }
Property Value
Cache
Declaration
public InlineImageCache Cache { get; }
Property Value
DisplayRect
Declaration
public RectangleF DisplayRect { get; }
Property Value
Type |
Description |
RectangleF |
|
Font
Declaration
public Font Font { get; }
Property Value
FontLineHeight
Declaration
public float FontLineHeight { get; }
Property Value
Type |
Description |
System.Single |
|
FontScale
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
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
Paragraphs
Declaration
public List<AdvancedTextRenderer.Paragraph> Paragraphs { get; }
Property Value
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
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
Returns
Type |
Description |
System.Single |
|
CalcWidth()
Declaration
Returns
Type |
Description |
System.Single |
|
Draw()
Declaration