2018年7月19日 星期四
2018年7月15日 星期日
Delphi 取得桌面資料夾的路徑和取得我的文件的路徑
function GetShellFolders(strDir: string): string;
const
regPath = '\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders';
var
Reg: TRegistry;
strFolders: string;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey(regPath, false) then
begin
strFolders := Reg.ReadString(strDir);
end;
finally
Reg.Free;
end;
result := strFolders;
end;
Ex:
{獲取桌面}
function GetDeskeptPath: string;
begin
Result := GetShellFolders('Desktop'); //是取得桌面資料夾的路徑
end;
{獲取我的文件}
function GetMyDoumentpath: string;
begin
Result := GetShellFolders('Personal'); //我的文件
end;
轉貼至: http://fecbob.pixnet.net/blog/post/38063575-delphi-取得桌面資料夾的路徑和取得我的文件
const
regPath = '\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders';
var
Reg: TRegistry;
strFolders: string;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey(regPath, false) then
begin
strFolders := Reg.ReadString(strDir);
end;
finally
Reg.Free;
end;
result := strFolders;
end;
Ex:
{獲取桌面}
function GetDeskeptPath: string;
begin
Result := GetShellFolders('Desktop'); //是取得桌面資料夾的路徑
end;
{獲取我的文件}
function GetMyDoumentpath: string;
begin
Result := GetShellFolders('Personal'); //我的文件
end;
轉貼至: http://fecbob.pixnet.net/blog/post/38063575-delphi-取得桌面資料夾的路徑和取得我的文件
2018年7月4日 星期三
SynPDF for Delphi
下載 : https://github.com/synopse/SynPDF
Trying to export a report with unicode text to pdf using SynPDF, results in mixed-up text
SynPDF have fixed some unicode issues, but not all of them aparently. The following is a streight forward code for exporting a quickreport to PDF usiny SynPDF:
procedure TForm1.CreatePdf(QuickRep: TCustomQuickRep; const aFileName: TFileName);
var
Pdf: TPdfDocument;
aMeta: TMetaFile;
i: integer;
begin
Pdf := TPdfDocument.Create;
Pdf.UseUniscribe := True;
try
Pdf.DefaultPaperSize := psA4;
QuickRep.Prepare;
for i := 1 to QuickRep.QRPrinter.PageCount do begin
Pdf.AddPage;
aMeta := QuickRep.QRPrinter.GetPage(i);
try
// draw the page content
Pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
finally
aMeta.Free;
end;
end;
Pdf.SaveToFile(aFileName);
finally
Pdf.free;
end;
end;
轉貼至 https://stackoverflow.com/questions/25910798/trying-to-export-a-report-with-unicode-text-to-pdf-using-synpdf-results-in-mixe
Use Adobe Acrobat (PDF) Files in a Delphi Application
by Zarko Gajic
Updated September 29, 2017
Delphi supports the display of Adobe PDF files from within an application. As long as you've got Adobe Reader installed, your PC will automatically have the relevant ActiveX control you'll need to create a component you can drop into a Delphi form.
Difficulty: Easy
Time Required: 5 minutes
Here's How:
1.Start Delphi and select Component | Import ActiveX Control...
2.Look for the "Acrobat Control for ActiveX (Version x.x)" control and click Install.
3.Select the Component palette location into which the selected library will appear. Click Install.
4.Select a package where the new component must be installed or create a new package for the new
TPdf control.
5.Click OK.
6.Delphi will ask you whether you want to rebuild the modified/new package. Click Yes.
7.After the package is compiled, Delphi will show you a message saying that the new TPdf component was registered and already available as part of the VCL.
8.Close the package detail window, allowing Delphi to save the changes to it.
9.The component is now available in the ActiveX tab (if you didn't change this setting in step 4).
10.Drop the TPdf component onto a form and then select it.
11.Using the object inspector, set the src property to the name of an existing PDF file on your system. Now all you have to do is resize the component and read the PDF file from your Delphi application.
Tips:
The Adobe ActiveX control installs automatically when you install Adobe Reader.
Step 11 can be completed during runtime, so you can open and close files programmatically as well as resize the control.
轉貼至:https://www.thoughtco.com/adobe-acrobat-pdf-files-delphi-applications-1056893
Ex:
AcroPDF1.src := 'C:\Test.pdf';
Updated September 29, 2017
Delphi supports the display of Adobe PDF files from within an application. As long as you've got Adobe Reader installed, your PC will automatically have the relevant ActiveX control you'll need to create a component you can drop into a Delphi form.
Difficulty: Easy
Time Required: 5 minutes
Here's How:
1.Start Delphi and select Component | Import ActiveX Control...
2.Look for the "Acrobat Control for ActiveX (Version x.x)" control and click Install.
3.Select the Component palette location into which the selected library will appear. Click Install.
4.Select a package where the new component must be installed or create a new package for the new
TPdf control.
5.Click OK.
6.Delphi will ask you whether you want to rebuild the modified/new package. Click Yes.
7.After the package is compiled, Delphi will show you a message saying that the new TPdf component was registered and already available as part of the VCL.
8.Close the package detail window, allowing Delphi to save the changes to it.
9.The component is now available in the ActiveX tab (if you didn't change this setting in step 4).
10.Drop the TPdf component onto a form and then select it.
11.Using the object inspector, set the src property to the name of an existing PDF file on your system. Now all you have to do is resize the component and read the PDF file from your Delphi application.
Tips:
The Adobe ActiveX control installs automatically when you install Adobe Reader.
Step 11 can be completed during runtime, so you can open and close files programmatically as well as resize the control.
轉貼至:https://www.thoughtco.com/adobe-acrobat-pdf-files-delphi-applications-1056893
Ex:
AcroPDF1.src := 'C:\Test.pdf';
訂閱:
文章 (Atom)