Print Page | Close Window

Excel page number/count

Printed From: TMS Software
Category: .NET Components
Forum Name: .NET Flexcel
Forum Discription:
Printed Date: 30 May 2020 at 5:01pm

Topic: Excel page number/count
Posted By: pdv-software GmbH Firma
Subject: Excel page number/count
Date Posted: 07 Apr 2016 at 4:47pm

is it possible to print the current page number and the total page count in an Excel cell? I know that it is possible via Excel functionality within the header and footer. But I need these information in a "normal" Excel cell. Does FlexCel offer any placeholder, variable or function to get these information?

Best regards,
Christian Sack

Posted By: Adrian Gallero
Date Posted: 07 Apr 2016 at 4:55pm
Sorry, this is not possible because the number of pages and the page number depend in a lot of factors which are not known until print time: paper size and printer used, print to fit setting, zoom, etc. 

 The page number might even change because the "hard margins" in the specific printer you are printing to, which are the dead space where the paper is physically hold by the printer. A bigger margin might make the printing area smaller, causing a column or row to move to the next page.

Note that this doesn't apply to header and footers, because this is a variable you set that is filled at print time with the correct information. But Excel doesn't have any similar variable to store the page number in a cell, so we would need to calculate that number in advance and enter it into the cell. But we don't know the number of pages until the very moment you print.

Print Page | Close Window