|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Rich Text BoxI was wondering if it's possible to save the contents of the Rich Text Box
control in the Text type of field in SQL Server table? I know how to save the contents of RTB in a file and then open that file in RTB for display. I wouldn't want to use files. I'd like to save the text with formatting in a database. For instance there is a way to save some data in db with html tags and then display that data with formatting in Internet Explorer. How about similar approach for RTB? Thank you Al > I was wondering if it's possible to save the contents of the Rich Text Box> control in the Text type of field in SQL Server table? that file in> I know how to save the contents of RTB in a file and then open > RTB for display. I wouldn't want to use files. I'd like to save tags and thenthe text > with formatting in a database. > For instance there is a way to save some data in db with html > display that data with formatting in Internet Explorer. I'm not a database person myself, so this may not apply...> How about similar approach for RTB? The RichTextBox control has a TextRTF property which contains the Rich Text formatted text in it... can you use that in your assignment to the SQL Server table? If not, can the Text field of an SQL Server table even hold formatted data or is it just a plain text kind of thing? Rick "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> Yes, that will work. RTF is nothing more than text, just like HTML.wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl... > I'm not a database person myself, so this may not apply... > > The RichTextBox control has a TextRTF property which contains the > Rich Text formatted text in it... can you use that in your > assignment to the SQL Server table? "Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message <rickNOSPAMnews@NOSPAMcomcast.net>news:Op0mqky0FHA.560@TK2MSFTNGP12.phx.gbl... > > "Rick Rothstein [MVP - Visual Basic]" > wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl... Yes, I know that RTF is just text and could be assigned to the> > > I'm not a database person myself, so this may not apply... > > > > The RichTextBox control has a TextRTF property which contains the > > Rich Text formatted text in it... can you use that in your > > assignment to the SQL Server table? > > Yes, that will work. RTF is nothing more than text, just like HTML. table cell(s); but what I wasn't sure of was whether it would hold its formatting (bolds, italics, colors, etc.) after the assignment. Rick No problems, the only control character in RTF is the curly brace, there is
nothing ASCII>127 in RTF control codes. The only worry I see is that it will need to be in a Memo field as exceeding 255 chars could easily happen. If the user wants to search on this data he might consider storing the RTF in a memo field and the plain text in normal string field(s) and search only on the plain text. Regards Dave O. Show quoteHide quote "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message news:uKtk1yy0FHA.3000@TK2MSFTNGP12.phx.gbl... > > "Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message > news:Op0mqky0FHA.560@TK2MSFTNGP12.phx.gbl... >> >> "Rick Rothstein [MVP - Visual Basic]" > <rickNOSPAMnews@NOSPAMcomcast.net> >> wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl... >> >> > I'm not a database person myself, so this may not apply... >> > >> > The RichTextBox control has a TextRTF property which contains > the >> > Rich Text formatted text in it... can you use that in your >> > assignment to the SQL Server table? >> >> Yes, that will work. RTF is nothing more than text, just like > HTML. > > Yes, I know that RTF is just text and could be assigned to the > table cell(s); but what I wasn't sure of was whether it would hold > its formatting (bolds, italics, colors, etc.) after the > assignment. > > Rick > > "Dave" <nob***@nowhere.com> wrote in message Actually, the backslash is the main control character. Braces are only for news:Oeeq3Pz0FHA.3256@TK2MSFTNGP09.phx.gbl... > No problems, the only control character in RTF is the curly brace, there > is nothing ASCII>127 in RTF control codes. grouping/scoping. "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> No, I mean the formatting itself is just text. Much like HTML formatting is wrote in message news:uKtk1yy0FHA.3000@TK2MSFTNGP12.phx.gbl... >> Yes, that will work. RTF is nothing more than text, just like > HTML. > > Yes, I know that RTF is just text and could be assigned to the > table cell(s); but what I wasn't sure of was whether it would hold > its formatting (bolds, italics, colors, etc.) after the > assignment. simply <B>, <I>, etc., RTF uses escaped text to indicate formatting. > >> Yes, that will work. RTF is nothing more than text, just like Ah! I see... he just wants to store it for future retrieval.> > HTML. > > > > Yes, I know that RTF is just text and could be assigned to the > > table cell(s); but what I wasn't sure of was whether it would hold > > its formatting (bolds, italics, colors, etc.) after the > > assignment. > > No, I mean the formatting itself is just text. Much like HTML formatting is > simply <B>, <I>, etc., RTF uses escaped text to indicate formatting. Rick Rick, Jeff, Dave
Thanks a lot gentlemen. It works great. I'm talking about TextRTF property. Everything else is not important. Using this property I can save to db and retrieve the text with formatting. Everything I wanted. Al Show quoteHide quote "vul" <a**@optonline.net> wrote in message news:ehoxdOy0FHA.700@TK2MSFTNGP10.phx.gbl... > I was wondering if it's possible to save the contents of the Rich Text Box > control in the Text type of field in SQL Server table? > I know how to save the contents of RTB in a file and then open that file in > RTB for display. I wouldn't want to use files. I'd like to save the text > with formatting in a database. > For instance there is a way to save some data in db with html tags and then > display that data with formatting in Internet Explorer. > How about similar approach for RTB? > > Thank you > Al > > |
|||||||||||||||||||||||