[]
        
(Showing Draft Content)

GrapeCity.Documents.Text.TextLayoutSplitter

Class TextLayoutSplitter

Namespace
GrapeCity.Documents.Text
Assembly
GcDocs.Imaging.dll

Helper class for efficient splitting the content of a TextLayout object into multiple portions. May be used to split a long text into multiple pages or columns, including balanced columns (see SplitAndBalance(PageSplitArea[], TextSplitOptions)).

public class TextLayoutSplitter
Inheritance
object
TextLayoutSplitter
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

Constructors

TextLayoutSplitter(TextLayout)

Initializes a new instance of the TextLayoutSplitter class.

public TextLayoutSplitter(TextLayout textLayout)

Parameters

textLayout TextLayout

The source TextLayout after executing PerformLayout(bool).

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

Properties

CurrentLayout

Gets the text layout representing the current portion to render, or null if a split operation has not been performed yet.

public TextLayout CurrentLayout { get; }

Property Value

TextLayout

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

RestLayout

Gets the remaining portion of the original text layout.

public TextLayout RestLayout { get; }

Property Value

TextLayout

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

SplitResult

Gets the result of the last split operation.

public SplitResult SplitResult { get; }

Property Value

SplitResult

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

Methods

Split(TextSplitOptions)

Fits all or the first portion of the original text layout into the current layout bounds.

public TextLayout Split(TextSplitOptions splitOptions)

Parameters

splitOptions TextSplitOptions

Options controlling how to split the text.

Returns

TextLayout

The split portion (the text that fits in the specified bounds and can be rendered), or null if there is nothing more to render.

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);

SplitAndBalance(PageSplitArea[], TextSplitOptions)

Fits all or the first portion of the current text layout into one or more layout areas (such as page columns).

public TextLayout SplitAndBalance(PageSplitArea[] pageAreas, TextSplitOptions splitOptions)

Parameters

pageAreas PageSplitArea[]

An array of additional page areas (e.g. representing 2nd etc columns) that can be used to layout the text.

splitOptions TextSplitOptions

Options controlling how to split the text.

Returns

TextLayout

The split portion (the text that fits in the specified bounds and can be rendered, along with additional areas in pageAreas), or null if there is nothing more to render.

Remarks

This class does not provide any additional functionality, but it streamlines the code rendering a TextLayout onto multiple pages or columns, and ensures optimal performance by keeping allocation of new text layouts to hold the overflow to a minimum.

A typical use of this class to render a long text onto multiple pages would be as follows, provided that 'tl' is a TextLayout instance containing the text to render, with specified available bounds (MaxWidth, MaxHeight), and 'tso' is an instance of TextSplitOptions containing the desired split options:
...
tl.PerformLayout(true);
var tls = new TextLayoutSplitter(tl);
for (var tlPage = tls.Split(tso); tlPage != null; tlPage = tls.Split(to))
  doc.Pages.Add().Graphics.DrawTextLayout(tlPage, PointF.Empty);