7)设置指定列的宽度(单位:字符个数),以第一列为例:
ExcelID.ActiveSheet.Columns[1].ColumnsWidth:=5;
8)设置指定行的高度(单位:磅)(1 磅=0.035 厘米),以第二行为例:
ExcelID.ActiveSheet.Rows[2].RowHeight:=1/0.035;//1 厘米
9)在第 8 行之前插入分页符:
ExcelID.WorkSheets[1].Rows[8].PageBreak:=1;
10)在第 8 列之前删除分页符:
ExcelID.ActiveSheet.Columns[4].PageBreak:=0;
11)指定边框线宽度:
ExcelID.ActiveSheet.Range['B3:D4'].Borders[2].Weight:=3;
With xlBook.ActiveSheet.Range("B2:L" + Trim(Str(i + 1))).Borders
1-左 2-右 3-顶 4-底 5-斜(\) 6-斜(/)
12)清除第一行第四列单元格公式:
ExcelID.ActiveSheet.Cells[1,4].ClearContents;
13)设置第一行字体属性:
ExcelID.ActiveSheet.Rows[1].Font.Name:='隶书';
ExcelID.ActiveSheet.Rows[1].Font.Color :=clBlue;
ExcelID.ActiveSheet.Rows[1].Font.Bold :=True;
ExcelID.ActiveSheet.Rows[1].Font.UnderLine:=True;
14)进行页面设置:
a.页眉:
ExcelID.ActiveSheet.PageSetup.CenterHeader:='报表演示';
b.页脚:
ExcelID.ActiveSheet.PageSetup.CenterFooter:='第&P 页';
c.页眉到顶端边距 2cm:
ExcelID.ActiveSheet.PageSetup.HeaderMargin:=2/0.035;
d.页脚到底端边距 3cm:
ExcelID.ActiveSheet.PageSetup.HeaderMargin:=3/0.035;
e.顶边距 2cm:
ExcelID.ActiveSheet.PageSetup.TopMargin:=2/0.035;
f.底边距 2cm:
ExcelID.ActiveSheet.PageSetup.BottomMargin:=2/0.035;
g.左边距 2cm:
ExcelID.ActiveSheet.PageSetup.LeftMargin:=2/0.035;
h.右边距 2cm:
ExcelID.ActiveSheet.PageSetup.RightMargin:=2/0.035;
i.页面水平居中:
ExcelID.ActiveSheet.PageSetup.CenterHorizontally:=2/0.035;
j.页面垂直居中:
ExcelID.ActiveSheet.PageSetup.CenterVertically:=2/0.035;
k.打印单元格网线:
ExcelID.ActiveSheet.PageSetup.PrintGridLines:=True;
15)拷贝操作:
a.拷贝整个工作表:
评论5
最新资源