Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textmerge in Delphi

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Would appreciate a translation to Delphi code of the following VFP code.

In pseudocode, create the text file C:\temp\reportname.txt by turning on TEXTMERGE, hiding the output with NOSHOW, insert the string 'D:\My Application\Report output.pdf' on the first line, close the text file and turn TEXTMERGE off.

SET TEXTMERGE ON TO C:\temp\reportname.txt NOSHOW
\\D:\My Application\Report output.pdf
SET TEXTMERGE OFF
SET TEXTMERGE TO


FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Code:
var
   ThisFileName : String;
   ThisContent : String;
begin
   ThisFileName := 'C:\temp\reportname.txt';
   ThisContent := '\\D:\My Application\Report output.pdf';


   with TFileStream.Create(ThisFileName, fmCreate) do
   try
       Write(PChar(ThisContent)^, Length(ThisContent));
   finally
       Free;
   end;
end;
You could skip using variables and hard-code everything, but they make the code easier to read and safer to change.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top