S
shodoy
Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是delphi7.0 与 office xp.
我的设想是在Excel表中每填入一行数据,就设定这一行的边界,不知如何使用变量来选定范围.
ExcelWorksheet1.Range['A1','D1'].Borders[3].Weight:=4;
ExcelWorksheet1.Range['B1','B1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['C1','C1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['D1','D1'].Borders[2].Weight:=4;
ExcelWorksheet1.Range['A1','A1'].Borders[1].Weight:=4;
ExcelWorksheet1.Range['A1','A1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['A1','D1'].Borders[4].Weight:=4;
上面是画第一行的边界.
从第二行开始,到最后一行,但是第后一行不确定,这用的是变量i来指定最后一行,那从第二生到最后一行的边界是如何画?
我用下面的方法行不通.请问我又错在哪里?
ExcelWorksheet1.Range['B1','B'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['C1','C'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['D1','D'+IntToStr(i)].Borders[2].Weight:=4;
ExcelWorksheet1.Range['A1','A'+IntToStr(i)].Borders[1].Weight:=4;
ExcelWorksheet1.Range['A1','A'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['A'+IntToStr(i),'D'+IntToStr(i)].Borders[4].Weight:=4;
另外还有一个问题就是:如何设定页眉和页尾的字体?
我的设想是在Excel表中每填入一行数据,就设定这一行的边界,不知如何使用变量来选定范围.
ExcelWorksheet1.Range['A1','D1'].Borders[3].Weight:=4;
ExcelWorksheet1.Range['B1','B1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['C1','C1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['D1','D1'].Borders[2].Weight:=4;
ExcelWorksheet1.Range['A1','A1'].Borders[1].Weight:=4;
ExcelWorksheet1.Range['A1','A1'].Borders[2].Weight:=2;
ExcelWorksheet1.Range['A1','D1'].Borders[4].Weight:=4;
上面是画第一行的边界.
从第二行开始,到最后一行,但是第后一行不确定,这用的是变量i来指定最后一行,那从第二生到最后一行的边界是如何画?
我用下面的方法行不通.请问我又错在哪里?
ExcelWorksheet1.Range['B1','B'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['C1','C'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['D1','D'+IntToStr(i)].Borders[2].Weight:=4;
ExcelWorksheet1.Range['A1','A'+IntToStr(i)].Borders[1].Weight:=4;
ExcelWorksheet1.Range['A1','A'+IntToStr(i)].Borders[2].Weight:=2;
ExcelWorksheet1.Range['A'+IntToStr(i),'D'+IntToStr(i)].Borders[4].Weight:=4;
另外还有一个问题就是:如何设定页眉和页尾的字体?