Так можно считать количество страниц в документе Excel.
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | procedure ExcelPageCount;
var
i: Integer ;
SumPages: Integer ;
begin
Excel := CreateOleObject( 'Excel.Application' );
Excel . Workbooks . Open( 'C:\money.xls' , False );
DocPages := 0 ;
for i := 1 to Excel . Workbooks[ 1 ].Sheets . Count do
begin
Workbook := Excel . ActiveWorkBook . WorkSheets[i];
Workbook . PageSetup . LeftMargin := 0 ;
Workbook . PageSetup . RightMargin := 0 ;
SumPages := DocPages + Workbook . PageSetup . Pages . Count;
end ;
ShowMessage(IntToStr(DocPages));
end ;
|