0% found this document useful (0 votes)
39 views

Export Grid Function

This document contains code for exporting data from a frame to different file types. It includes functions to check if an export type is supported, get the export file name, and perform the export. The main export procedure validates the export type, gets the file name, calls the frame's export method, and optionally opens the exported file.

Uploaded by

nadut
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Export Grid Function

This document contains code for exporting data from a frame to different file types. It includes functions to check if an export type is supported, get the export file name, and perform the export. The main export procedure validates the export type, gets the file name, calls the frame's export method, and optionally opens the exported file.

Uploaded by

nadut
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

function IsSupportExport(AExportType: TSupportedExportType): Boolean;

function TfrmMain.IsSupportExport(AExportType: TSupportedExportType): Boolean;


bein
!esult :" (dx#rameManaer.Acti$e#rame %& nil) and dx#rameManaer.Acti$e#rame.IsSupportExport(AExportType);
end;
function Tdx'rid#rame.Export#ile(ame: strin;
bein
!esult :" )*'ridExport);
end;
procedure TfrmMain.+oExport(AExportType: TSupportedExportType);
$ar
A#ile(ame: strin;
function 'et#ile(ame($ar A#ile(ame: strin): Boolean;
const
+efaultExtensions: array,TSupportedExportType- of strin "
().tml)/ )xml)/ )xls)/ )txt));
#ilters: array,TSupportedExportType- of strin "
()0TM1 #ile (2..tml)32..tml)/
)4M1 #ile (2.xml)32.xml)/
)Microsoft Excel 5.6 7or8s.eet (2.xls)32.xls)/
)Text file (2.txt)32.txt));
bein
9it. TSa$e+ialo.:reate(Self) do
try
+efaultExt :" +efaultExtensions,AExportType-;
#ilter :" #ilters,AExportType-;
#ile(ame :" dx#rameManaer.Acti$e#rame.Export#ile(ame;
Initial+ir :" Extract#ile;at.(Application.Exe(ame);
<ptions :" <ptions = ,of<$er9rite;rompt-;
!esult :" Execute;
if !esult t.en A#ile(ame :" #ile(ame;
finally
#ree;
end;
end;
bein
if not IsSupportExport(AExportType) t.en
bein
Application.MessaeBox(;:.ar(sdxExport'ridMessae)/ ;:.ar(sdxExport'ridMessae:aption)/
MB>I:<(I(#<!MATI<();
Exit;
end;
if not 'et#ile(ame(A#ile(ame) t.en Exit;
dx#rameManaer.Acti$e#rame.+oExport(AExportType/ A#ile(ame);
if (Application.MessaeBox(;:.ar(sdx<pen#ile = A#ile(ame =) ?))/ ;:.ar(sdx:onfirm)/
MB>I:<(*@ESTI<( = MB>AES(<) " I+>AES) t.en
+oExecuteApplication(A#ile(ame);
end;

You might also like