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

3

13

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.

Insatiate answered 29/8, 2011 at 9:18 Comment(0)
R
17

The following link lists ALL formatting options that are supported by Access (2007):

http://office.microsoft.com/en-us/access-help/insert-or-add-a-rich-text-field-HA010014097.aspx

In order to get a list of HTML tags, styles etc., I would suggest storing lines of text that have ALL formattings and then check its HTML (e.g. one record per each formatting option - total 16).

...I did it by myself and here is a list of supported HTML tags:

<div>,<font>,<strong>,<em>,<u>,<ol>,<ul>,<li>,<blockquote>

And, styles/attributes per tag:

<font>: face, size, color, style(with BACKGROUND-COLOR only)    
<div>: align, dir
Rhizome answered 29/8, 2011 at 21:1 Comment(4)
I have been attempting to get strike through to work. From what I can tell, Access is recognizing <s> tag as valid (it doesn't appear in report text box formatted as rich text), but it doesn't actually apply the format.Subscapular
Just discovered that &nbsp; works, too!! I am excited to have extra spaces :DSubscapular
Yyyyep. What we're seeing here is a single HTML tag with support for a single CSS attribute, where the tag was depreciated by the introduction of CSS, and an equivilant HTML attribute for the style exists. Also div instead of p for blocks of text you have no styling control over. Go home Microsoft, you're drunk again.Gastrology
Worth noting that &lt; and &gt; also work, for escaping < and > characters. I think all the character codes work (although I haven't tested extensively). Also <b> and <i> can be used in place of <strong> and <em>Gastrology
U
6

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! :-)

Unionism answered 23/4, 2019 at 14:17 Comment(0)
M
2

This is obviously an older topic, but there's information to add.

First, as far as I can tell, while BLOCKQUOTE is supported, I'm not sure that it can be created using the Rich Text GUI control. You can enter it in text that maps to a Rich Text control and it will be displayed differently (indented), though.

Second, while there's no Anchor/Link item in the GUI, if you type a URL into the Rich Text field, you will get a link as shown in the two examples below:

<a href="http://www.stackoverflow.com">http://www.stackoverflow.com</a>
<a href="mailto:[email protected]">mailto:[email protected]</a>

In both cases, I only typed the text between the start and end tags.

Third, there are additional HTML entities supported besides those mentioned above -- &amp; for ampersand (&) and &quot; for double quotation marks (").

I typed all of the special characters on a U.S. keyboard into a Rich Text control, and here's what I got:

<div>`~ ! @ # $ % ^ &amp; * ( ) -_ = + [ { ] } \ | ; : ' &quot; , &lt; . &gt; / ?</div>

Those make sense from an XML/HTML perspective.

Malayan answered 7/11, 2020 at 3:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.