Click here to Skip to main content
12,690,866 members (32,801 online)
Click here to Skip to main content

Tagged as

Stats

971.3K views
29.5K downloads
611 bookmarked
Posted

Writing Your Own RTF Converter

, 1 Aug 2013 CPOL
An article on how to write a custom RTF parser and converter.
RtfConverter_SourceCode
bin
Debug
Release
Itenso.Rtf.Converter.Html.dll
Itenso.Rtf.Converter.Xml.dll
Itenso.Rtf.Interpreter.dll
Itenso.Rtf.Parser.dll
Itenso.Sys.dll
log4net.dll
nunit-console-runner.dll
nunit.core.dll
nunit.framework.dll
nunit.util.dll
Rtf2Html.exe
Rtf2Raw.exe
Rtf2Xml.exe
RtfInterpreterTests.exe
RtfParserTests.exe
RtfWindows.exe
RtfWinForms.exe
Converter
Html
Properties
Xml
Properties
docu
Word2007RTFSpec9.pdf
ext
log4net.dll
nunit-console-runner.dll
nunit.core.dll
nunit.framework.dll
nunit.util.dll
Interpreter
Converter
Image
Text
Interpreter
Model
Properties
Support
InterpreterTests
Properties
RtfInterpreterTest
RtfInterpreterTest_0.rtf
RtfInterpreterTest_1.rtf
RtfInterpreterTest_10.rtf
RtfInterpreterTest_11.rtf
RtfInterpreterTest_12.rtf
RtfInterpreterTest_13.rtf
RtfInterpreterTest_14.rtf
RtfInterpreterTest_15.rtf
RtfInterpreterTest_16.rtf
RtfInterpreterTest_17.rtf
RtfInterpreterTest_18.rtf
RtfInterpreterTest_19.rtf
RtfInterpreterTest_2.rtf
RtfInterpreterTest_20.rtf
RtfInterpreterTest_21.rtf
RtfInterpreterTest_22.rtf
RtfInterpreterTest_23.rtf
RtfInterpreterTest_3.rtf
RtfInterpreterTest_4.rtf
RtfInterpreterTest_4.rtf.jpg
RtfInterpreterTest_4.rtf.jpg.hex
RtfInterpreterTest_5.rtf
RtfInterpreterTest_5.rtf.png
RtfInterpreterTest_5.rtf.png.hex
RtfInterpreterTest_6.rtf
RtfInterpreterTest_6.rtf.wmf
RtfInterpreterTest_6.rtf.wmf.hex
RtfInterpreterTest_7.rtf
RtfInterpreterTest_7.rtf.emf
RtfInterpreterTest_7.rtf.emf.hex
RtfInterpreterTest_8.rtf
RtfInterpreterTest_8.rtf.wmf
RtfInterpreterTest_8.rtf.wmf.hex
RtfInterpreterTest_9.rtf
RtfInterpreterTest_fail_0.rtf
RtfInterpreterTest_fail_1.rtf
RtfInterpreterTest_fail_2.rtf
RtfInterpreterTest_fail_3.rtf
RtfInterpreterTest_fail_4.rtf
keys
ItensoRtfConverter.snk
Parser
Model
Parser
Properties
Support
ParserTests
Properties
RtfParserTest
minimal.rtf
RtfParserTest_0.rtf
RtfParserTest_1.rtf
RtfParserTest_2.rtf
RtfParserTest_3.rtf
RtfParserTest_4.rtf
RtfParserTest_5.rtf
RtfParserTest_6.rtf
RtfParserTest_7.rtf
RtfParserTest_8.rtf
RtfParserTest_fail_0.rtf
RtfParserTest_fail_1.rtf
RtfParserTest_fail_2.rtf
RtfParserTest_fail_3.rtf
RtfParserTest_fail_4.rtf
RtfParserTest_fail_5.rtf
RtfParserTest_fail_6.rtf
Rtf2Html
Properties
Rtf2Raw
Properties
Rtf2Xml
Properties
RtfWindows
Properties
RtfWinForms
DefaultText.rtf
Properties
Sys
Application
Collection
Logging
Properties
Test
Rtf2Xml
Properties
bin
Release
Itenso.Rtf.Converter.Html.dll
Itenso.Rtf.Converter.Xml.dll
Itenso.Rtf.Interpreter.dll
Itenso.Rtf.Parser.dll
Itenso.Sys.dll
log4net.dll
nunit-console-runner.dll
nunit.core.dll
nunit.framework.dll
nunit.util.dll
Rtf2Html.exe
Rtf2Raw.exe
Rtf2Xml.exe
RtfInterpreterTests.exe
RtfParserTests.exe
RtfWindows.exe
RtfWinForms.exe
Converter
Html
Properties
Xml
Properties
docu
Word2007RTFSpec9.pdf
ext
log4net.dll
nunit-console-runner.dll
nunit.core.dll
nunit.framework.dll
nunit.util.dll
Interpreter
Converter
Image
Text
Interpreter
Model
Properties
Support
InterpreterTests
Properties
RtfInterpreterTest
RtfInterpreterTest_0.rtf
RtfInterpreterTest_1.rtf
RtfInterpreterTest_10.rtf
RtfInterpreterTest_11.rtf
RtfInterpreterTest_12.rtf
RtfInterpreterTest_13.rtf
RtfInterpreterTest_14.rtf
RtfInterpreterTest_15.rtf
RtfInterpreterTest_16.rtf
RtfInterpreterTest_17.rtf
RtfInterpreterTest_18.rtf
RtfInterpreterTest_19.rtf
RtfInterpreterTest_2.rtf
RtfInterpreterTest_20.rtf
RtfInterpreterTest_21.rtf
RtfInterpreterTest_22.rtf
RtfInterpreterTest_23.rtf
RtfInterpreterTest_3.rtf
RtfInterpreterTest_4.rtf
RtfInterpreterTest_4.rtf.jpg
RtfInterpreterTest_4.rtf.jpg.hex
RtfInterpreterTest_5.rtf
RtfInterpreterTest_5.rtf.png
RtfInterpreterTest_5.rtf.png.hex
RtfInterpreterTest_6.rtf
RtfInterpreterTest_6.rtf.wmf
RtfInterpreterTest_6.rtf.wmf.hex
RtfInterpreterTest_7.rtf
RtfInterpreterTest_7.rtf.emf
RtfInterpreterTest_7.rtf.emf.hex
RtfInterpreterTest_8.rtf
RtfInterpreterTest_8.rtf.wmf
RtfInterpreterTest_8.rtf.wmf.hex
RtfInterpreterTest_9.rtf
RtfInterpreterTest_fail_0.rtf
RtfInterpreterTest_fail_1.rtf
RtfInterpreterTest_fail_2.rtf
RtfInterpreterTest_fail_3.rtf
RtfInterpreterTest_fail_4.rtf
keys
ItensoRtfConverter.snk
Parser
Model
Parser
Properties
Support
ParserTests
Properties
RtfParserTest
minimal.rtf
RtfParserTest_0.rtf
RtfParserTest_1.rtf
RtfParserTest_2.rtf
RtfParserTest_3.rtf
RtfParserTest_4.rtf
RtfParserTest_5.rtf
RtfParserTest_6.rtf
RtfParserTest_7.rtf
RtfParserTest_8.rtf
RtfParserTest_fail_0.rtf
RtfParserTest_fail_1.rtf
RtfParserTest_fail_2.rtf
RtfParserTest_fail_3.rtf
RtfParserTest_fail_4.rtf
RtfParserTest_fail_5.rtf
RtfParserTest_fail_6.rtf
Rtf2Html
Properties
Rtf2Raw
Properties
RtfWindows
Properties
RtfWinForms
DefaultText.rtf
Properties
Sys
Application
Collection
Logging
Properties
Test
Rtf2Html2010.suo
Rtf2Raw2010.suo
Rtf2Xml2010.suo
RtfInterpreter2010.suo
RtfParser2010.suo
RtfWindows2010.suo
RtfWinForms2010.suo
// -- FILE ------------------------------------------------------------------
// name       : Strings.cs
// project    : RTF Framelet
// created    : Jani Giannoudis - 2009.02.19
// language   : c#
// environment: .NET 3.5
// copyright  : (c) 2004-2010 by Itenso GmbH, Switzerland
// --------------------------------------------------------------------------
using System.Resources;
using Itenso.Sys;

