locked
How to use rich text box in word templates? RRS feed

  • Question

  • Hi All,

    I am able to create a rich text box in document library but in word template not reflect rich text box in word column(Quick Part),

    attached my custom content type.

    I want to show the rich text column in the Word document template.

    1.In documents library view properties display me correct text in rich text.

    2.But not display in word template, In following is a snap.

    Thanks

    Balaji



    • Edited by BKMore Wednesday, April 18, 2012 6:29 AM
    Tuesday, April 17, 2012 7:21 AM

Answers

  • Hi,

    You can convert the HTML code to RTF by creating a word add-in application in visio studio. The following code might help you.

        Dim reportWebBrowser As New WebBrowser 
        reportWebBrowser.CreateControl() 
        reportWebBrowser.DocumentText = sbHTMLDoc.ToString 
        While reportWebBrowser.DocumentText <> sbHTMLDoc.ToString 
            Application.DoEvents() 
        End While 
        reportWebBrowser.Document.ExecCommand("SelectAll", False, Nothing) 
        reportWebBrowser.Document.ExecCommand("Copy", False, Nothing) 
     
        Dim reportRichTextBox As New RichTextBox 
        reportRichTextBox.Paste() 
        reportRichTextBox.SaveFile(DocumentFileName) 

    Best Regards,

    Sally Tang


    • Edited by Sally Tang Wednesday, April 25, 2012 2:15 AM
    • Proposed as answer by Sally Tang Monday, April 30, 2012 7:54 AM
    • Marked as answer by Sally Tang Monday, May 7, 2012 1:45 AM
    Tuesday, April 24, 2012 8:58 AM

All replies

  • Hi,

    Your issue is similar as this one and I have replied:

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010general/thread/56e4030b-af86-44d7-b021-ccdf31b817c6

    Yes, we can create a rich text column in document library by first creating a site column, and then adding the column to a content type in the document library. Also, show it in Word document properties panel.

    However, it is by design that the rich text and enhanced rich text are not available in document libraries.

    When we create a column of multiple lines of text in a SharePoint list, the options of rich text and enhanced rich text are available. However, it is not the case in a document library.

    Even though we can create a site column of rich text or enhanced rich text in site level, it turns out to be a plain text input box when you add this column to the document library.

    Thank you for your understanding.

    Best Regards,

    Sally Tang

    Wednesday, April 18, 2012 8:49 AM
  • Hi Sally,

    Thanks for reply.

    Whatever you said in your reply i am already done it.but Still give above snap no 2 it reflect a html format.

    I am going to deliver my projects to my client this week.

    Please help me how can i achieve this?

    Thanks

    Balaji

     


    • Edited by BKMore Wednesday, April 18, 2012 9:11 AM
    Wednesday, April 18, 2012 9:02 AM
  • Is it not a viable option for you to remove the rich text boxes and use plain text?  You can then add the styling to the document template instead.

    Paul Turner http://redmanta.co.uk/blog Twitter: @RedMantaUK MCTS:WSS,MOSS,2010 MCITP:2010.
    Please remember to click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

    Wednesday, April 18, 2012 9:08 AM
  • Hi Paul,

    Thanks for reply,

    I don't want to remove rich text in word template,I want to use document library rich text box column in word template.

    My requirement is display document library text same in word template using quick parts documents properties.

    Thanks

    Balaji



    • Edited by BKMore Wednesday, April 18, 2012 9:24 AM
    Wednesday, April 18, 2012 9:14 AM
  • Hi,

    You can convert the HTML code to RTF by creating a word add-in application in visio studio. The following code might help you.

        Dim reportWebBrowser As New WebBrowser 
        reportWebBrowser.CreateControl() 
        reportWebBrowser.DocumentText = sbHTMLDoc.ToString 
        While reportWebBrowser.DocumentText <> sbHTMLDoc.ToString 
            Application.DoEvents() 
        End While 
        reportWebBrowser.Document.ExecCommand("SelectAll", False, Nothing) 
        reportWebBrowser.Document.ExecCommand("Copy", False, Nothing) 
     
        Dim reportRichTextBox As New RichTextBox 
        reportRichTextBox.Paste() 
        reportRichTextBox.SaveFile(DocumentFileName) 

    Best Regards,

    Sally Tang


    • Edited by Sally Tang Wednesday, April 25, 2012 2:15 AM
    • Proposed as answer by Sally Tang Monday, April 30, 2012 7:54 AM
    • Marked as answer by Sally Tang Monday, May 7, 2012 1:45 AM
    Tuesday, April 24, 2012 8:58 AM
  • This problem needs to be fixed. It has been more than 4 years and no progress has been made allowing rich text fields to be displayed in documents using templates.
    There is no reason it should be 'designed' this way, and if it was, there should be the option to show rich text as rich text in the document. If this is undesirable in some situations, turn it off, but for most situations, rich text is intended to be displayed as rich text, even in a word document.
    Thursday, November 24, 2016 4:22 AM