|
// -- FILE ------------------------------------------------------------------
// name : RtfTextBuilder.cs
// project : RTF Framelet
// created : Leon Poyyayil - 2008.05.23
// language : c#
// environment: .NET 2.0
// copyright : (c) 2004-2010 by Itenso GmbH, Switzerland
// --------------------------------------------------------------------------
using System.Text;
using Itenso.Rtf.Support;
namespace Itenso.Rtf.Interpreter
{
// ------------------------------------------------------------------------
public sealed class RtfTextBuilder : RtfElementVisitorBase
{
// ----------------------------------------------------------------------
public RtfTextBuilder()
: base( RtfElementVisitorOrder.DepthFirst )
{
Reset();
} // RtfTextBuilder
// ----------------------------------------------------------------------
public string CombinedText
{
get { return buffer.ToString(); }
} // CombinedText
// ----------------------------------------------------------------------
public void Reset()
{
buffer.Remove( 0, buffer.Length );
} // Reset
// ----------------------------------------------------------------------
protected override void DoVisitText( IRtfText text )
{
buffer.Append( text.Text );
} // DoVisitText
// ----------------------------------------------------------------------
// members
private readonly StringBuilder buffer = new StringBuilder();
} // class RtfTextBuilder
} // namespace Itenso.Rtf.Interpreter
// -- EOF -------------------------------------------------------------------
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
👨 Senior .NET Software Engineer
🚀 My Open Source Projects
-
Time Period Library 👉
GitHub
-
Payroll Engine 👉
GitHub
Feedback and contributions are welcome.