Text.TextToHTML
---------------

Creates HTML text for a given FileMaker formatted styled text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [4.3](newinversion43.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.TextToHTML"; Text { ; Options } ) 

**MBS**( **"Text.TextToHTML";** /\* Creates HTML text for a given FileMaker formatted styled text. \*/  
**$Text**; /\* Formatted text to convert.e.g. "Hello World" \*/   
**$Options**) /\* Optional; The options number for html creation.  
Add 1 for having no body around.  
Add 2 to have no font names.  
Add 4 to have no font sizes.  
Add 8 to use strong instead of b tag for bold.  
Add 16 to keep links in HTML to pass through &lt;a..&gt;&lt;/a&gt; tags. (new in 7.4).  
Add 32 to use paragraphs. (new in 13.1)e.g. 1+2+4+8 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | Formatted text to convert. | "Hello World" |  |
| Options | The options number for html creation.   Add 1 for having no body around.   Add 2 to have no font names.   Add 4 to have no font sizes.   Add 8 to use strong instead of b tag for bold.   Add 16 to keep links in HTML to pass through &lt;a..&gt;&lt;/a&gt; tags. (new in 7.4).   Add 32 to use paragraphs. (new in 13.1) | 1+2+4+8 | Optional      Added in version **6.5**. |

### Result

Returns OK or error.

### Description

Creates HTML text for a given FileMaker formatted styled text.   
Supports styles like bold, italic, underline, font size and text color. Other style features may be added in the future on demand.  
  
See also [Text.EncodeToHTML](TextEncodeToHTML.md) and GetAsCSS in FileMaker.  
  
Version 11.2 adds support for strikethrough using s tag in html.  
Version 12.0 adds superscript and subscript style for HTML.  
Version 13.1 adds flag 32 to use &lt;p&gt; instead of &lt;br/&gt;&lt;br/&gt; for two returns in the text in a style run.  
  
See also [Text.HTMLtoStyledText](TextHTMLtoStyledText.md) function.  
### Examples

Convert some text to HTML

 MBS ( "Text.TextToHTML"; "Hello World" )  
<small>  
Example result:   
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;  
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"&gt;  
&lt;head&gt;  
&lt;meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /&gt;  
&lt;/head&gt;  
&lt;body&gt;  
&lt;p&gt;Hello World&lt;/p&gt;&lt;/body&gt;  
&lt;/html&gt;</small>Convert some text to RTF

 MBS ( "[Text.TextToRTF](TextTextToRTF.md)"; "Hello World" )  
<small>  
Example result:   
{\\rtf1\\ansi\\ansicpg1252  
Hello World  
}</small>Convert without body/header:

 MBS ( "Text.TextToHTML"; "Hello World”; 1 )  
<small>  
Example result: &lt;p&gt;Hello World&lt;/p&gt;</small>Convert using paragraphs:

 MBS ( "Text.TextToHTML"; "Hello World¶¶Just a test"; 32 )  
<small>  
Example result:   
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;  
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"&gt;  
&lt;head&gt;  
&lt;meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /&gt;  
&lt;/head&gt;  
&lt;body&gt;  
&lt;p&gt;Hello World&lt;/p&gt;  
&lt;p&gt;  
Just a test&lt;/p&gt;&lt;/body&gt;  
&lt;/html&gt;</small>### See also

- [SendMail.SetHTMLText](SendMailSetHTMLText.md)
- [Text.EncodeToHTML](TextEncodeToHTML.md)
- [Text.HTMLtoStyledText](TextHTMLtoStyledText.md)
- [Text.TextToRTF](TextTextToRTF.md)

### Release notes

- **Version 16.2**
    - Improved [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) to better handle closing tags with paragraphs.
- **Version 13.5**
    - Added highlight support for [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function.
- **Version 13.1**
    - Added flag 32 for [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function to use paragraphs.
- **Version 12.2**
    - Fixed a problem with high unicode character encodings for [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function.
- **Version 12.0**
    - Added subscript and superscript to [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function.
- **Version 11.2**
    - Added strikethrough as attribute recognized by [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function.
- **Version 7.4**
    - Added option in [Text.TextToHTML](http://www.mbsplugins.eu/TextTextToHTML.shtml) to keep links in html.

### Example Databases

- [Text functions/Text to RTF or HTML](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Text%20functions/Text%20to%20RTF%20or%20HTML.shtml#8ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.2pr4](https://www.mbsplugins.de/archive/2026-04-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV - The FileMaker MonkeyBread Plug-in Q&amp;A](https://www.mbsplugins.de/archive/2024-07-03/MBS_@_FMTrainingTV_-_The_FileM/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 21 - SendMail](https://www.mbsplugins.de/archive/2023-12-21/MBS_Plugin_Advent_calendar_21_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.5 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-11-07/MBS_Plugin_135_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.5pr1](https://www.mbsplugins.de/archive/2023-09-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.1pr5](https://www.mbsplugins.de/archive/2023-02-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.2pr5](https://www.mbsplugins.de/archive/2022-05-04/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 12.0 - More than 6700 Functions In One Plugin](https://www.mbsplugins.de/archive/2022-01-18/MBS_FileMaker_Plugin_120_-_Mor/monkeybreadsoftware_blog_filemaker)
- [Email Script for FileMaker](https://www.mbsplugins.de/archive/2018-10-10/Email_Script_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Sending Email with FileMaker via MBS Plugin](https://www.mbsplugins.de/archive/2014-09-29/Sending_Email_with_FileMaker_v/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2024, Seite 38](https://filemaker-magazin.de/neuigkeit/4277-Appetithappen-FMM_202406)
- [Ausgabe 5/2014, Seite 25](https://filemaker-magazin.de/neuigkeit/3759-Appetithappen-FMM_201405)

This function checks for a license.

Created 7th September 2014 , last changed 13th October 2025

  
[Text.Styles](TextStyles.md) - [Text.TextToRTF](TextTextToRTF.md)

[HTML Version](TextTextToHTML.shtml)