Example usage for org.apache.poi.ss.usermodel Sheet getProtect

List of usage examples for org.apache.poi.ss.usermodel Sheet getProtect

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Sheet getProtect.

Prototype

boolean getProtect();

Source Link

Document

Answer whether protection is enabled or disabled

Usage

From source file:com.vaadin.addon.spreadsheet.action.SpreadsheetAction.java

License:Open Source License

/**
 * Returns the protection status of the given sheet.
 * //from   w ww .ja  v a2s. c  o m
 * @param sheet
 *            Target sheet
 * @return true if the given sheet is protected
 */
protected boolean isSheetProtected(Sheet sheet) {
    return sheet.getProtect();
}

From source file:img.Img.java

/**
 * @param args the command line arguments
 *//* w  w w.  j  a v  a2s.c  o m*/

public static void main(String[] args) throws Exception {

    HSSFWorkbook result = new HSSFWorkbook();

    File dir = new File(UPLOAD_PATH);
    File[] directoryListing = dir.listFiles();

    Workbook wb = WorkbookFactory.create(new File(UPLOAD_PATH + "/T5UBF.XLSX"));

    Sheet sheet = wb.getSheetAt(0);
    System.out.println(sheet.getProtect());
    Row row = sheet.getRow(0);
    Cell cell = row.getCell(0);
    System.out.println(cell.getStringCellValue());

    /*if (directoryListing != null) {
        for (File child : directoryListing) {
    System.out.println("Reading from: "+child.getAbsolutePath());
    Workbook wb = WorkbookFactory.create(child);
    Sheet sheet  = wb.getSheetAt(0);
            
                
                
        }
                
    }*/
    FileOutputStream out = new FileOutputStream(new File("C:/Users/nk91008743/Desktop/result.xls"));
    result.write(out);
    out.close();
}