急!!ole中Excel无法保存??,
ExcelApplication1.ActiveWorkBook.SaveAs(Filename := SaveDialog1.FileName,
FileFormat:=xlNormal,
Password := '',
WriteResPassword := '',
ReadOnlyRecommended := False,
CreateBackup := False);
和ExcelWorkbook1.SaveAs(SaveDialog1.FileName)都不行。
ExcelApplication1.ActiveWorkBook.SaveAs(Filename := SaveDialog1.FileName,
FileFormat:=xlNormal,
Password := '',
WriteResPassword := '',
ReadOnlyRecommended := False,
CreateBackup := False);
和ExcelWorkbook1.SaveAs(SaveDialog1.FileName)都不行。
ExcelApp.SaveAs( 'C:\Excel\Demo1.xls' );Control:
ExcelApplication1.SaveAs( 'C:\Excel\Demo1.xls' );
ExcelApplication1.ActiveWorkBook
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Comobj,Excel2000, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
ExcelApp:Variant; implementation{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
chexingshu:integer;
Excelx1:string;
Excelx2:string;
xl,Cell1: olevariant;
Sum:integer;
begin
ExcelApp := CreateOleObject( 'Excel.Application' );
ExcelApp.Caption := '昆明理工大学学生素质综合测评表打印';
ExcelApp.WorkBooks.Add;
ExcelApp.WorkSheets[1].Activate;
ExcelApp.Visible := True;
ExcelApp.ActiveWindow.Zoom := 75;
chexingshu:=24;
excelx2:='a1';
ExcelApp.Cells[1,1].Value :='昆明理工大学学生素质综合测评表';
ExcelApp.cells.Item[1, 1].font.size := 26;
ExcelApp.cells.Item[1, 1].RowHeight := 50;
ExcelApp.cells.Item[1 , 1].Font.Bold := True;
ExcelApp.cells.Item[1, 1].HorizontalAlignment := xlCenter;
ExcelApp.cells.Item[1, 1].font.Name := '黑体';
end;procedure TForm1.Button2Click(Sender: TObject);
begin
ExcelApp.ActiveWorkbook.SaveAs('c:\1k1.xls');
end;end.