二
二勇哥
Unregistered / Unconfirmed
GUEST, unregistred user!
那位老兄遇到过下面的问题?!
var
VExcel,pbreaklevariant;
i: Integer;
begin
VExcel := CreateOleObject('Excel.Application');
//......省略了部分代码,完成打开EXCEL和生成有4页内容的Worksheet;
i:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.Count;
showmessage(inttostr(i)); //显示‘3’,即集合中有三个HPageBreak
PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[1].Location;
showmessage(PBreak.value); //正常
-->PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[2].Location;
//运行到这一句提示错误,显示“无效索引”!!!
showmessage(PBreak.value);
PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[3].Location;
showmessage(PBreak.value);
end;
var
VExcel,pbreaklevariant;
i: Integer;
begin
VExcel := CreateOleObject('Excel.Application');
//......省略了部分代码,完成打开EXCEL和生成有4页内容的Worksheet;
i:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.Count;
showmessage(inttostr(i)); //显示‘3’,即集合中有三个HPageBreak
PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[1].Location;
showmessage(PBreak.value); //正常
-->PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[2].Location;
//运行到这一句提示错误,显示“无效索引”!!!
showmessage(PBreak.value);
PBreak:=VExcel.WorkBooks[1].Worksheets[1].HPageBreaks.item[3].Location;
showmessage(PBreak.value);
end;