namespace Itenso.Rtf
{

	// ------------------------------------------------------------------------
	/// <summary>Provides strongly typed resource access for this namespace.</summary>
	internal sealed class Strings : StringsBase
	{

		// ----------------------------------------------------------------------
		public static string ColorTableUnsupportedText( string text )
		{
			return Format( inst.GetString( "ColorTableUnsupportedText" ), text );
		} // ColorTableUnsupportedText

		// ----------------------------------------------------------------------
		public static string DuplicateFont( string fontId )
		{
			return Format( inst.GetString( "DuplicateFont" ), fontId );
		} // DuplicateFont

		// ----------------------------------------------------------------------
		public static string EmptyDocument
		{
			get { return inst.GetString( "EmptyDocument" ); }
		} // EmptyDocument

		// ----------------------------------------------------------------------
		public static string MissingDocumentStartTag
		{
			get { return inst.GetString( "MissingDocumentStartTag" ); }
		} // MissingDocumentStartTag

		// ----------------------------------------------------------------------
		public static string InvalidDocumentStartTag( string expectedTag )
		{
			return Format( inst.GetString( "InvalidDocumentStartTag" ), expectedTag );
		} // InvalidDocumentStartTag

		// ----------------------------------------------------------------------
		public static string MissingRtfVersion
		{
			get { return inst.GetString( "MissingRtfVersion" ); }
		} // MissingRtfVersion

