Thank you very much.
Beiträge von Stef Merlijn
-
-
Hi,
When will support for Delphi DX10.2 Tokyo be available?
Thanks! -
Is there a way set set some minimum dimensions for cells, so editing a table is not so difficult for the enduser?
-
If I add unit WPRTEFormatA and WPRTEFormatB, adding a table will add it in a very compressed way, in such a way that there is almost no space inside the cells.
-
Hi,
I'm trying to setup the WPRichText to act like a HTML-editor.
One of the things I need is: No limits on margins.Is there (or can you provide) an example which shows the optimal settings that are required for this purpose?
I've tried setting properties "AsWebpage" to true, but it had no effect. So I guess some additional properties must also be changed.
Maybe it would also be an idea to add setting up a HTML-editor to the usermanual.Thanks!
-
Can I also set the color of the line to f.e. clGray with this?
-
Hi,
Currently I insert a horizontal line as follows:
If wpEmailEditor.Changing then
begin
wpEmailEditor.UndoBufferSaveTo(wpEmailEditor.ActivePar, wpuReplaceParTotal);
wpEmailEditor.InputNewObject(wpobjHorizontalLine);
wpEmailEditor.ChangeApplied;
end;This inserts a thin line.
How can I increase the thickness of this line? -
Would this be the correct code to update the hyperlink (replace the E-mailaddress)? Or is there a better way?
Codeprocedure TFMailingPerEmail.BijwerkenAntwoordadresInUitschrijflink(vNewAntwoordadres : String);var i : Integer; aList : TWPTextObjList ;begin aList := TWPTextObjList.Create; wpEmailEditor.TextObjectsGetList(aList, wpobjHyperlink, false); for i := 0 to aList.Count-1 do begin if Pos(UpperCase('Unsubscribe by clicking here'), UpperCase(aList.Items[i].Source)) > 0 then begin wpEmailEditor.Changing; wpEmailEditor.BeginUpdate; aList.Items[i].Source := 'mailto:' + vNewAntwoordadres + '?Subject=UNSUBSCRIBE'; wpEmailEditor.EndUpdate; wpEmailEditor.DelayedReformat; end; end; aList.Free;end;
By the way:
Thanks for the suggestion about the hyperlink insertion. I've updated my code like: -
Hi,
In the editor I add a hyperlink (unsubscribe link) using following code:
CodevAntwoordadres := 'email@mydomain.com'; wpEmailEditor.Changing; wpEmailEditor.BeginUpdate; wpEmailEditor.UndoBufferSaveTo(wpEmailEditor.ActivePar, wpuReplaceParTotal); par := wpEmailEditor.ActiveText.AppendNewPar(); wpEmailEditor.UndoBufferSaveTo(Par, wpuReplaceParTotal); startobj := par.AppendNewObject(wpobjHyperlink,true,false); par.Append('Unsubscribe by clicking here'); endobj := par.AppendNewObject(wpobjHyperlink,true,true);hyperlink endobj.SetTag(startobj.NewTag); startobj.Source := 'mailto:' + vAntwoordadres + '?Subject=UNSUBSCRIBE';
To check if this unsubscribe-link is present in the editor I use following code:
Codefunction UnsubscribeLinkAvailable(Editor : TWPRichText) : Boolean;var i : Integer; aList : TWPTextObjList ;begin Result := False; aList := TWPTextObjList.Create; Editor.TextObjectsGetList(aList, wpobjHyperlink, false); for i := 0 to aList.Count-1 do begin if Pos(UpperCase('?Subject=UNSUBSCRIBE'), UpperCase(aList.Items[i].Source)) > 0 then Result := True; end; aList.Free;end;
Now I need to update the vAntwoordadres (=Emailaddress) in the mailto: by code. Is there a way to accomplish this?
-
Hi Julian,
It sounds great, but can you supply me with a small sample on how to do it?
Maybe format the float to XX digits. Where XX is a variable value entered bij the end-user.Thanks, Stef
-
Hi,
In the report a floating field can be inputed.
Like:CodeMailingEditor.InputMergeField(lbVeldenLijst.Items[lbVeldenLijst.ItemIndex], lbVeldenLijst.Items[lbVeldenLijst.ItemIndex]);
In the database however this field can have a different number decimals per record.
Is there a way to allow the end-user to format the inputmergefield to f.e. 2 decimals?
-
Sorry, I didn't notice the date.
I searched for a solution for the missing OnAfterPasteText event and stumbled on this post.
Julian has got a mail from me already about my question. -
Will this change be added to the new version?
-
Hi,
Following code I use to insert a horizontal line, but the undo isn't triggered for it.
Codeprocedure TFMailingPerEmail.mbHorizontaleLijnClick(Sender: TObject); begin If wpEmailEditor.Changing then begin wpEmailEditor.InputNewObject(wpobjHorizontalLine); wpEmailEditor.ChangeApplied; end; end;
Any idea how to make this work?
-
MailingEditor.InputString('My string',0);
Adds a correct string with default Arial 10.Omiting the two procedures below didn't change the behaviour.
I don't understand why it doesn't work anymore as it worked previously.I do use USEEXPRESSBARS;
Codeprocedure TFMailings.GaNaarEindeMergeVeld;var MergeVeld : TWPTextObj;begin // Naar het einde van een mergeveld gaan indien de cursor op een mergeveld staat. MergeVeld := MailingEditor.FieldAtCP; If (MergeVeld <> Nil) AND (MergeVeld.ParentPosInPar <> MailingEditor.ActivePosInPar) then begin MailingEditor.TextCursor.MoveTo(MergeVeld.EndTag); MailingEditor.CPMoveNext; end;end;procedure TFMailings.GaNaarEindeBookmarkVeld;var BookmarkVeld : TWPTextObj;begin // Naar het einde van een bookmarkveld gaan indien de cursor op een bookmark staat. BookmarkVeld := MailingEditor.BookmarkAtCP; If (BookmarkVeld <> Nil) AND (BookmarkVeld.ParentPosInPar <> MailingEditor.ActivePosInPar) then begin MailingEditor.TextCursor.MoveTo(BookmarkVeld.EndTag); MailingEditor.CPMoveNext; end;end;
Code
Alles anzeigenfunction TFMailings.BookmarkAanmaken(BookmarkNaam : String) : Boolean; begin HuidigeCursorPositie := MailingEditor.CPPosition; // Opslaan huidige cursorpositie if (MailingEditor.BookmarkFind(BookmarkNaam) >= 0) then begin if MailingEditor.BookmarkSelect(BookmarkNaam,true) then // Bookmark selecteren begin if MailingEditor.SelLength > 0 then // Controleren of er tekst in de bookmark staat (0 = leeg) Result := False else begin MailingEditor.BookmarkDelete(BookmarkNaam,true,true); // Oude bookmark verwijderen MailingEditor.CPPosition := HuidigeCursorPositie; // Verplaats cursor naar opgeslagen positie MailingEditor.BookmarkInput(BookmarkNaam,true); // Bookmark invoegen Result := True; end; end; end else begin MailingEditor.CPPosition := HuidigeCursorPositie; // Verplaats cursor naar opgeslagen positie MailingEditor.BookmarkInput(BookmarkNaam,true); // Bookmark invoegen Result := True; end; end;
-
Hi,
I've installed version 6.20, but the problem remains.
Below is my code I use to insert data into the editor. I seems everything is added with Arial 655.What could cause this?
Code
Alles anzeigenprocedure TFMailings.InvoegenVelden(Invoercode : Integer); var TempInputString, TempImageFile : String; par : TParagraph; txtplain : Cardinal; txtobj : TWPTextObj; ImageObject : TWPObject; begin MailingEditor.WritingAttr.Clear; MailingEditor.WritingAttr.SetFontName('Arial'); MailingEditor.WritingAttr.SetFontSize(1000); // 10pt txtplain := MailingEditor.WritingAttr.CharAttr; Case Invoercode of 0 : begin if lbVeldenLijst.ItemIndex < 0 then MyMessageDlg(Format(wzzMessageInformatie , [ConstantP]) , wzzMailingsGeenSamenvoegveld , dkInformatie, NMV) else SamenvoegveldInvoegen; end; 1 : begin // Bedrijfslogo in koptekst plaatsen // Do Only if a JPeg available if (DM.QEigenBedrijf.FieldByName('Logo').IsBlob) and (not(DM.QEigenBedrijf.FieldByName('Logo').IsNull)) then begin try // Prepare Streams TempImageFile := ExtractFilePath(Application.ExeName)+'TempImage.jpg'; DM.QEigenBedrijfLogo.SaveToFile(TempImageFile); try // Probeer oude header te verwijderen. MailingEditor.ActiveText := MailingEditor.BodyText; MailingEditor.HeaderFooter.DeleteText(wpIsHeader, wpraOnAllPages, 0); MailingEditor.ReformatAll(false, true); except end; with MailingEditor.HeaderFooter.Get(wpIsHeader, wpraOnAllPages, '') do begin WorkOnText := true; if (gbMailingKopLogoRechts.ItemIndex = 1) then FirstPar.ASet(WPAT_Alignment, Integer(paralRight)) else FirstPar.ASet(WPAT_Alignment, Integer(paralLeft)); end; MailingEditor.WorkOnText := wpIsHeader; // Om afmetingen van de afbeelding te kunnen bepalen. ImageObject := WPLoadObjectFromFile(MailingEditor.Memo.RTFData,TempImageFile); txtobj := MailingEditor.Memo.RTFData.TextObjects.Insert(ImageObject, ImageObject.ContentsWidth, ImageObject.ContentsHeight); finally if FileExists(TempImageFile) then DeleteFile(TempImageFile); end; end; end; 2 : begin // Plaats horizontale lijn aan onderzijde van de koptekst par := MailingEditor.HeaderFooter.Get(wpHeader,wpraOnAllPages).FirstPar; par.ASet(WPAT_SpaceBefore, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_SpaceAfter, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_IndentLeft, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_IndentRight, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_BorderFlags, WPBRD_DRAW_Bottom); par.ASet(WPAT_BorderWidth, WPCentimeterToTwips(0.02)); // 0,5 mm par.ASetColor(WPAT_BorderColorB, clBlack); // Top end; 3 : begin GaNaarEindeBookmarkVeld; GaNaarEindeMergeVeld; MailingEditor.WorkOnText := wpIsBody; If BookmarkAanmaken('TekstAfzender') then begin TempInputString := DM.QEigenBedrijf.FieldByName('Naam').AsString + #10 + DM.QEigenBedrijf.FieldByName('Adres').AsString + #10 + DM.QEigenBedrijf.FieldByName('Postcode').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Plaats').AsString + #10 + DM.QEigenBedrijf.FieldByName('Land').AsString; MailingEditor.InputString(TempInputString); MailingEditor.CPMoveNext; // Plaats de cursor buiten de bookmark end; end; 4 : begin GaNaarEindeBookmarkVeld; GaNaarEindeMergeVeld; MailingEditor.WorkOnText := wpIsBody; If BookmarkAanmaken('TekstPlaatsDatum') then begin TempInputString := DM.QEigenBedrijf.FieldByName('Plaats').AsString + FormatDateTime(', d mmmm yyyy',Date); if (gbMailingTekstPlaatsRechts.ItemIndex = 1) then MailingEditor.WritingAttr.ASet(WPAT_Alignment, Integer(paralRight)) else MailingEditor.WritingAttr.ASet(WPAT_Alignment, Integer(paralLeft)); MailingEditor.WritingAttr.ASet(WPAT_SpaceBefore, 20); MailingEditor.WritingAttr.ASet(WPAT_SpaceAfter, 20); MailingEditor.InputString(TempInputString); MailingEditor.CPMoveNext; // Plaats de cursor buiten de bookmark // MailingEditor.CPMoveNext; // Plaats de cursor buiten de aangemaakte paragraaf end; end; 5 : begin GaNaarEindeBookmarkVeld; GaNaarEindeMergeVeld; MailingEditor.WorkOnText := wpIsBody; If BookmarkAanmaken('TekstHandtekening') then begin if cbTekstHandtekeningFormeel.Checked then TempInputString := DM.QMedewerkers.FieldByName('Voorletters').AsString else TempInputString := DM.QMedewerkers.FieldByName('Voornaam').AsString; TempInputString := TempInputString + ' ' + DM.QMedewerkers.FieldByName('Tussenvoegsels').AsString + ' ' + DM.QMedewerkers.FieldByName('Naam').AsString; MailingEditor.InputString(wzzGroetenFormeel + #10 + #10 + #10 + #10 + #10 + OpmaakTekst(TempInputString, soNormaal)); MailingEditor.CPMoveNext; // Plaats de cursor buiten de bookmark end; end; 6 : begin // Plaats horizontale lijn in tekstdeel GaNaarEindeBookmarkVeld; GaNaarEindeMergeVeld; MailingEditor.WorkOnText := wpIsBody; with MailingEditor.TextObjects.InsertNewObject(wpobjHorizontalLine, false, false) do begin width := WPCentimeterToTwips(16); Height := 1; iParam := clBlack; end; end; 7 : begin // Plaats horizontale lijn aan bovenzijde van de voettekst par:=MailingEditor.HeaderFooter.Get(wpFooter,wpraOnAllPages).FirstPar; par.ASet(WPAT_SpaceBefore, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_SpaceAfter, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_IndentLeft, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_IndentRight, WPCentimeterToTwips(0.1)); // 1 mm padding par.ASet(WPAT_BorderFlags, WPBRD_DRAW_Top); par.ASet(WPAT_BorderWidth, WPCentimeterToTwips(0.02)); // 0,5 mm par.ASetColor(WPAT_BorderColorT, clBlack); // Top end; 8 : begin par:=MailingEditor.HeaderFooter.Get(wpFooter,wpraOnAllPages).FirstPar; MailingEditor.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '').WorkOnText := true; MailingEditor.WorkOnText := wpIsFooter; TempInputString := ''; if cbVoettekstAfzender.Checked then TempInputString := DM.QEigenBedrijf.FieldByName('Naam').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Adres').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Postcode').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Plaats').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Land').AsString; if cbTelefoonMobielFax.Checked then begin If TempInputString <> '' then TempInputString := TempInputString + #10; TempInputString := TempInputString + wzzTelefoon + ': '+ DM.QEigenBedrijf.FieldByName('Telefoon').AsString + ' ' + wzzMobiel + ': ' + DM.QEigenBedrijf.FieldByName('Mobiel').AsString + ' ' + wzzFax + ': ' + DM.QEigenBedrijf.FieldByName('Fax').AsString; end; if cbEmailWebsite.Checked then begin If TempInputString <> '' then TempInputString := TempInputString + #10; TempInputString := TempInputString + wzzEmail + ': '+ DM.QEigenBedrijf.FieldByName('Email').AsString + ' '+ wzzWebsite + ': ' + DM.QEigenBedrijf.FieldByName('Website').AsString; end; if cbKvkBTWBank.Checked then begin If TempInputString <> '' then TempInputString := TempInputString + #10; TempInputString := TempInputString + wzzKvK + ': '+ DM.QEigenBedrijf.FieldByName('KvKnr').AsString + ' ' + wzzBTWnr + ': ' + DM.QEigenBedrijf.FieldByName('BTWnr').AsString + ' ' + DM.QEigenBedrijf.FieldByName('Bank').AsString + ' ' + wzzRekeningnr + ': ' + DM.QEigenBedrijf.FieldByName('Bankrekening').AsString; end; par.ASet(WPAT_Alignment, Integer(paralCenter)); par.ASet(WPAT_SpaceBefore, 20); par.ASet(WPAT_SpaceAfter, 20); MailingEditor.InputString(TempInputString); end; 9 : begin par:=MailingEditor.HeaderFooter.Get(wpFooter,wpraOnAllPages).FirstPar; MailingEditor.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '').WorkOnText := true; MailingEditor.WorkOnText := wpIsFooter; with MailingEditor.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '') do begin if not Empty then begin MailingEditor.CPPosition := 0; MailingEditor.InputString(#13); MailingEditor.CPMoveBack; // Zet cursor een positie terug - voor de #13 (= Enter) end; end; MailingEditor.WritingAttr.ASet(WPAT_Alignment, Integer(paralRight)); MailingEditor.InputString(wzzPagina + ' '); MailingEditor.InputTextField(wpoPageNumber); MailingEditor.InputString(' ' + wzzvan + ' '); MailingEditor.InputTextField(wpoSectionNumPages); end; 10 : begin // Verwijder horizontale lijn aan onderzijde van de koptekst par := MailingEditor.HeaderFooter.Get(wpHeader,wpraOnAllPages).FirstPar; par.ADel(WPAT_BorderFlags); end; 11 : begin // Verwijder horizontale lijn aan bovenzijde van de voettekst par:=MailingEditor.HeaderFooter.Get(wpFooter,wpraOnAllPages).FirstPar; par.ADel(WPAT_BorderFlags); end; end; if (Invoercode <> 0) then begin btInvoegenVelden.Caption := wzzMailingsSamenvoegveldInvoegen; btInvoegenVelden.Tag := 0; MailingEditor.Refresh; MailingEditor.Changing; MailingEditor.ReformatAll(false,true); end; MailingEditor.WorkOnText := wpIsBody; end;
-
Well the cursor isn't moved at the moment the mergefield is added.
Let's say that at the current cursor position the font=tahoma. Whenever a mergefield is added it is added as Arial with size 655.
Any idea what might influence this behaviour?
-
Hi,
When I insert a mergefield the mergefield has font=Arial + fontsize=655, regardless of the current font+size under the cursor.
Is there a way to make sure the mergefield get the currently active font+size (where the cursor currently is placed in the document)?
CodeWPRichText.InputMergeField(lbVeldenLijst.Items[lbVeldenLijst.ItemIndex], lbVeldenLijst.Items[lbVeldenLijst.ItemIndex]);
In OnShow-event of the form:
CodeWPLocalizeLoadForms := TRUE; WPTools_LoadVCLStrings; WPTools_LoadActionStrings; mbLettertype.Items := Screen.Fonts; WPRichText.DefaultAttr.Clear; WPRichText.DefaultAttr.SetFontName('Arial'); WPRichText.DefaultAttr.SetFontSize(10); WPRichText.WritingAttr.Clear; WPRichText.WriteObjectMode := wobRTF;
-
Can you give me an example on how to do this?
-
Hi,
In my editor I add a mailto: link.
Is the a way to check if there is already such a link present with combination of mailto: and UNSUBSCRIBE?Code
Alles anzeigenwpEmailEditor.Changing; wpEmailEditor.BeginUpdate; par := wpEmailEditor.ActiveText.AppendNewPar(); startobj := par.AppendNewObject(wpobjHyperlink,true,false); par.Append('Please click here to unsubscribe!'); endobj := par.AppendNewObject(wpobjHyperlink,true,true); endobj.SetTag(startobj.NewTag); startobj.Source := 'mailto:' + vreplyaddress + '?Subject=UNSUBSCRIBE'; // to display: wpEmailEditor.EndUpdate; wpEmailEditor.DelayedReformat;