none
Rich Text Content Control RRS feed

  • Question

  • How to use the Rich Text Content or the Plain Text Control of vba in office 2010 to display the following rich text?

    {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}  {\colortbl ;\red255\green255\blue255;\red255\green0\blue0;\red0\green0\blue0;}  \viewkind4\uc1\pard\f0\fs17 This is the \cf1\highlight2\b\fs24 Text\cf3\highlight1\b0  \cf0\highlight0\fs17 in \b Bold \b0 and \ul Underline\ulnone  with\i  Italic  \i0 font\par  }

    Tuesday, April 12, 2011 9:35 AM

Answers

  • Hi rzeylah

    "Rich text" vs. "plain text" in Word's content controls merely means the one supports user formatting and the other does not. It has nothing to do with the RTF file format.

    Word cannot display rich text directly, it needs to convert RTF to its "native" file format. This is only done when pasting RTF from the Clipboard or inserting an RTF file. There is no way to convert rich text mark-up - like you show in your original message - into Word formatting directly.

    If you cannot use the Clipboard or a file then your code will have to do the conversion after the text has been inserted or prior to insertiong (converting from RTF to Word 2010 Open XML, then insert using the InsertXML method).


    Cindy Meister, VSTO/Word MVP
    Thursday, April 14, 2011 1:15 PM
    Moderator

All replies

  • Hi rzeylah,

     

    Thanks for posting in the MSDN Forum.

     

    As far as I know, the Rich Text Content  control or Plain Text Content Control is in Word. Do you want to handle a Word issue?

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 14, 2011 3:16 AM
    Moderator
  • Yes please, this is a word issue. and if the rich text control or the plain text doesn't solve the problem. what do we have alternatives to handle the RTF content and display them on the word. Thanks
    Thursday, April 14, 2011 6:04 AM
  • Hi rzeylah

    "Rich text" vs. "plain text" in Word's content controls merely means the one supports user formatting and the other does not. It has nothing to do with the RTF file format.

    Word cannot display rich text directly, it needs to convert RTF to its "native" file format. This is only done when pasting RTF from the Clipboard or inserting an RTF file. There is no way to convert rich text mark-up - like you show in your original message - into Word formatting directly.

    If you cannot use the Clipboard or a file then your code will have to do the conversion after the text has been inserted or prior to insertiong (converting from RTF to Word 2010 Open XML, then insert using the InsertXML method).


    Cindy Meister, VSTO/Word MVP
    Thursday, April 14, 2011 1:15 PM
    Moderator