can save the bold & color of font to database which I use the richtext box to key the info and I want it to display what I have be set before for the font
"save the bold & color of font to database"
Yes, I do the same. What you need to do is create Fields in your database table.
Example:
FontName as String
FontBold as Boolean
FontItalic as Boolean
FontUnderline as Boolean
ForeColor as String
FontSize as integer
Then when all Fields are created, Open it and just Fill it in. Example: FontName [Arial] etc.
When your program changes the color, name, bold etc., just be sure that you initialize it with your code.
You can also, however, create dummy Labels on your form and link the fields you had created to them. So when you update the fontname, color etc., it will store it in those labels as Label1.Caption which is linked to those fields you just created.
Don't forget to use the datFont.UpdateRecord function also.
So you're looking at a field of type memo that you may want certain words bold or whatever.
Then you're looking at a whole different situation here. Unfortunately, I had the same problem as I also wanted to use it in a crystal reports document type.
As far as I know, you have two choices:
1. Don't have an RTF and use your normal Text1 box which you can still format but not just a word. But still use it for the DB if you want to use reports. When using reports, you can call the formatting of the text and have it also show on the print preview. Next time you enter the program the formatting will still be their as you saved the font formatting in a separate (lets say: Fonts.mdb) file.
OR
2. Forget about the DB file and simply use the RTF box and use the (eg: txtRTFDoc.Save) function that will enable you to save all formating that you've done and even indents, bullets, etc.,
FINALLY:
If you use RTF boxes and you plan using reports, "FORGET IT". When previewing reports with formatting in that RTF, you will see strange box looking characters along with the data you entered for that field.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.