Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hssf.record.aggregates
Class WorksheetProtectionBlock

    java.lang.Object
      org.apache.poi.hssf.record.RecordBase
          org.apache.poi.hssf.record.aggregates.RecordAggregate
              org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock

    public final class WorksheetProtectionBlock

extends RecordAggregate

Groups the sheet protection records for a worksheet.

See OOO excelfileformat.pdf sec 4.18.2 'Sheet Protection in a Workbook (BIFF5-BIFF8)'

Author:
  Josh Micich

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.poi.hssf.record.aggregates.RecordAggregate
`RecordAggregate.PositionTrackingVisitor, RecordAggregate.RecordVisitor`

Constructor Summary
`WorksheetProtectionBlock()` Creates an empty WorksheetProtectionBlock

Method Summary
`void` | `addRecords(RecordStream rs)` This method reads `WorksheetProtectionBlock` records from the supplied RecordStream until the first non-WorksheetProtectionBlock record is encountered.
`ScenarioProtectRecord` | `getHCenter()`
`int` | `getPasswordHash()`
`PasswordRecord` | `getPasswordRecord()`
`static boolean` | `isComponentRecord(int sid)`
`boolean` | `isObjectProtected()`
`boolean` | `isScenarioProtected()`
`boolean` | `isSheetProtected()`
`void` | `protectSheet(java.lang.String password, boolean shouldProtectObjects, boolean shouldProtectScenarios)` protect a spreadsheet with a password (not encrypted, just sets protect flags and the password.
`void` | `visitContainedRecords(RecordAggregate.RecordVisitor rv)` Visit each of the atomic BIFF records contained in this `RecordAggregate` in the order that they should be written to file.

Methods inherited from class org.apache.poi.hssf.record.aggregates.RecordAggregate
`getRecordSize, serialize`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WorksheetProtectionBlock

    public WorksheetProtectionBlock()

  Creates an empty WorksheetProtectionBlock

Method Detail

### isComponentRecord

    public static boolean isComponentRecord(int sid)

  Returns:
    `true` if the specified Record sid is one belonging to the 'Page Settings Block'.

### visitContainedRecords

    public void visitContainedRecords(RecordAggregate.RecordVisitor rv)

  Description copied from class: `RecordAggregate`
  Visit each of the atomic BIFF records contained in this `RecordAggregate` in the order that they should be written to file. Implementors may or may not return the actual `Record`s being used to manage POI's internal implementation. Callers should not assume either way, and therefore only attempt to modify those `Record`s after cloning

  Specified by:
    `visitContainedRecords` in class `RecordAggregate`

### getPasswordRecord

    public PasswordRecord getPasswordRecord()

### getHCenter

    public ScenarioProtectRecord getHCenter()

### addRecords

    public void addRecords(RecordStream rs)

  This method reads `WorksheetProtectionBlock` records from the supplied RecordStream until the first non-WorksheetProtectionBlock record is encountered. As each record is read, it is incorporated into this WorksheetProtectionBlock.

  As per the OOO documentation, the protection block records can be expected to be written together (with no intervening records), but earlier versions of POI (prior to Jun 2009) didn't do this. Workbooks with sheet protection created by those earlier POI versions seemed to be valid (Excel opens them OK). So PO allows continues to support reading of files with non continuous worksheet protection blocks.

  Note - when POI writes out this WorksheetProtectionBlock, the records will always be written in one consolidated block (in the standard ordering) regardless of how scattered the records were when they were originally read.

### protectSheet

    public void protectSheet(java.lang.String password,
                             boolean shouldProtectObjects,
                             boolean shouldProtectScenarios)

  protect a spreadsheet with a password (not encrypted, just sets protect flags and the password.

  Parameters:
    `password` - to set. Pass `null` to remove all protection
    `shouldProtectObjects` - are protected
    `shouldProtectScenarios` - are protected

### isSheetProtected

    public boolean isSheetProtected()

### isObjectProtected

    public boolean isObjectProtected()

### isScenarioProtected

    public boolean isScenarioProtected()

### getPasswordHash

    public int getPasswordHash()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD