I want to print the contents of the htmlmemo, but when I replace any text {{NAME}} with what was typed in the edit, the print preview doesn't do what is in the htmlmemo, only when I click the button for the second time. Watch the video.
The button code is this:
I replace the {{NAME}} variable with what was typed in the edit window.
UniHTMLMemo1.Text := StringReplace(UniHTMLMemo1.Text, '{{NAME}}', UniEdit1.Text, [rfReplaceAll, rfIgnoreCase]);
Here I print the contents of the HtmlMemo, but it only prints the second time I run the code.
UniSession.AddJs(UniHTMLMemo1.jsname+'.iframeEl.dom.contentWindow.print();');
Gravar_2025_09_13_16_31_12_44.mp4