Delphi的GridEh控件导入CSV报错
unit Unit5;interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
DBGridEhGrouping, ToolCtrlsEh, DBGridEhToolCtrls, DynVarsEh, EhLibVCL, GridsEh,
DBAxisGridsEh, DBGridEh, Vcl.StdCtrls;
type
TForm5 = class(TForm)
DBGridEh1: TDBGridEh;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
uses
DBGridEhImpExp, ComObj, ActiveX, db;
procedure TForm5.Button1Click(Sender: TObject);
begin
try
OpenDialog1.Filter := '*.csv|文本文件';
OpenDialog1.FilterIndex := 1;
if OpenDialog1.Execute then
begin
LoadDBGridEhFromImportFile(TDBGridEhImportAsText, DBGridEh1, OpenDialog1.FileName, True);
end;
finally
OpenDialog1.Free;
end;
end;
end.
错误提示是什么?是不是字符编码的问题
@homejun
本帖最后由 冥界3大法王 于 2022-8-23 09:44 编辑homejun 发表于 2022-8-23 08:56
错误提示是什么?是不是字符编码的问题@homejun
unit Unit5;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
DBGridEhGrouping, ToolCtrlsEh, DBGridEhToolCtrls, DynVarsEh, Vcl.StdCtrls,
EhLibVCL, GridsEh, DBAxisGridsEh, DBGridEh, DBGridEhImpExp;
type
TForm5 = class(TForm)
DBGridEh1: TDBGridEh;
Button1: TButton;
OpenDialog1: TOpenDialog;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
OpenDialog1.Filter := 'csv file|*.csv';
OpenDialog1.DefaultExt := 'csv';
if OpenDialog1.Execute then
LoadDBGridEhFromImportFile(TDBGridEhImportAsUnicodeText, DBGridEh1, OpenDialog1.FileName, True);
end;
end.
delphi版本是多少? sunsjw 发表于 2022-8-23 10:05
delphi版本是多少?@homejun
11 @sunsjw LoadDBGridEhFromImportFile 这个方法是你自己实现的? sunsjw 发表于 2022-8-23 14:14
LoadDBGridEhFromImportFile 这个方法是你自己实现的?
原生安了控件就有了。 用Embarcadero Delphi感觉怎么样? 把 你编译的程序打包上来看一下。包含你的csv文件. 把调试符号一起带上
页:
[1]