biz yöntemi .Sheets.Add kullanmaya gerek yeni bir sayfa eklemek için, beş parametre (ondan önce levha, ondan sonra levha ve diğer 3 sahiptir , sadece tanrı bilir) bu durumda, sonuncusundan sonra aSheet'in ekleneceği (NULL, aSheet, NULL, NULL, 0) kullanılır. güle
uses
... OleServer, ExcelXP ...
type
TForm1 = class(TForm)
Button1: TButton;
ExcelApplication1: TExcelApplication;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
...
procedure TForm1.Button1Click(Sender: TObject);
var
Excelfile:OleVariant;
aBook: _WORKBOOK;
aSheet: _WORKSHEET;
begin
Excelfile:='c:\plantilla.xls';
ExcelApplication1.connect;
aBook:= ExcelApplication1.workbooks.add(Excelfile,0);
aSheet:= ExcelApplication1.sheets[aBook.Sheets.Count] as _WORKSHEET;
aBook.Sheets.Add(NULL,aSheet,NULL,NULL,0);
aSheet:= ExcelApplication1.sheets[aBook.Sheets.Count] as _WORKSHEET;
asheet.Name:='Test last position';
ExcelApplication1.visible[0]:=true;
ExcelApplication1.disconnect;
end;
Bilginize [ 'Worksheets.Add belirterek değilim diğer parametreler için Type.Missing kullanmak gerekir olduğunu bulma yaşıyorum '(http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.worksheets.add.aspx) yöntemi 4 isteğe bağlı parametreye sahiptir. – TLama
'Çalışma Kitabı.Sheets.Add.After;' hile yapar mı? – joostmakaay
Belki de 'Workbook.Sheets.Add (NULL, Workbook.Sheets.Count) 'gibi. – TLama