Bug 8739

Summary: [RFE]ability to freeze rows and columns in HSSF
Product: POI Reporter: Michael Peterson <midpeter>
Component: HSSFAssignee: POI Developers List <dev>
Severity: enhancement CC: cjohannsen
Priority: P3    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Michael Peterson 2002-05-02 12:50:02 UTC
Enhancement request:
Ability to freeze rows and/or columns in HSSF so that they do not scroll when
displayed in Excel.  My user base really needs this functionality.

My experience with this feature comes from using the perl module
Spreadsheet::WriteExcel which does allow freezing.

The code to do this in the Spreadsheet::WriteExcel module is:
    my $workbook = Spreadsheet::WriteExcel->new($out_file);
    my $worksheet = $workbook->addworksheet("Primers");

    # freeze the header row
    $worksheet->freeze_panes(1, 0);

Here is a snippet from the Spreadsheet::WriteExcel man page, if it is of use to
you when designing the API for it:

  freeze_panes($row, $col, $top_row, $left_col)

  This method can be used to divide a worksheet into horizontal or vertiĀ­
  cal regions known as panes and to also "freeze" these panes so that the
  splitter bars are not visible. This is the same as the `Window->Freeze
  Panes' menu command in Excel

  The parameters `$row' and `$col' are used to specify the location of the
  split. It should be noted that the split is specified at the top or left
  of a cell and that the method uses zero based indexing. Therefore to
  freeze the first row of a worksheet it is necessary to specify the split
  at row 2 (which is 1 as the zero-based index). This might lead you to
  think that you are using a 1 based index but this is not the case.

  You can set one of the `$row' and `$col' parameters as zero if you do
  not want either a vertical or horizontal split.


      $worksheet->freeze_panes(1, 0); # Freeze the first row
      $worksheet->freeze_panes('A2'); # Same using A1 notation
      $worksheet->freeze_panes(0, 1); # Freeze the first column
      $worksheet->freeze_panes('B1'); # Same using A1 notation
      $worksheet->freeze_panes(1, 2); # Freeze first row and first 2 cols
      $worksheet->freeze_panes('C2'); # Same using A1 notation

  The parameters `$top_row' and `$left_col' are optional. They are used to
  specify the top-most or left-most visible row or column in the scrolling
  region of the panes. For example to freeze the first row and to have the
  scrolling region begin at row twenty:

      $worksheet->freeze_panes(1, 0, 20, 0);
Comment 1 Andy Oliver 2002-05-02 15:13:33 UTC
Made RFE, annotated that it would be a 2.0 feature.  Not occur in the upcomming
1.5 or 1.5.1 (predicting that 1.5 has some bugs :-O ), slated for 3.0 until
someone claims this one and goes to implement it.  (if they don't I'll do it in 3.0)
Comment 2 Andy Oliver 2002-05-10 03:05:07 UTC
*** Bug 8937 has been marked as a duplicate of this bug. ***
Comment 3 Mahesh Vannavada 2002-12-23 14:35:23 UTC
This is probably the most needed and most commonly used functionality by Excel 
users that is missing from HSSF
Comment 4 Andy Oliver 2002-12-23 15:22:07 UTC
and yet it has only 2 votes ;-)
Comment 5 Danny Mui 2003-02-25 03:33:43 UTC
Added to 1.9-dev as of 2/6/2003

int, int, int)