Bug 8739 - [RFE]ability to freeze rows and columns in HSSF
Summary: [RFE]ability to freeze rows and columns in HSSF
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P3 enhancement with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 8937 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-05-02 12:50 UTC by Michael Peterson
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.

  Examples:

      $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

http://jakarta.apache.org/poi/javadocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#createFreezePane(int,
int, int, int)