public final class WorksheetProtectionBlock extends RecordAggregate
See OOO excelfileformat.pdf sec 4.18.2 'Sheet Protection in a Workbook (BIFF5-BIFF8)'
(对工作表的工作表保护记录进行分组。请参阅 OOO excelfileformat.pdf sec 4.18.2 '工作簿中的工作表保护 (BIFF5-BIFF8)')RecordAggregate.PositionTrackingVisitor, RecordAggregate.RecordVisitor
Constructor and Description |
---|
WorksheetProtectionBlock()
Creates an empty WorksheetProtectionBlock
|
Modifier and Type | Method and Description |
---|---|
void |
addRecords(RecordStream rs)
This method reads
WorksheetProtectionBlock records from the supplied RecordStream until the first non-WorksheetProtectionBlock record is encountered.
(此方法从提供的 RecordStream 中读取 WorksheetProtectionBlock 记录,直到遇到第一个非 WorksheetProtectionBlock 记录。)
|
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.
(按照写入文件的顺序访问此 RecordAggregate 中包含的每个原子 BIFF 记录。)
|
getRecordSize, serialize
public WorksheetProtectionBlock()
public static boolean isComponentRecord(int sid)
true
if the specified Record sid is one belonging to the 'Page Settings Block'.
(如果指定的记录 sid 属于“页面设置块”,则为 true。)
public void visitContainedRecords(RecordAggregate.RecordVisitor rv)
RecordAggregate
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
(按照写入文件的顺序访问此 RecordAggregate 中包含的每个原子 BIFF 记录。实施者可能会或可能不会返回用于管理 POI 内部实施的实际记录。调用者不应采取任何一种方式,因此仅在克隆后尝试修改这些记录)
visitContainedRecords
in class
RecordAggregate
(类 RecordAggregate 中的 visitContainedRecords)
rv
- The visitor to use for callbacks while walking this object
(rv - 访问此对象时用于回调的访问者)
public PasswordRecord getPasswordRecord()
public ScenarioProtectRecord getHCenter()
public void addRecords(RecordStream rs)
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.
(此方法从提供的 RecordStream 中读取 WorksheetProtectionBlock 记录,直到遇到第一个非 WorksheetProtectionBlock 记录。在读取每条记录时,会将其合并到此 WorksheetProtectionBlock 中。根据 OOO 文档,可以将保护块记录一起写入(没有中间记录),但 POI 的早期版本(2009 年 6 月之前)没有这样做。由早期 POI 版本创建的具有工作表保护的工作簿似乎是有效的(Excel 可以正常打开它们)。所以 PO 允许继续支持读取具有非连续工作表保护块的文件。注意 - 当 POI 写出此 WorksheetProtectionBlock 时,记录将始终写入一个合并块中(按标准顺序),无论最初读取记录时记录的分散程度如何。)public void protectSheet(java.lang.String password, boolean shouldProtectObjects, boolean shouldProtectScenarios)
password
- to set. Pass
null
to remove all protection
(密码 - 设置。传递 null 以删除所有保护)
shouldProtectObjects
- are protected
(shouldProtectObjects - 受保护)
shouldProtectScenarios
- are protected
(shouldProtectScenarios - 受保护)
public boolean isSheetProtected()
public boolean isObjectProtected()
public boolean isScenarioProtected()
public int getPasswordHash()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.