Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Rich-Text: Which subset of HTML is supported?

Microsoft Access text boxes can be configured as "Rich Text", allowing the user to apply formatting such as bold text or different font sizes. Internally, this "rich text" is stored as HTML.

Since the formatting options provided by Access are limited, it is obvious that only a subset of HTML is used for storing the formatted text. Is there a list somewhere describing which subset of HTML is used? Ideally, I'd like to have a list of tags that could be found in a text field formatted using this Access feature.

like image 219
Heinzi Avatar asked Aug 29 '11 09:08

Heinzi


People also ask

Does rich text support HTML?

The rich text editor is available in several circumstances: Long Text field - the Enable HTML field option is enabled on a long text field which is added to a layout.

What is rich text support?

What is rich text? Rich text is text that is formatted with common formatting options, such as bold and italics, that are unavailable with plain text. You format your data by using common formatting tools, such as the Ribbon and the Mini Toolbar.

What allows rich text formatting?

If you enable rich-text formatting for a rich text box, users can use a variety of options to format the text that they enter in that control. For example, they can apply a different font or character style to the text inside the rich text box or even insert a table into the rich text box.


1 Answers

If you want an easy way to test combinations of tags, or see which tags Access is using for the rendering, you can create a simple "IDE" concept with a couple text boxes, and a few lines of VBA code.

The box on the left has the source, and the box on the right has the rendered HTML. When you change the text in either box, you see the changes live in both places. On the HTML side, you can use the toolbar to format your text as desired, then review the source on the left side to see which tags Access used.

enter image description here

To create this simple editor, use the following steps:

  1. Create a blank Microsoft Access form.
  2. Add two text boxes, naming them txtSource and txtHTML.
  3. Set the Text Format of the right box to Rich Text.
  4. On both boxes, set the Enter Key Behavior to New Line in Field.
  5. Set both boxes to use [Event Procedure] for the On Change event.

On the VBA side, add the following lines of code to keep the text in sync:

Private Sub txtHTML_Change()
    txtSource = txtHTML.Text
End Sub

Private Sub txtSource_Change()
    txtHTML = txtSource.Text
End Sub

Hope that helps someone else out there! :-)

like image 93
AdamsTips Avatar answered Sep 22 '22 09:09

AdamsTips