Can you describe your use-case a bit more?
For example where is the text coming from? A FileMaker Field?
When you say "Formatted Text", what exactly do you mean? Rich text with images, fonts, etc.?
Do you need the functionality native to FileMaker or could it be an external program that's accessing FM to give you custom functionality?
Using Java, again, depending on what your needs are, I might try this like this:
You could also try to convert the text -> XML and then apply an XSLT to it.
beverly has done lots of XML/XSLT in FM and could offer ideas. I've done tons of XML programming, but I would never choose to do that in FM.
Have you checked some of the plug-ins like MBS, or others?
Just some ideas.
HOPE THIS HELPS.
the GetAsCSS() function is really:
GetAsHTML_formatting. It uses the SPAN tag and all formatting is in the attribute STYLE. There is no external or referenced CSS.
It's very old HTML, but probably valid in the browsers and email clients.
<SPAN STYLE = “font-family: 'Helvetica';font-size: 12px;color:#FF0000;font-weight: bold;text-align: left;”>Frank</SPAN>
this may work as is (or NOT!)
It needs to be tested for the email clients used by those who may receive your messages.
the text would come from a FM text field that user can modify the fonts, size and color etc.
and then that modification would need to have as HTML.
I dont want to have any plugins into FM.
But if it can be done java and then the webviewer copied that would be working.
Nope it is not doing HTLM it is doing inline CSS.
Here a example
red bold house
with Text to CSS looks like this:
<span style=\"color: #FF2712;\" >red</span><span style=\"\" > </span><span style=\"font-family: 'Tahoma';font-weight: bold;\" >bold</span><span style=\"\" > house</span>
And that is inline CSS
HTML would be
<font color="red">red</font> <strong>blod</strong>house.
This text Outlook can accept with VBA. You have an idea how to get the formated text to HTML?
So, you're saying you want to capture in the HTML the font, font color, that the user has in a text field?
Since FM is not object oriented, I don't know how you would do something like:
Unless I'm missing something, FM can't do this other than its built-in functions, plug-ins, or something you craft separately (user interface fields, for example) that uses these.
But just creating HTML shouldn't be that difficult. You could use Beverly's idea or just write your own HTML tags.
HOPE THIS HELPS.
That looks like a great solution to me, but the OP doesn't want to use plug-ins, or so he wrote above.
This is a common situation, not limited to FMP in any way, where the environment you're working in can get you part of the way where you want to go, but you need to augment that built-in result with programming, plug-ins, or external stuff (like JDBC, etc.)
Built-in function GetAsCSS (or SVG) can get only modified font/color/size, not default ones on layout. So you need to hard code in the process.
LayoutObjectAttributes() need more options...
thanks for the many inputs. I think that I will try Beverley's solution, sounds like a good way to go.
thanks again to all for the contribution.
Hopefully, the text is pasted (from Word, perhaps?) or manually 'styled'.
But u is correct. If your field is "styled" on the layout, it will not have formatting pushed.
However, line breaks (< b r >) and other entities will be converted.
& -> &
Also by the definition for the functions:
The GetAsCSS function does not return formats that are set in the Conditional Formatting dialog box.
The GetAsSVG function does not return formats that are set in the Conditional Formatting dialog box.
BTW, GetAsSVG() is another possibility!
SVG supports more text formats than HTML, so SVG will represent what you have typed more accurately.
You'd still need to play with it to match old HMTL (pre v5)!
If one is using old HTML FONT tags, the COLOR attribute can use any of these formats:
colorName - red, for example
HEX - (#rrggbb), #ff0000, #FF0000
rgb(r,g,b) - (same as FileMaker RGB function)
Probably no conversion is needed, however, this is great info!