<p>In a C# console app I have the need to extract the text from an RTF string, add some more text to it, and then convert it back into RTF.  I have been able to do this using the System.Windows.Forms.RichTextBox class, but I find it a bit odd to use a Forms control in a non-Forms app.  Any better way to do this?</p>

[{'answer_id': 22350, 'author': 'samjudson', 'author_id': 1908, 'author_profile': 'https://Stackoverflow.com/users/1908', 'pm_score': 0, 'selected': False, 'text': "<p>It depends on what you mean by 'better'. You are already using the simplest and easiest way of doing it.</p>\n"}, {'answer_id': 22435, 'author': 'seanyboy', 'author_id': 1726, 'author_profile': 'https://Stackoverflow.com/users/1726', 'pm_score': 1, 'selected': False, 'text': '<p>Doing anything with RTF is pretty difficult unless you\'re using the windows forms. As stated above, using forms is the easiest way to go.</p>\n\n<p>You could write something yourself, but the RTF spec is pretty complicated.<br>\n<a href="http://www.biblioscape.com/rtf15_spec.htm" rel="nofollow noreferrer">http://www.biblioscape.com/rtf15_spec.htm</a></p>\n\n<p>Or you could use a conversion DLL / ActiveX object of which there is a large number available. \n<a href="http://www.sautinsoft.com/" rel="nofollow noreferrer">http://www.sautinsoft.com/</a></p>\n\n<p>Or - If you\'re doing this from Linux, there are also tools available. A cursory glance throws up UnRTF \n<a href="http://www.gnu.org/software/unrtf/unrtf.html" rel="nofollow noreferrer">http://www.gnu.org/software/unrtf/unrtf.html</a></p>\n\n<p>I haven\'t included stuff to turn text back to RTF because I think the RTF specification treats and formats text correctly. </p>\n'}, {'answer_id': 22446, 'author': 'Svend', 'author_id': 2491, 'author_profile': 'https://Stackoverflow.com/users/2491', 'pm_score': 1, 'selected': False, 'text': '<p>I think you should just shake this feeling of "odd". There\'s nothing odd about it.</p>\n'}, {'answer_id': 1338568, 'author': 'AMissico', 'author_id': 163921, 'author_profile': 'https://Stackoverflow.com/users/163921', 'pm_score': 0, 'selected': False, 'text': '<p>There is nothing wrong with using an user-interface control in a console application or even in a web application. The Windows controls are part of the .NET Framework, might as well use them. These controls do not need to be hosted in "forms" in order to work.</p>\n\n<p>Reinventing the wheel, using DLL/ActiveX/OCX, and using Linux are simply not practical answers to your question. The better way is...do what you know. There is actually a performance and maintainence benefit to using existing framework methods then using the suggested alternatives.</p>\n'}]
['https://Stackoverflow.com/questions/22346', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/324/']