- #Word rich text content control unbold how to#
- #Word rich text content control unbold code#
- #Word rich text content control unbold windows#
RTFRowDefinition rd = new RTFRowDefinition( 88, RTFAlignment.TopLeft, The format resets to default after each append, unless enclosed within a using FormatLock(sb.FormatLock()) // Padding is ignored // Create row definition Using the codeĬreate a new RTFBuilder, and simply append text in a similar fashion to StringBuilder usage.Īdd formatting calls where necessary, prior to appending text. There are ways around prickly specifications when you just want to perform a subset of functions to get the job done.
#Word rich text content control unbold code#
Generally, RTF code from RichTextBox controls can be merged but Rich Text pasted from MS Word may cause problems when merging. Because of its (and my) limited knowledge of the RTF specification, there are limitations when merging RTF documents. The RTF specification is reasonably large, and this utility uses just a small part of the specification to get the job done. You can rapidly develop your code initially with StringBuilder, and convert to the usage of Rich Text by replacing the initialization code with that of an RtfBuilder. It will output RTF when ToString() is Called. The beauty of RtfBuilder is in the fact that it can be used interchangeably in place of StringBuilder. RtfBuilder is based on the StringBuilder class design. RtfBuilder was the fruition of many hours of learning RTF specification and tinkering. The required learning curve for programmatic generation of RTF using the TextControl API was not insignificant. I also didn't like the size of the redistributable(s), and the difficulties of distributing the control with a small ClickOnce application, for example. TextControl allows display, editing, and programmatic generation of RTF, but was out of my price range and requirements. Anyone who has worked with the a RichTextBox and RTF tables will know what I mean.Īfter searching all over the net - Nada, apart from commercial controls - I was prepared to pay a couple of hundred dollars for such a utility, if it existed. The crunch came when trying to create tables. Programmatic manipulation of RTF within a RichTextBox was my first attempt, and I had it working to a point. If, however, you need to build up a simple rich text with font style, font, font size, font colour, back colour, tables, and insert images and merge RTF documents, then this little utility class ( RTFBuilder) may help you. Parsing Rich Text is beyond the scope of this article.
#Word rich text content control unbold windows#
Display of Rich Text is based on the RTF specification (an archaic format dating way back to early Windows 3.0). Rich Text is ubiquitous in Windows Forms applications, yet notoriously hard to manipulate programmatically. Say, as simple and easy as StringBuilder. I really needed something simple and fast. I required tables, colour, font size, image insertion, and the ability to merge RTF documents preserving all the above formatting. Surely, there was something out there that would allow RTF generation. I expected it to be a relatively easy task.
#Word rich text content control unbold how to#
Manipulating Rich Text (RTF) - how to do it?