网上有很多关于cxGrid中的数据导出的文章,要引用cxExportGrid4Link单元,该单元已经改名为cxGridExportLink,并且现在支持更多的导出格式
procedure ExportGridToHTML(const AFileName: string; AGrid: TcxGrid;
AExpand: Boolean = True; ASaveAll: Boolean = True; const AFileExt: string = 'html');
导出为Html格式
procedure ExportGridToXML(const AFileName: string; AGrid: TcxGrid;
AExpand: Boolean = True; ASaveAll: Boolean = True; const AFileExt: string = 'xml');
导出为XML格式
procedure ExportGridToText(const AFileName: string; AGrid: TcxGrid;
AExpand: Boolean = True; ASaveAll: Boolean = True; const ASeparator: string = '';
const ABeginString: string = ''; const AEndString: string = '';
const AFileExt: string = 'txt');
导出为文本文件格式
procedure ExportGridToExcel(const AFileName: string; AGrid: TcxGrid;
AExpand: Boolean = True; ASaveAll: Boolean = True; AUseNativeFormat: Boolean = True;
const AFileExt: string = 'xls');
导出为xls格式
procedure ExportGridToXLSX(const AFileName: string; AGrid: TcxGrid;
AExpand: Boolean = True; ASaveAll: Boolean = True; AUseNativeFormat: Boolean = True;
const AFileExt: string = 'xlsx');
导出为xlsx格式
procedure ExportGridToFile(AFileName: string; AExportType: Integer;
AGrid: TcxGrid; AExpand, ASaveAll, AUseNativeFormat: Boolean;
const ASeparator, ABeginString, AEndString: string; const AFileExt: string);
导出为自定义格式,其实就是自定义 分隔符 开始字符 结束字符