New topic: 

Saving StyledText to a DB and reloading into Text Area

<http://forums.realsoftware.com/viewtopic.php?t=34226>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        tcbasic          Post subject: Saving StyledText to a DB and 
reloading into Text AreaPosted: Thu Jun 10, 2010 8:48 pm                        
 
Joined: Sat Jun 30, 2007 11:21 pm
Posts: 70
Location: Miami, Florida (USA)                Hey all,

I want to save the contents of a TextArea to a DB file with all of it's 
styledtext formatting in place.  I'll need to retrieve it from the DB at a 
later time.

I think I've figured out how to save the contents - I create a table with a 
blob column type.  I then save the TextArea's TextStyleData in the blob column. 
 This seems to be working okay - when I look at the table and run a query, all 
of the textstyle info is there along with the text.

What I'm having trouble with is loading this from the DB back into a TextArea 
(along with all of the formatting).  Any suggestions?

Thanks.

Tom   
                             Top                 AndyDent          Post 
subject: Re: Saving StyledText to a DB and reloading into Text AreaPosted: Fri 
Jun 11, 2010 12:14 am                         
Joined: Mon Jul 10, 2006 2:47 am
Posts: 226
Location: http://www.andydent.com/                Look at the StyledExample 
with XML file IO from http://www.oofile.com.au/downloads.html#DownloadREALbasic 
     
_________________
Freelance RB, C++ and Python Developer.  
                             Top                brisance          Post subject: 
Re: Saving StyledText to a DB and reloading into Text AreaPosted: Fri Jun 11, 
2010 12:39 am                         
Joined: Tue Oct 06, 2009 2:38 am
Posts: 252                Code:dim rs As RecordSet
rs = db.SQLSelect( "SELECT myData FROM t_data WHERE id = '123'" )
if rs <> nil then
  TextArea1.RTFData = rs.Field( "myData" ).StringValue
end if      
_________________
Mike Ash: Getting Answers
  
                             Top                 simonjohn          Post 
subject: Re: Saving StyledText to a DB and reloading into Text AreaPosted: Fri 
Jun 11, 2010 4:00 am                                 
Joined: Sat Apr 19, 2008 12:44 pm
Posts: 339
Location: Dorset, UK                OK, so it was a looong time ago but for 
some reason I coded one of my applications to convert styled text to Base64 
before inserting into the database, then decode it when reading - I think there 
were problems with strange characters in the styled text - I really should keep 
notes of why I do stuff!!  So to read back data from an ordinary text field not 
a blob (I only use blobs when really necessary) :
Code:window1.letter_text.styledText.RTFData = DecodeBase64 ( 
rs_letter.Field("letter_text").getString )Seems to work OK, so perhaps I did 
have a reason for the Base64 - who knows?     
_________________
Simon Larkin
QiSQL Database Solutions
Website : http://www.qisql.com
Mac 10.6.2, Imac 2.4ghz, 4gb, RB 2010 R1  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to