NetTalk Central

Author Topic: convert rtf to html to be display in TinyMCE problem?  (Read 3565 times)

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
convert rtf to html to be display in TinyMCE problem?
« on: January 13, 2015, 09:49:26 PM »
Hi Bruce

I convert a rtf string field to html that I want to display in a TinyMCE field on a form.. the 'Allow xHtml' and 'Allow UNSAFE xHtml'  are switched on. After converting the rtf to a html format the form only hangs. Do not generate the form.

An example of the converted html code as follows:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-za" http-equiv="Content-Language">
<style type="text/css">
p
{ color:green;font-size:12pt;font-style:italic; }
</style>
</head>
<p><span style="color:#080000;"><span style="font-family:Times New Roman;"><span style="font-size:11.5pt;">With reference to your broker code 165 and the fact that there is no active policies under this agency with Landmark, we hereby give notice that it is cancelled with immediate effect.</span></span></span>
</p><p>
</p><p>We would like to thank you for your support in the past.
</p><p>
</p><p>Please contact us do you wish to discuss any future business oppurtunies.
</p><p>
</p><p>Kind regards,
</p><p></p>
</html>

Can you please indicate to me how the html must look-like to be used with the TinyMCE or where I can found specs how it must be look-like to be open with the TinyMCE .

Kind regards
Johan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: convert rtf to html to be display in TinyMCE problem?
« Reply #1 on: January 14, 2015, 06:05:07 AM »
I'm presuming this is a popup form - in which case the HTML must be xHTML compliant.
that means that all tags are closed, and all attributes are in double quotes.

your code below is not xHtml compliant in many ways.Plus it contains a head section and so on. To make this HTML display it would need to look something like;

<style type="text/css">
p
{ color:green;font-size:12pt;font-style:italic; }
</style>

<p>
<span style="color:#080000;">
<span style="font-family:Times New Roman;">
<span style="font-size:11.5pt;">
With reference to your broker code 165 and the fact that there is no active policies under this agency with Landmark, we hereby give notice that it is cancelled with immediate effect.</span></span></span>
</p>
<p></p>
<p>We would like to thank you for your support in the past.</p>
<p></p>
<p>Please contact us do you wish to discuss any future business opportunities.</p>
<p></p>
<p>Kind regards,</p>
<p></p>


(the formatting and linebreaks are just to make it easier to read - they are not important.)
So mostly it looks like you just need to get rid of the html and head stuff.

Cheers
Bruce

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: convert rtf to html to be display in TinyMCE problem?
« Reply #2 on: January 15, 2015, 09:31:34 PM »
Many tanks Bruce

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: convert rtf to html to be display in TinyMCE problem?
« Reply #3 on: January 16, 2015, 01:14:16 AM »
Hi Bruce
The data is displaying now but the paragraphs are not using the p style formatting.

<style type="text/css">
p
{ color:green;font-size:12pt;font-style:italic; }
</style>

Any suggestions?
Many tanks
Johan