그러니까
현재 TMS그리드로 만들어놓은게 있고
form은 2개입니다.
문제는 이것을 엑셀파일로 저장해야하는데
현재는 각각 저장하도록 되어있습니다.
근데 이것을 한개의 엑셀파일에 각각 시트로 나눠서 저장하고 싶거든요.
방법을 아시면 가르침을 바랍니다.
현재 한개의 그리드를 한개의 파일로 저장하는 소스는 다음과 같습니다.
-----------------------------------------------------------------
procedure TMainF.N8Click(Sender: TObject);
var
AExporter: TAdvGridExcelIO;
ADialog: TSaveDialog;
sFileName: string;
ADefaultFileName : String;
begin
if AlarmListF = nil then AlarmListF := TAlarmListF.Create(Self);
sFileName := '';
ADefaultFileName := 'Aging_'+FormatDateTime('yyyymmddhhnn',now)+'_Alarm'+'.xls';
ADialog := TSaveDialog.Create(nil);
try
ADialog.DefaultExt := 'XLS';
ADialog.Filter := '*.XLS';
ADialog.FileName := ADefaultFileName;
if ADialog.Execute then sFileName := ADialog.FileName;
finally
ADialog.Free;
end;
if sFileName = '' then Exit;
AExporter := TAdvGridExcelIO.Create(nil);
try
with AExporter do begin
AdvStringGrid := AlarmListF.AdvStringGrid1;
Options.ExportCellFormats := False;
//Options.ExportFormulas := True;
Options.ExportOverwrite := omWarn;
Options.ExportOverwriteMessage := '%s 이 존재합니다. 덮어씌우시겠습니까?';
Options.ExportHardBorders := True;
GridStartCol := 0;
GridStartRow := 0;
XLSExport(sFileName);
end;
finally
AExporter.Free;
end;
if Application.MessageBox('엑셀파일을 열겠습니까?',Pchar(Caption)
,Mb_YesNo + MB_ICONQUESTION) = mrYes then
ShellExecute( 0, 'Open', PChar(sFileName), nil, nil, SW_SHOW);
end;
-------------------------------------------------------------------------
TMS는 5.5.1.0 버전 쓰고있습니다.
|