WPCubed Product Support

Merge Field Markers

support

Hi,

ReformatAll helps after changining INsertPointAttr. It is also required after DeleteFields only if immedialtly output is produced (PDF, print). If the text it edited (the app is idle) it is not required.

Julian

#8 ♥ 0
12.2k Views 1 links 3 users read 3 min

This works well, thanks! Is it necessary to ReformatAll also?
BTW: is there a way to hide the markers in a TfrxWPToolsView?
best wishes,
Wolfgang

#7 ♥ 0
support

Hi,

You can call the method "DeleteFields" after You did the merge process. Changing the DefaultIOFormat to "RTF-nomergefields" would destroy the fields while the user is editing, if you are unlucky. (realod can happen in a DB control at any moment)

Julian

#6 ♥ 0

Hi Julian,

@wpsupport:
WPRichText1.InsertPoints.Hidden := true

SaveToFile( filename, 'RTF-nomergefields' )

Which method do you suggest when using TDBWPRichText? I want to destroy the mergefields on posting the record.

I have to get rid of the mergefield markers because they show up on printing with FastReport.

best wishes,
Wolfgang

#5 ♥ 0
support

Hi,

I am writing from a notebook currently, was sloppy

TWPCustomRTFEdit also has InsertPointAttr and the others:

property InsertPointAttr: TCharacterAttrTags read GetInsertPointAttr write SetInsertPointAttr stored IsTextAttrStored;
    property HyperlinkTextAttr: TCharacterAttrTags read GetHyperlinkTextAttr write SetHyperlinkTextAttr stored IsTextAttrStored;
    property BookmarkTextAttr: TCharacterAttrTags read GetBookmarkTextAttr write SetBookmarkTextAttr stored IsTextAttrStored;
    property SPANObjectTextAttr: TCharacterAttrTags read GetSPANObjectTextAttr write SetSPANObjectTextAttr stored IsTextAttrStored;
    property HiddenTextAttr: TCharacterAttr read GetHiddenTextAttr write SetHiddenTextAttr stored IsTextAttrStored;
    property AutomaticTextAttr: TCharacterAttr read GetAutomaticTextAttr write SetAutomaticTextAttr stored IsTextAttrStored;
    property ProtectedTextAttr: TCharacterAttr read GetProtectedTextAttr write SetProtectedTextAttr stored IsTextAttrStored;
    property FieldObjectTextAttr: TCharacterAttr read GetFieldObjectTextAttr write SetFieldObjectTextAttr stored IsTextAttrStored;

also see: [](http://www.wptools.com/manuals/wp5man/low_level_create_field.htm)

Regards,
Julian Ziersch

#4 ♥ 0

What is the solution if I am using a dynamically created CustomRTFEdit component which has no insertpoints property?

tempRTFEdit := TWPCustomRTFEdit.CreateDynamic;
tempWPPDFExport:= TWPPDFExport.Create(nil);

try
begin
with tempWPPDFExport do
begin
Filename := tempPDFPathAndName;
Source := tempRTFEdit;
FontMode := wpUseTrueTypeFonts;
CidFontMode := wpCIDOff;
PDFAMode := wpdfaOff;
CompressStreamMethod := wpCompressNone;
AutoLaunch := False; // Do not show when completed
end;

tempRTFEdit.LoadFromFile(tempRTFPathAndName,true,'AUTO');
tempRTFEdit.ReformatAll(true,false);
tempWPPDFExport.Print;

TIA

John

#3 ♥ 0
support

@jredoc:
If I save a document in WPRichText component that contains merged fields and then create a pdf file using the code below, the merge field markers are displayed in the pdf document. Is there a mechanism to prevent the display of these markers?

When you create the PDF from a TWPRIchText use

WPRichText1.InsertPoints.Hidden := true

the fields can be permanently deleted at save time using

SaveToFile( filename, 'RTF-nomergefields' )

#2 ♥ 0

With Delphi 2009, WPTools 6.05.7 and wPDF 3.55

If I save a document in WPRichText component that contains merged fields and then create a pdf file using the code below, the merge field markers are displayed in the pdf document. Is there a mechanism to prevent the display of these markers?

tempRTFPathAndName := tempFilePath + adsTablePtLetters.FieldByName('FileName').AsString;

tempPDFPathAndName := tempRTFPathAndName;
tempPDFPathAndName := Copy(tempPDFPathAndName, 1, Length(tempPDFPathAndName) - 3);
tempPDFPathAndName := tempPDFPathAndName + 'pdf';

tempRTFEdit := TWPCustomRTFEdit.CreateDynamic;
tempWPPDFExport:= TWPPDFExport.Create(nil);

try
begin
with tempWPPDFExport do
begin
Filename := tempPDFPathAndName;
Source := tempRTFEdit;
FontMode := wpUseTrueTypeFonts;
CidFontMode := wpCIDOff;
PDFAMode := wpdfaOff;
CompressStreamMethod := wpCompressNone;
AutoLaunch := False; // Do not show when completed
end;

tempRTFEdit.LoadFromFile(tempRTFPathAndName,true,'AUTO');
tempRTFEdit.ReformatAll(true,false);
tempWPPDFExport.Print;
end
except
begin
MessageDlg('A pdf file was unable to be created from the ' + tempRTFPathAndName + ' file.',
mtError, [mbOK], 0);
tempContinue := False;
end;

if tempWPPDFExport.Printing then
begin
tempWPPDFExport.EndDoc;
end;

tempWPPDFExport.Free;
tempRTFEdit.Free;
Screen.Cursor := crDefault;
end;

#1 ♥ 0