procedure TForm1.Button1Click(Sender: TObject); var aSheet : Variant; excel : OleVariant; workBook : OleVariant; workSheet : OleVariant; picture : OleVariant; workRange : OleVariant; i:integer; begin begin aSheet := CreateOleObject('Excel.Application'); aSheet.WorkBooks.Open('E:\明成软件\坤祥电镀\新建文件夹\123.xls'); aSheet.Cells[1,1].Value:='abc'; aSheet.Cells[1,2].Value:='efg'; workRange := asheet.Range[asheet.Cells.Item[6,1],asheet.Cells.item[6,1]]; //目标位置 picture := asheet.activeSheet.Pictures.Insert('E:\明成软件\坤祥电镀\新建文件夹\110120.jpg'); //插入图片 picture.left := workRange.left + 1; //左 picture.top := workRange.top + 1; //高 picture.width := workRange.width - 2; //宽度 picture.height := workRange.height - 2; //高度 picture := Unassigned; aSheet.Quit; end; end;
|
请发表评论