		// ----------------------------------------------------------------------
		public static string InvalidInitTagState( string tag )
		{
			return Format( inst.GetString( "InvalidInitTagState" ), tag );
		} // InvalidInitTagState

		// ----------------------------------------------------------------------
		public static string UndefinedFont( string fontId )
		{
			return Format( inst.GetString( "UndefinedFont" ), fontId );
		} // UndefinedFont

		// ----------------------------------------------------------------------
		public static string InvalidFontSize( int fontSize )
		{
			return Format( inst.GetString( "InvalidFontSize" ), fontSize );
		} // InvalidFontSize

		// ----------------------------------------------------------------------
		public static string UndefinedColor( int colorIndex )
		{
			return Format( inst.GetString( "UndefinedColor" ), colorIndex );
		} // UndefinedColor

		// ----------------------------------------------------------------------
		public static string InvalidInitGroupState( string group )
		{
			return Format( inst.GetString( "InvalidInitGroupState" ), group );
		} // InvalidInitGroupState

		// ----------------------------------------------------------------------
		public static string InvalidGeneratorGroup( string group )
		{
			return Format( inst.GetString( "InvalidGeneratorGroup" ), group );
		} // InvalidGeneratorGroup

		// ----------------------------------------------------------------------
		public static string InvalidInitTextState( string text )
		{
			return Format( inst.GetString( "InvalidInitTextState" ), text );
		} // InvalidInitTextState	

		// ----------------------------------------------------------------------
		public static string InvalidDefaultFont( string fontId, string allowedFontIds )
		{
			return Format( inst.GetString( "InvalidDefaultFont" ), fontId, allowedFontIds );
		} // InvalidDefaultFont

		// ----------------------------------------------------------------------
		public static string InvalidTextContextState
		{
			get { return inst.GetString( "InvalidTextContextState" ); }
		} // InvalidTextContextState

		// ----------------------------------------------------------------------
		public static string UnsupportedRtfVersion( int version )
		{
			return Format( inst.GetString( "UnsupportedRtfVersion" ), version );
		} // UnsupportedRtfVersion

