Exemple #1
0
  /** Ajustar las propiedades de las hojas. */
  protected void configPage() {

    HSSFSheet sheet = getExcel().getActiveSheet();

    HSSFPrintSetup ps = sheet.getPrintSetup();

    sheet.setDisplayGridlines(false);
    // Dejar fijo un conjuto filas o/y columnas
    // sheet.createFreezePane( 0, 3 ); // deja fijas las 3 primeras filas.
    // sheet.createFreezePane( 1, 0, 1, 0 ); // deja fija la primera columna.
    // Create a split with the lower left side being the active quadrant
    // sheet.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT );

    // margen bottom de la hoja 0.6 = 1.5 en Excel (para que no se solapen las filas con el footer)
    sheet.setMargin((short) 3, 0.6);
    // marcar el radiobutton de ajustar a la página
    sheet.setAutobreaks(true);
    // excel.setColumnWidth(2, 30);
    // ajustar a la página 1 a 500 páginas.
    // excel.setFitToPage();
    // sheet.setVerticallyCenter(true);
    ps.setFitWidth((short) 1);
    ps.setFitHeight((short) 500);
    // horizontal
    ps.setLandscape(landscape);

    // Crear agrupaciones de filas o columnas.
    // sheet.groupRow((short)3,(short)5);
    // sheet.setRowGroupCollapsed((short)3, true);
  }