Hi,
I have faced similar issue.

POI 3.7 defines some methods in XSSFSheet.java class like lockInsertColumns(), 
lockInsertRows() and few more. 
They should actually allow inserting columns/rows, if sheet is already 
protected/locked.
They actually work reverse of what is expected and pass true to underlying API 
of CTWorksheet.

public void lockInsertColumns() {
        createProtectionFieldIfNotPresent();
        worksheet.getSheetProtection().setInsertColumns(true);
    }

public void lockInsertRows() {
        createProtectionFieldIfNotPresent();
        worksheet.getSheetProtection().setInsertRows(true);
    }

My suggestion is, these methods in XSSFSheet.java should pass false to 
underlying API to work correctly.


Thanks,
Amol Shinde
(O):- 91 (20) 30239400  extn:- 531


-----Original Message-----
From: Alex Panayotopoulos [mailto:[email protected]] 
Sent: Tuesday, July 05, 2011 9:02 PM
To: [email protected]
Subject: XSSF Locking

Hi all,

Can anybody get the XSSF sheet locking functionality working? I've been
testing it, but so far it looks like either *everything* is locked, or
nothing is. If I execute:

                XSSFWorkbook wb = new XSSFWorkbook();
                XSSFSheet s = wb.createSheet("Locking");
                s.lockDeleteColumns();
                s.enableLocking();
                wb.lockStructure();
                save(wb, "locking.xlsx");

Then I would expect a worksheet that allows all changes except column
deletion. However, the result is a completely locked-down worksheet,
similar to what I would get with a "protectSheet()" call. If I comment
out the "s.enableLocking()" line, then *all* changes are permitted. How
do I disable *just* column deletion?

N.B. I did find one other thread on this list about this problem, but
the example code did not solve the problem. I also searched for open
issues in Bugzilla, but found none. Should I open a new bug?

Thanks,

Alex Panayotopoulos, Software Engineer
ViaTelemetry Limited

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to