Link to home
Start Free TrialLog in
Avatar of anamika1977
anamika1977

asked on

storing bold text into Database

I have a notes section in a VB form in which , the user can enter the text and there is a bold button so that user can make part of texts bold which r important . And the entire content is stored in a field "content" in Access database .i want to store the text with the bold parts so that when i reload the notes section the user sees the notes with the parts he had made bold , exactly with the changes he had made .

Now i'm thinking of only one way to store the "Selstart" and "sellength" of the rich edit text box as soon as the user selects a portion of notes and make it bold , like i'll hold 2 more fields in DB called SelStart and SelLength  where i store the nos. of the bold sections , Like if the user first chooses text whose selstart is 5 and length is 20 , then another section he makes bold whose selstart is 30 and lenth is 15 , so i store 5,30,...so on (all the Selstarts ) in "SelStart" field in DB and then 20,15... so on in "SelLength" field in DB , and when i reload the VB notes form , i get these values and then split them and take 5 for first bold sections SelStart and 20 As its lengtyh adn make this bold and then i pick up 30 and its length 15 and make it bold and so on.

Is this the proper way , i mean will it not be clumsya nd leangthy ?? Can anyone tell me is there any easier way of storing a text with few sections bold , italics and all in database .
Thanks
anamika
ASKER CERTIFIED SOLUTION
Avatar of elvinsoh
elvinsoh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madmarlin
Madmarlin

I dont think it is possible to actually store the text in the DB in Bold.
Although a little trick, I think elvinsoh has the best idea.
The only other way around I can think of is set some form a flag in the db to state whether or not the text is bold, the read that flag when reading the data back into you app.
However this will restrict you to having all of the text in that field either Bold or Not Bold..\

Good Luck Madmarlin
Avatar of anamika1977

ASKER

Hi elvinsoh how can i use html tags in my notes section ?? Sorry i didn't get u what u r saying . Like in my case when my VB form loads it will show the notes which r like "asfafsdgasdgfdhgf" and the user makes a pert of it bold and saves it to DB . Then how can i convert this simple text to text with html tags . Do u want to say that i'll insert tags where its bold and then save to DB and while retrieving i'll take out the tags and show . Can u please explain me how your programs work ???and what r utrying to put
thabka
anamika
Ok. Here goes:

You have this text in your RichText :

"The quick brown fox jumps over the lazy dogs."

Now, the user selects "quick brown" and hits [BOLD]

YOU have to get SelStart, SelEnd and Add "<B>" and "</B>" to the text so that it reads :

"The <B>quick brown</B> fox jumps over the lazy dogs."

Run the FORMATRTF() function I've given you above and it'll do the rest.

===========================================================
You can store the string AS IT IS and every time you
dump it into a RichText Box and run FORMATRTF() on it,
you'll get it nicely formatted.

===========================================================
IF you want to get the TEXT back without the tags you put in, it's rather simple. Put the text (with the tags) into
a RichText Box, Run FORMATRTF() and get the RICHTEXT.TEXT

===========================================================

Here is a list of some of the tags the function supports :

<B> Start BOLD Text           </B> End BOLD Text
<I> Start Italics             </I> End Italics
<U> Start Underline           </U> End Underline

<FONT= fontName> will set font face. End with </FONT>.
<SIZE= n> will set font size. End with </FONT>.
<COLOR= hexn> will set font color - hexn is a hexadecimal RGB value. End with </COLOR>
<ALIGN= param> where param = LEFT ; RIGHT ; CENTER
This will set the alignment of your text. End with </ALIGN>


Have fun.
Hi Elvinsoh what is this frmMain.ShowProgress function u have called inside FormatRTF ???
Can u provide me with that function otherwise i'm not able to use your code
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20258034.html
https://www.experts-exchange.com/questions/Q.20281103.html
https://www.experts-exchange.com/questions/Q.20291660.html
https://www.experts-exchange.com/questions/Q.20294799.html
https://www.experts-exchange.com/questions/Q.20297870.html
https://www.experts-exchange.com/questions/Q.20298607.html
https://www.experts-exchange.com/questions/Q.20299135.html

To view your locked questions, please click the following link(s) and evaluate the proposed answer.
https://www.experts-exchange.com/questions/Q.20286827.html

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
https://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
Zero response from anyone, and finalized.