		// ----------------------------------------------------------------------
		public static string ImageFormatText
		{
			get { return inst.GetString( "ImageFormatText" ); }
		} // ImageFormatText

		// ----------------------------------------------------------------------
		public static string LogBeginDocument
		{
			get { return inst.GetString( "LogBeginDocument" ); }
		} // LogBeginDocument

		// ----------------------------------------------------------------------
		public static string LogEndDocument
		{
			get { return inst.GetString( "LogEndDocument" ); }
		} // LogEndDocument

		// ----------------------------------------------------------------------
		public static string LogInsertBreak
		{
			get { return inst.GetString( "LogInsertBreak" ); }
		} // LogInsertBreak
		
		// ----------------------------------------------------------------------
		public static string LogInsertChar
		{
			get { return inst.GetString( "LogInsertChar" ); }
		} // LogInsertChar
		
		// ----------------------------------------------------------------------
		public static string LogInsertImage
		{
			get { return inst.GetString( "LogInsertImage" ); }
		} // LogInsertImage
		
		// ----------------------------------------------------------------------
		public static string LogInsertText
		{
			get { return inst.GetString( "LogInsertText" ); }
		} // LogInsertText
		
		// ----------------------------------------------------------------------
		public static string LogOverflowText
		{
			get { return inst.GetString( "LogOverflowText" ); }
		} // LogOverflowText

		// ----------------------------------------------------------------------
		public static string InvalidColor( int color )
		{
			return Format( inst.GetString( "InvalidColor" ), color );
		} // InvalidColor

		// ----------------------------------------------------------------------
		public static string InvalidCharacterSet( int charSet )
		{
			return Format( inst.GetString( "InvalidCharacterSet" ), charSet );
		} // InvalidCharacterSet

		// ----------------------------------------------------------------------
		public static string InvalidCodePage( int codePage )
		{
			return Format( inst.GetString( "InvalidCodePage" ), codePage );
		} // InvalidCodePage

		// ----------------------------------------------------------------------
		public static string FontSizeOutOfRange( int fontSize )
		{
			return Format( inst.GetString( "FontSizeOutOfRange" ), fontSize );
		} // FontSizeOutOfRange

		// ----------------------------------------------------------------------
		public static string InvalidImageWidth( int width )
		{
			return Format( inst.GetString( "InvalidImageWidth" ), width );
		} // InvalidImageWidth

		// ----------------------------------------------------------------------
		public static string InvalidImageHeight( int height )
		{
			return Format( inst.GetString( "InvalidImageHeight" ), height );
		} // InvalidImageHeight

		// ----------------------------------------------------------------------
		public static string InvalidImageDesiredHeight( int width )
		{
			return Format( inst.GetString( "InvalidImageDesiredHeight" ), width );
		} // InvalidImageDesiredHeight

		// ----------------------------------------------------------------------
		public static string InvalidImageDesiredWidth( int height )
		{
			return Format( inst.GetString( "InvalidImageDesiredWidth" ), height );
		} // InvalidImageDesiredWidth

		// ----------------------------------------------------------------------
		public static string InvalidImageScaleWidth( int scaleWidth )
		{
			return Format( inst.GetString( "InvalidImageScaleWidth" ), scaleWidth );
		} // InvalidImageScaleWidth

		// ----------------------------------------------------------------------
		public static string InvalidImageScaleHeight( int scaleHeight )
		{
			return Format( inst.GetString( "InvalidImageScaleHeight" ), scaleHeight );
		} // InvalidImageScaleHeight

		// ----------------------------------------------------------------------
		// members
		private static readonly ResourceManager inst = NewInst( typeof( Strings ) );

	} // class Strings

} // namespace Itenso.Rtf
// -- 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jani Giannoudis
Software Developer (Senior)
Switzerland Switzerland
Jani is Co-founder of Meerazo.com, a free service which allows to share resources like locations, things, persons and their services in a cooperating group of people.

You may also be interested in...

Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170117.1 | Last Updated 1 Aug 2013
Article Copyright 2008 by Jani Giannoudis
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid