难题:希望有高手可以将下面的PAS文件修改,可以使导出到EXCEL的数据超过65536条,该如何处理
难题:希望有高手可以将下面的PAS文件修改,可以使导出到EXCEL的数据超过65536条
各位朋友,PAS文件如下,当DBGridEh里面的内容超过65536条的时候,导出到EXCEL的时候就不正常,小弟想实现如下目的:将DBGridEh里面的内容导出到EXCEL的时候,超过6万条的,就自动导出到当前EXCEL文件的另外一个SHEET,如果当前的SHEET满了6万条,又继续导出到当前文件的另外一个SHEET,依次类推,使其导出的数据不局限于6万条记录左右,其实整个程序的难点就在于,如何判断当前的SHEET已经满,当前导出的记录已经导出到第几条,请问有没有大虾可以帮忙修改一下下面的PAS文件,使其可以实现上面的功能呢?
诚心向各位大虾求救,万分感谢!!!
unit U_DBGridEhToExcel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ComCtrls, ExtCtrls, StdCtrls, Gauges, DBGridEh, ShellApi;
type
TTitleCell = array of array of string;
//分解DBGridEh的标题
TDBGridEhTitle = class
private
FDBGridEh: TDBGridEh; //对应DBGridEh
FColumnCount: integer; //DBGridEh列数(指visible为True的列数)
FRowCount: integer; //DBGridEh多表头层数(没有多表头则层数为1)
procedure SetDBGridEh(const Value: TDBGridEh);
function GetTitleRow: integer; //获取DBGridEh多表头层数
function GetTitleColumn: integer; //获取DBGridEh列数
public
//分解DBGridEh标题,由TitleCell二维动态数组返回
procedure GetTitleData(var TitleCell: TTitleCell);
published
property DBGridEh: TDBGridEh read FDBGridEh write SetDBGridEh;
property ColumnCount: integer read FColumnCount;
property RowCount: integer read FRowCount;
end;
TDBGridEhToExcel = class(TComponent)
private
FCol: integer;
FRow: integer;
FProgressForm: TForm; {进度窗体}
FGauge: TGauge; {进度条}
Stream: TStream; {输出文件流}
FBookMark: TBookmark;
FShowProgress: Boolean; {是否显示进度窗体}
FDBGridEh: TDBGridEh;
FBeginDate: TCaption; {开始日期}
FTitleName: TCaption; {Excel文件标题}
FEndDate: TCaption; {结束日期}
FUserName: TCaption; {制表人}
FFileName: string; {保存文件名}
procedure SetShowProgress(const Value: Boolean);
procedure SetDBGridEh(const Value: TDBGridEh);
procedure SetBeginDate(const Value: TCaption);
procedure SetEndDate(const Value: TCaption);
procedure SetTitleName(const Value: TCaption);
procedure SetUserName(const Value: TCaption);
procedure SetFileName(const Value: string);
procedure IncColRow;
procedure WriteBlankCell; {写空单元格}
{写数字单元格}
procedure WriteFloatCell(const AValue: Double; const IncStatus: Boolean = True);
{写整型单元格}
procedure WriteIntegerCell(const AValue: Integer; const IncStatus: Boolean = True);
{写字符单元格}
procedure WriteStringCell(const AValue: string; const IncStatus: Boolean = True);
procedure WritePrefix;
procedure WriteSuffix;
procedure WriteHeader; {输出Excel标题}
procedure WriteTitle; {输出Excel列标题}
procedure WriteDataCell; {输出数据集内容}
procedure WriteFooter; {输出DBGridEh表脚}
procedure SaveStream(aStream: TStream);
procedure CreateProcessForm(AOwner: TComponent); {生成进度窗体}
{根据表格修改数据集字段顺序及字段中文标题}
procedure SetDataSetCrossIndexDBGridEh;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExportToExcel; {输出Excel文件}
published
property DBGridEh: TDBGridEh read FDBGridEh write SetDBGridEh;
property ShowProgress: Boolean read FShowProgress write SetShowProgress;
property TitleName: TCaption read FTitleName write SetTitleName;
property BeginDate: TCaption read FBeginDate write SetBeginDate;
property EndDate: TCaption read FEndDate write SetEndDate;
property UserName: TCaption read FUserName write SetUserName;
各位朋友,PAS文件如下,当DBGridEh里面的内容超过65536条的时候,导出到EXCEL的时候就不正常,小弟想实现如下目的:将DBGridEh里面的内容导出到EXCEL的时候,超过6万条的,就自动导出到当前EXCEL文件的另外一个SHEET,如果当前的SHEET满了6万条,又继续导出到当前文件的另外一个SHEET,依次类推,使其导出的数据不局限于6万条记录左右,其实整个程序的难点就在于,如何判断当前的SHEET已经满,当前导出的记录已经导出到第几条,请问有没有大虾可以帮忙修改一下下面的PAS文件,使其可以实现上面的功能呢?
诚心向各位大虾求救,万分感谢!!!
unit U_DBGridEhToExcel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ComCtrls, ExtCtrls, StdCtrls, Gauges, DBGridEh, ShellApi;
type
TTitleCell = array of array of string;
//分解DBGridEh的标题
TDBGridEhTitle = class
private
FDBGridEh: TDBGridEh; //对应DBGridEh
FColumnCount: integer; //DBGridEh列数(指visible为True的列数)
FRowCount: integer; //DBGridEh多表头层数(没有多表头则层数为1)
procedure SetDBGridEh(const Value: TDBGridEh);
function GetTitleRow: integer; //获取DBGridEh多表头层数
function GetTitleColumn: integer; //获取DBGridEh列数
public
//分解DBGridEh标题,由TitleCell二维动态数组返回
procedure GetTitleData(var TitleCell: TTitleCell);
published
property DBGridEh: TDBGridEh read FDBGridEh write SetDBGridEh;
property ColumnCount: integer read FColumnCount;
property RowCount: integer read FRowCount;
end;
TDBGridEhToExcel = class(TComponent)
private
FCol: integer;
FRow: integer;
FProgressForm: TForm; {进度窗体}
FGauge: TGauge; {进度条}
Stream: TStream; {输出文件流}
FBookMark: TBookmark;
FShowProgress: Boolean; {是否显示进度窗体}
FDBGridEh: TDBGridEh;
FBeginDate: TCaption; {开始日期}
FTitleName: TCaption; {Excel文件标题}
FEndDate: TCaption; {结束日期}
FUserName: TCaption; {制表人}
FFileName: string; {保存文件名}
procedure SetShowProgress(const Value: Boolean);
procedure SetDBGridEh(const Value: TDBGridEh);
procedure SetBeginDate(const Value: TCaption);
procedure SetEndDate(const Value: TCaption);
procedure SetTitleName(const Value: TCaption);
procedure SetUserName(const Value: TCaption);
procedure SetFileName(const Value: string);
procedure IncColRow;
procedure WriteBlankCell; {写空单元格}
{写数字单元格}
procedure WriteFloatCell(const AValue: Double; const IncStatus: Boolean = True);
{写整型单元格}
procedure WriteIntegerCell(const AValue: Integer; const IncStatus: Boolean = True);
{写字符单元格}
procedure WriteStringCell(const AValue: string; const IncStatus: Boolean = True);
procedure WritePrefix;
procedure WriteSuffix;
procedure WriteHeader; {输出Excel标题}
procedure WriteTitle; {输出Excel列标题}
procedure WriteDataCell; {输出数据集内容}
procedure WriteFooter; {输出DBGridEh表脚}
procedure SaveStream(aStream: TStream);
procedure CreateProcessForm(AOwner: TComponent); {生成进度窗体}
{根据表格修改数据集字段顺序及字段中文标题}
procedure SetDataSetCrossIndexDBGridEh;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExportToExcel; {输出Excel文件}
published
property DBGridEh: TDBGridEh read FDBGridEh write SetDBGridEh;
property ShowProgress: Boolean read FShowProgress write SetShowProgress;
property TitleName: TCaption read FTitleName write SetTitleName;
property BeginDate: TCaption read FBeginDate write SetBeginDate;
property EndDate: TCaption read FEndDate write SetEndDate;
property UserName: TCaption read FUserName write SetUserName;