Set a selection of text to bold inside a RichTextBox

爷,独闯天下 提交于 2019-12-08 06:57:01

问题


In an MS-Access RichTextBox on a Report, I want to make a selection of the text bold.

I found this post on a forum which explains how to do this in VB6. I tried the same in MS-Access, both with a normal Access textbox with the Text Format property set to Rich Text and a Microsoft Forms 2.0 TextBox added via the ActiveX Controls dialogue box, neither works.

I know VBA is based heavily on VB6 so my logic is if it can be done in VB6, I should be able to do it in Access.

Am I right? Is it possible to set a selection of text to bold inside a RichTextBox on MS-Access?


回答1:


You do not mention the version of Access, for 2007 (AFAIK) and 2010, you can create a textbox and set the Text Format on the data tab to Rich Text. You can then set the Control Source to:

="The quick <b>brown</b> fox"

In table design, the memo data type has a Rich Text option.


From Rich formatted text that includes data from fields

For a number of reasons the rich text control doesn't support the full range of HTML but rather a limited subset of HTML focused around formatting text. If you stick to the list of HTML tags and attributes below you should be safe:

<font face="Arial Black" size=3 color="#A5A5A5" style="Background-Color:#FFFF00"> 
<strong> 
<em> 
<u> 
<br> 
<div align=right dir=RTL> 
<blockquote> 
<ol> and <li> for number 
<ul> and <li> for bulleted lists


来源:https://stackoverflow.com/questions/12561633/set-a-selection-of-text-to-bold-inside-a-richtextbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!