Package org.apache.poi.hssf.model

Examples of org.apache.poi.hssf.model.Sheet


   * Test WSBboolRecord fields get set in the user model.
   */
  public void testWSBool() {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet s = wb.createSheet();
    Sheet sheet = s.getSheet();
    WSBoolRecord record =
        (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);

    // Check defaults
    assertEquals(true, record.getAlternateExpression());
    assertEquals(true, record.getAlternateFormula());
    assertEquals(false, record.getAutobreaks());
View Full Code Here


   * Test that the ProtectRecord is included when creating or cloning a sheet
   */
  public void testProtect() {
    HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet hssfSheet = workbook.createSheet();
    Sheet sheet = hssfSheet.getSheet();
    ProtectRecord protect = sheet.getProtect();

    assertFalse(protect.getProtect());

    // This will tell us that cloneSheet, and by extension,
    // the list forms of createSheet leave us with an accessible
    // ProtectRecord.
    hssfSheet.setProtect(true);
    Sheet cloned = sheet.cloneSheet();
    assertNotNull(cloned.getProtect());
    assertTrue(hssfSheet.getProtect());
  }
View Full Code Here

  public void testProtectSheet() {
    short expected = (short)0xfef1;
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet s = wb.createSheet();
    s.protectSheet("abcdefghij");
    Sheet sheet = s.getSheet();
    ProtectRecord protect = sheet.getProtect();
    PasswordRecord pass = sheet.getPassword();
    assertTrue("protection should be on",protect.getProtect());
    assertTrue("object protection should be on",sheet.isProtected()[1]);
    assertTrue("scenario protection should be on",sheet.isProtected()[2]);
    assertEquals("well known value for top secret hash should be "+Integer.toHexString(expected).substring(4),expected,pass.getPassword());
  }
View Full Code Here

              switch (bof.getType()) {
               case BOFRecord.TYPE_WORKBOOK:
                 currentmodel = new Workbook();                
               break;
               case BOFRecord.TYPE_WORKSHEET:
                 currentmodel = new Sheet();                                 
               break;
              default:
                   throw new RuntimeException("Unsupported model type "+bof.getType());
              }               
              
View Full Code Here

        int recOffset = workbook.getNumRecords();
        int sheetNum = 0;

        while (recOffset < records.size())
        {
            Sheet sheet = Sheet.createSheet(records, sheetNum++, recOffset );

            recOffset = sheet.getEofLoc()+1;
            sheet.convertLabelRecords(
                    workbook);   // convert all LabelRecord records to LabelSSTRecord
            HSSFSheet hsheet = new HSSFSheet(workbook, sheet);

            sheets.add(hsheet);
View Full Code Here

    public void testBackupRecord()
            throws Exception
    {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet s = wb.createSheet();
        Sheet sheet = s.getSheet();

        assertEquals(true, sheet.getGridsetRecord().getGridset());
        s.setGridsPrinted(true);
        assertEquals(false, sheet.getGridsetRecord().getGridset());
    }
View Full Code Here

    public void testVerticallyCenter()
            throws Exception
    {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet s = wb.createSheet();
        Sheet sheet = s.getSheet();
        VCenterRecord record =
                (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid);

        assertEquals(false, record.getVCenter());
        s.setVerticallyCenter(true);
        assertEquals(true, record.getVCenter());
View Full Code Here

    public void testWSBool()
    {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet s = wb.createSheet();
        Sheet sheet = s.getSheet();
        WSBoolRecord record =
                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);

        // Check defaults
        assertEquals(true, record.getAlternateExpression());
        assertEquals(true, record.getAlternateFormula());
        assertEquals(false, record.getAutobreaks());
View Full Code Here

        int numRecords = workbook.getNumRecords();
        int sheetnum = 0;

        while (numRecords < records.size())
        {
            Sheet sheet = Sheet.createSheet(records, sheetnum, numRecords);

            numRecords += sheet.getNumRecords();
            sheet.convertLabelRecords(
                    workbook);   // convert all LabelRecord records to LabelSSTRecord
            HSSFSheet hsheet = new HSSFSheet(workbook, sheet);

            sheets.add(hsheet);
View Full Code Here

        int numRecords = workbook.getNumRecords();
        int sheetnum   = 0;

        while (numRecords < records.size())
        {
            Sheet sheet = Sheet.createSheet(records, sheetnum, numRecords);

            numRecords += sheet.getNumRecords();
            sheet.convertLabelRecords(
                workbook);   // convert all LabelRecord records to LabelSSTRecord
            HSSFSheet hsheet = new HSSFSheet(workbook, sheet);

            sheets.add(hsheet);
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.model.Sheet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.