[]
        
(Showing Draft Content)

PagePrintEventArgs

Class PagePrintEventArgs

java.lang.Object
com.grapecity.documents.excel.EventArgs
com.grapecity.documents.excel.PagePrintEventArgs
Direct Known Subclasses:
PagePrintedEventArgs, PagePrintingEventArgs

public class PagePrintEventArgs extends EventArgs
Provides data for the PagePrinting and PagePrinted events.

This event data class supplies page-related information for print processing, including the 1-based page number of the current page and the total page count.


 worksheet.getRange("A1:A96").setValue(1);
 PdfSaveOptions options = new PdfSaveOptions();
 options.getPagePrintingEvent().addListener(new EventHandler<PagePrintingEventArgs>() {
     public void invoke(Object sender, PagePrintingEventArgs e) {
         int pageNumber = e.getPageNumber();
         int pageCount = e.getPageCount();
     }
 });
 workbook.save(new ByteArrayOutputStream(), options);
 
  • Constructor Details

    • PagePrintEventArgs

      public PagePrintEventArgs()
  • Method Details

    • getPageNumber

      public final int getPageNumber()
      Gets the 1-based page number associated with this event.

      This value identifies the page currently being processed in the PagePrinting or PagePrinted event sequence.

      
       worksheet.getRange("A1:A96").setValue(1);
       PdfSaveOptions options = new PdfSaveOptions();
       options.getPagePrintingEvent().addListener(new EventHandler<PagePrintingEventArgs>() {
           public void invoke(Object sender, PagePrintingEventArgs e) {
               int pageNumber = e.getPageNumber();
           }
       });
       workbook.save(new ByteArrayOutputStream(), options);
       
      Returns:
      The 1-based page number associated with the current event.
    • getPageCount

      public final int getPageCount()
      Gets the total number of pages associated with the current page printing event.

      This value represents the total page count for the print operation that raised the current PagePrintingEventArgs or PagePrintedEventArgs instance.

      
       worksheet.getRange("A1:A96").setValue(1);
       PdfSaveOptions options = new PdfSaveOptions();
       options.getPagePrintingEvent().addListener(new EventHandler<PagePrintingEventArgs>() {
           public void invoke(Object sender, PagePrintingEventArgs e) {
               int pageCount = e.getPageCount();
           }
       });
       workbook.save(new ByteArrayOutputStream(), options);
       
      Returns:
      The total number of pages for the current print operation.