none
How to extract the rich text format string from a rich text box content control? RRS feed

  • Question

  • Hi,

    I'm using VS2008 Professional SP1 and Office 2007 SP3 to develop an Excel workbook that retrieves data from a Word content control, which is a rich text box (RTB). What I want is that the text displayed in the Excel RTB is the same as the text displayed in the Word RTB, including any formatting. I also need to store the rich text string in a database.

    Is there a way to extract the rich text string from the Word RTB content control? If I can do this, then I'll be able to display the text in the Excel workbook and store the string in the database.

    All the best!

    Carlos Mallen

    Thursday, March 8, 2012 11:30 PM

Answers

  • Hi,

    My conclusion then is that it isn't possible to get/set the rich text format string of a rich text box content control. I was looking for a property or function (like the one of the Windows Forms rich text box), but it seems that it doesn't exist. The scope of my question ends here.

    Thanks a lot for your time,

    Carlos Mallen

    Tuesday, March 13, 2012 12:12 AM

All replies

  • Hello Carlos,

    not sure, but when it's a standard .Net RichTextBox Control, it has a .Rtf Property.

    http://msdn.microsoft.com/de-de/library/system.windows.forms.richtextbox_members(v=vs.80).aspx

    There you can Set & Get the RichTextBox inclusive formatting.

    Greets - Helmut


    Helmut Obertanner [http://www.obertanner.de] [http://www.outlooksharp.de]

    Friday, March 9, 2012 9:16 AM
    Answerer
  • Hi Helmut,

    You're right. The .NET RichTextBox control has this property, but I want to get/set the rich text format string of a Word content control.

    Kind regards,

    Carlos Mallen

    Friday, March 9, 2012 3:05 PM
  • Hello Carlos,

    see if that helps:

    http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/b80a689c-6ceb-4974-8c09-a608c9171dbb/

    Greets - Helmut


    Helmut Obertanner [http://www.obertanner.de] [http://www.outlooksharp.de]

    Saturday, March 10, 2012 9:11 AM
    Answerer
  • Hi Helmut,

    If my understanding is correct, the link you posted refers to how to insert an XML string into a Word content control. If this is correct, then I'm afraid it's not what I'm looking for. I need to get/set the rich text format string.

    Thanks for your time,

    Carlos Mallen

    Sunday, March 11, 2012 8:08 PM
  • Could you try using Clipboard? get range of specifinc content control, use copy function and then access windows' clipboard with propoer datatype (RTF)
    Monday, March 12, 2012 9:55 AM
  • Note that when using Clipboard:

    A: Other Clipboard-Content is gone
    B: the the content remains in Clipboard

    So you need to create a proper Backup/Restore Method for the Clipboard

    Greets - Helmut


    Helmut Obertanner [http://www.obertanner.de] [http://www.outlooksharp.de]

    Monday, March 12, 2012 11:31 AM
    Answerer
  • Hi,

    My conclusion then is that it isn't possible to get/set the rich text format string of a rich text box content control. I was looking for a property or function (like the one of the Windows Forms rich text box), but it seems that it doesn't exist. The scope of my question ends here.

    Thanks a lot for your time,

    Carlos Mallen

    Tuesday, March 13, 2012 12:12 AM