When our customer paste mails from Notes directly into our app. the text is reduced to dots and what have you. If he pastes into Word and then into our program, it works.
It seems that TWPRichText doesn't have a fall back font, or what?
I have found this code snippet and wonder if this is something to try: http://wpcubed.com/forum/viewtopi…;highlight=font ... but where should it be run? The BeforePasteText-event? Is this the best solution or can I choose a fall back font somewhere?
Something like this?
Code
procedure TfrmWordProcessor.WPRichText1BeforePasteText(Sender: TObject;
RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
var LoadedText: TWPRTFDataBlock);
var
i,j : Integer;
ca : TWPCHarAttr;
begin
for i := 0 to RTFData.RTFProps.FontMaxAnz-1 do
if Screen.Fonts.IndexOf(RTFData.RTFProps.Fontname[i]) < 0 then
begin
RTFData.RTFProps.Fontname[i] := 'Arial'; // Choose default!
for j := 0 to RTFData.RTFProps.Attributes.CharAttrCount-1 do
begin
RTFData.RTFProps.Attributes.GetCharAttr(j,ca);
if ((ca.MaskHash and BitMask[WPAT_CharFont]) <> 0) and (ca.Values[WPAT_CharFont] = i) then
begin
ca.MaskHash := ca.MaskHash and not BitMask[WPAT_CharCharset];
ca.Values[WPAT_CharCharset] := 0;
RTFData.RTFProps.Attributes.OverrideCharAttr(j,ca);
end;
end;
end;
// WPRichText1.ReformatAll(true, true); // Not used here?
end;
Alles anzeigen
If I instead use the AfterLoadText I expect things already are garbled.