delphi操作excel語法

2022-04-19 17:26:24 字數 1573 閱讀 6381

(一) 使用動態建立的方法

sheet3.columns[1].columnwidth :=20;

設定單元格居中:

設定單元格居右:

14) 進行頁面設定:

15) 拷貝操作:

5) 新增新工作表:

var temp_worksheet: _worksheet;

begin

temp_worksheet:=excelworkbook1.

worksheets.add(emptyparam,emptyparam,emptyparam,emptyparam,0) as _worksheet;

excelworksheet1.connectto(temp_worksheet);

end;

17) 拷貝操作:

2)增加乙個二維圖

achart:=asheet1.chartobjects.add(100,100,200,200);

3)選擇二維圖的形態

achart.chart.charttype:=4;

4)給二維圖賦值

series:=achart.chart.seriescollection;

range:=sheet1!r2c3:r3c9;

series.add(range,true);

5)加上二維圖的標題

achart.chart.hastitle:=true;

achart.chart.charttitle.characters.text:=』 excle二維圖』

6)改變二維圖的標題字型大小

achart.chart.charttitle.font.size:=6;

7)給二維圖加下標說明

achart.chart.axes(xlcategory, xlprimary).hastitle := true;

achart.chart.axes(xlcategory, xlprimary).axistitle.characters.text := ''下標說明'';

8)給二維圖加左標說明

achart.chart.axes(xlvalue, xlprimary).hastitle := true;

achart.chart.axes(xlvalue, xlprimary).axistitle.characters.text := ''左標說明'';

9)給二維圖加右標說明

achart.chart.axes(xlvalue, xlsecondary).hastitle := true;

achart.chart.axes(xlvalue, xlsecondary).axistitle.characters.text := ''右標說明'';

10)改變二維圖的顯示區大小

achart.chart.plotarea.left := 5;

achart.chart.plotarea.width := 223;

achart.chart.plotarea.height := 108;

11)給二維圖座標軸加上說明

achart.chart.seriescollection[1].name:=''座標軸說明'';

delphi操作excel語法

一 使用動態建立的方法 sheet3.columns 1 columnwidth 20 設定單元格居中 設定單元格居右 14 進行頁面設定 15 拷貝操作 5 新增新工作表 var temp worksheet worksheet begin temp worksheet excelworkbook...

Delphi操作Excel日誌記錄

1 匯出資料uses comobj procedure tform10.execlexit var h,k integer excelid olevariant s string begin tryexcept exit end tryk adoqry.recordcount excelid.vis...

Delphi基礎語法

1 lowercase const s string string uppercase const s string string 2 comparestr const s1,s2 string integer 本函式區分大小寫,是對比字母ascii的值,得出值的差,是從第乙個字母開始對比,如果對比...