WPCubed Product Support

HTML conversion adding span style="background.color:bla

Hi
I'm having a problem when i convert RTF to HTML and sending the result in the body of an email. I use the method
emailBody := rte.AsANSIString('HTML-nomergefields');
We set the mime type in the email to html
We are getting parts of the email blacked out. In View Source I find:

<div style="text-align:justify;"><span style="background.color:black;"><font size=2>We have made the following changes in order to process your enrolment.</font></div>

Looking at the RTF I can see not reason for this

These papers are not available for the following reasons:\par  \pard\plain\qj\plain\fs20\par  \pard\plain\qj\plain\fs20\cb4\i\par  \pard\plain\qj\plain\fs20\par  \pard\plain\qj\plain\fs20\par  \plain\fs20\cb0 We have made the following changes in order to process your enrolment.\par  \pard\plain\qj\plain\fs20\cb4\par  \tx1694\tx3402\tx5129\plain\fs20 Paper\tab Semester\tab Location

Some versions of MS Outlook black out the enclosed text other versions ignore it and so you can see the text
Can you help with this.[/code]

#1 ♥ 0
4.9k Views 2 users read 3 min
support

Hello,

\cb0 does it probably.

You can of course modify the text automatically to remove any backgrounds,

SelectAll
SelectionTextAttr.SetBGColor(clNone)

Julian

#2 ♥ 0

Removing all background colors does solve this particular problem.
And because some versions of Outlook seem not to respond to back.color style. It will do for now. However, some users say they want font background for emphises, with the hope that MS fixes the bug in Outlook
There is a bug in WPIOHTML.TWPHTMLWriter.UpdateCharAttr
that is converting \cb0 to background.color:black.
In debug -
if FCharAttr.GetBGColor(aColor) line 1383
returns aColor of 0
and WPColorToString(aColor) returns black
the is what FCharAttr looks like for cb0
((358, (0, 1, 1000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)), False, (0, (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)))
here is what FCharAttr looks like for cb15 which is font background color = black - also using font color = white
((390, (0, 1, 1000, 0, 0, 0, 0, 12, 15, 0, 0, 0, 0, 0, 0, 0)), False, (0, (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)))

FCharAttr.GetBGColor(aColor) is grabing correct attribute.

I think the problem is in where clBlack is defined twice. the First one should be clNone line 587 in unit WPRTEDefs

WPStandardColors: array[0..15] of TColor =
  (clBlack, clRed, clGreen, clBlue, clYellow,
    clFuchsia, clPurple, clMaroon, clLime, clAqua, clTeal, clNavy,
    clWhite, clLtGray, clGray, clBlack);

This is used in TWPRTFProps.Init to fill the array FPaletteEntries.

What do you think?

#3 ♥ 0
support

Hi,

I think you are right. The first value is a dummy value and usually not used. Tjis is why it is there twice.

clNone is a good idea.

The fix in the HTML writer looks good.

Julian

#4 ♥ 0
This category is archived. No new posts are possible.