From bf78b31e9ccd74da40439fee11ae3d2262358524 Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Thu, 6 Feb 2003 10:29:45 +0000 Subject: Support for freezepanes / split panes / header rows and columns on printouts... see documentation for details. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353002 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/xdocs/faq.xml | 15 ++++ src/documentation/xdocs/hssf/quick-guide.xml | 116 +++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) (limited to 'src/documentation') diff --git a/src/documentation/xdocs/faq.xml b/src/documentation/xdocs/faq.xml index fdfbbb4262..a702b247be 100644 --- a/src/documentation/xdocs/faq.xml +++ b/src/documentation/xdocs/faq.xml @@ -267,5 +267,20 @@ fileOut.close(); + + + Will Poi read any spreadsheet and rewrite it with modifications. + + + Poi is not guanteed to read the contents of any spreadsheet. + Certain features may cause spreadsheets to fail to read. More + problematic is rewriting spreadsheets. Poi tried hard to + preserve the records of the original spreadsheet but some + features may cause problems. We advise that you limit the + formatting of spreadsheets you process so as to not be + unpleasantly suprised at a later stage. + + + diff --git a/src/documentation/xdocs/hssf/quick-guide.xml b/src/documentation/xdocs/hssf/quick-guide.xml index e53486d9ac..fb2ca011e7 100644 --- a/src/documentation/xdocs/hssf/quick-guide.xml +++ b/src/documentation/xdocs/hssf/quick-guide.xml @@ -35,6 +35,9 @@
  • Set page numbers on the footer of a sheet.
  • Shift rows.
  • Set a sheet as selected.
  • +
  • Set the zoom magnification for a sheet.
  • +
  • Create split and freeze panes.
  • +
  • Repeating rows and columns.
  • @@ -535,6 +538,119 @@ fileOut.close();
    + + +
    +

    + The zoom is expressed as a fraction. For example to + express a zoom of 75% use 3 for the numerator and + 4 for the denominator. +

    + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet1 = wb.createSheet("new sheet"); + sheet1.setZoom(3,4); // 75 percent magnification + FileOutputStream fileOut = new FileOutputStream("workbook.xls"); + wb.write(fileOut); + fileOut.close(); + +
    + + +
    +

    + There are two types of panes you can create; freeze panes and split panes. +

    +

    + A freeze pane is split by columns and rows. You create + a freeze pane using the following mechanism: +

    +

    + sheet1.createFreezePane( 3, 2, 3, 2 ); +

    +

    + The first two parameters are the columns and rows you + wish to split by. The second two parameters indicate + the cells that are visible in the bottom right quadrant. +

    +

    + + Split pains appear differently. The split area is + divided into four separate work area's. The split + occurs at the pixel level and the user is able to + adjust the split by dragging it to a new position. +

    +

    + + Split panes are created with the following call: +

    +

    + sheet2.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT ); +

    +

    + + The first parameter is the x position of the split. + This is in 1/20th of a point. A point in this case + seems to equate to a pixel. The second parameter is + the y position of the split. Again in 1/20th of a point. +

    +

    + The last parameter indicates which pane currently has + the focus. This will be one of HSSFSheet.PANE_LOWER_LEFT, + PANE_LOWER_RIGHT, PANE_UPPER_RIGHT or PANE_UPPER_LEFT. +

    + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet1 = wb.createSheet("new sheet"); + HSSFSheet sheet2 = wb.createSheet("second sheet"); + HSSFSheet sheet3 = wb.createSheet("third sheet"); + HSSFSheet sheet4 = wb.createSheet("fourth sheet"); + + // Freeze just one row + sheet1.createFreezePane( 0, 1, 0, 1 ); + // Freeze just one column + sheet2.createFreezePane( 1, 0, 1, 0 ); + // Freeze the columns and rows (forget about scrolling position of the lower right quadrant). + sheet3.createFreezePane( 2, 2 ); + // Create a split with the lower left side being the active quadrant + sheet4.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT ); + + FileOutputStream fileOut = new FileOutputStream("workbook.xls"); + wb.write(fileOut); + fileOut.close(); + +
    + + +
    +

    + It's possible to set up repeating rows and columns in + your printouts by using the setRepeatingRowsAndColumns() + function in the HSSFWorkbook class. +

    +

    + This function Contains 5 parameters. + The first parameter is the index to the sheet (0 = first sheet). + The second and third parameters specify the range for the columns to repreat. + To stop the columns from repeating pass in -1 as the start and end column. + The fourth and fifth parameters specify the range for the rows to repeat. + To stop the columns from repeating pass in -1 as the start and end rows. +

    + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet1 = wb.createSheet("new sheet"); + HSSFSheet sheet2 = wb.createSheet("second sheet"); + + // Set the columns to repeat from column 0 to 2 on the first sheet + wb.setRepeatingRowsAndColumns(0,0,2,-1,-1); + // Set the the repeating rows and columns on the second sheet. + wb.setRepeatingRowsAndColumns(1,4,5,1,2); + + FileOutputStream fileOut = new FileOutputStream("workbook.xls"); + wb.write(fileOut); + fileOut.close(); + +
    -- cgit v1.2.3