473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Formatting in RTF Text Box

124 100+
I am using Access 2007 and have a large textbox whose TextFormat is set as RTF and is bound to a memo field. There are several command buttons which automatically insert email text into the textbox, such as Header, Signature, etc. If the TextFormat for the textbox is plain text, the carriage returns and line feeds are all inserted according to what is in the code. However, if I switch the textbox to RTF TextFormat, it ignores the hard returns in the code and just inserts its own hard returns to wrap the text. Does anyone know of a workaround for this?
Feb 5 '14 #1

✓ answered by ADezii

I think that I have figured it out for you BikeToWork. The MEMO Field for a Bound Rich Text Box (txtTest in this case) appears to utilize HTML Encoding to properly Format the Rich Text contents. You need to use the HTML equivalent of a CR/LF in order to produce the same effect. Case in point:
Expand|Select|Wrap|Line Numbers
  1. strTest = "Test<br>String<br>for<br>BikeToWork"
  2.  
  3. Me![txtTest] = strTest
  4.  
produces & preserves
Expand|Select|Wrap|Line Numbers
  1. Test
  2. String
  3. for
  4. BikeToWork
  5.  
within the Bound Rich Text Box.

8 8115
ADezii
8,834 Expert 8TB
There is a 'long' work-a-round. Once Data is entered into the Bound Rich Text Box, you can physically insert Hard Carriage Returns (CTRL+ENTER) wherever appropriate, and the Formatting will persist. Hopefully, you or asomeone else, can come up with a 'shorter' work-a-round (LOL).
Feb 5 '14 #2
BikeToWork
124 100+
Thanks, ADezii. I was looking for a more automated solution, if there is one. Why does the RTF text box just ignore the VBCRLF's in the code, whereas the plain text text box does not?
Feb 5 '14 #3
Luk3r
300 256MB
This may be a silly question on my part, especially because I don't know a ton about VBA, but are you able to set a multiline property for the RTB? In VB.NET, if a textbox or RTB has the multiline property disabled it will not accept carriage returns.
Feb 5 '14 #4
ADezii
8,834 Expert 8TB
I think that I have figured it out for you BikeToWork. The MEMO Field for a Bound Rich Text Box (txtTest in this case) appears to utilize HTML Encoding to properly Format the Rich Text contents. You need to use the HTML equivalent of a CR/LF in order to produce the same effect. Case in point:
Expand|Select|Wrap|Line Numbers
  1. strTest = "Test<br>String<br>for<br>BikeToWork"
  2.  
  3. Me![txtTest] = strTest
  4.  
produces & preserves
Expand|Select|Wrap|Line Numbers
  1. Test
  2. String
  3. for
  4. BikeToWork
  5.  
within the Bound Rich Text Box.
Feb 5 '14 #5
BikeToWork
124 100+
Thanks again, ADezii. You are correct about the html code for the rtf control. Access puts it in automatically when the user puts in a hard return or bolds some text, etc.
Feb 5 '14 #6
ADezii
8,834 Expert 8TB
You are quite welcome, so all works well?
Feb 5 '14 #7
BikeToWork
124 100+
ADezii, unfortunately it won't work with my program. If I use <br> or <div> for new lines in the code, it will appear without the code tags in the text box but when I use the SendObject command to send the email, it shows up with all the html code tags, even if I specify acFormatHTML and select HTML format in Outlook. It was a good learning experience, though.
Feb 5 '14 #8
NeoPa
32,556 Expert Mod 16PB
I believe the .Value has all the codes but if you want the text without them then .Text has that.
Aug 25 '15 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Robert | last post by:
I need some help with formatting some text received from a database query. I am only selecting a single row per query so the formatting will only be performed on a single row. The rows I need to...
3
by: Ike | last post by:
Does anyone know where I can find example scritp for formatting text input? I want to have a text box where only legitiamte filesname under unix can be netered (no whitespace, only alphanumeric,...
1
by: msmcg | last post by:
I need to format the data in some textboxes using the Binding method with custom Currency and ShortDate format and parse handlers. Here is the code that I am using. I call it on the form load...
2
by: Mitchell Vincent | last post by:
I have a bunch of text boxes and labels that hold currency values. I need some formatting on them, but since they are databound to a set, I'm confused as to how to do that. Do labels and text boxes...
0
by: gsb58 | last post by:
Hi! In my application I save text from a RichText box to file, but when previewing the text it turns out like: {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Verdana;}}...
10
by: korund | last post by:
We can use special characters ('\n') to add line breaks in text in JavaScript popup Alert boxes. there is also few additional special characters: \' single quote \" double quote \&...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
6
by: Glen | last post by:
Hello again, I don't blame anyone for not answering my last post, since I obviously hadn't spent much time researching, but I've come a little ways and have another question. How can I better...
2
by: drfreaky | last post by:
Hello, I want to use a richtextbox for logging status messages. I have three kind of message types and want to use different formatting for them. My problem is, I change the color, add the text...
2
by: Rozzy | last post by:
Hi, I'm having trouble using the proper terminology, so bear with me, I am trying to submit text to a mysql database. I want to be able to allow formatting of this content (like breaking it up into...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.