We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hidden column became visible after protecting sheet

Hi there.

I have a excel sheet with column A/B/C be hidden.
when protect with following code, the hidden column becomes visible.
So can you help to figure out what’s wrong with my code?

[Attachment is the test excel file.]

Workbook wb = new Workbook();
try {
wb.open(fileName);
int count = wb.getWorksheets().size();

//Setup protection property
Protection p = new Protection();
p.setEditingContentsAllowed(false);
p.setEditingObjectsAllowed(false);
p.setFormattingColumnsAllowed(true);
p.setFormattingRowsAllowed(true);
p.setPassword(password);

for (int i= 0; i< count; i++) {
wb.getWorksheets().getSheet(i).protect§;
}

wb.getWorksheets().getSheet(0).setVisible(false);
wb.getWorksheets().setActiveSheet(1);

wb.protectWorkbook(ProtectionType.STRUCTURE, password);

wb.save(fileName, FileFormatType.EXCEL97 );



Hello

Supplement for the above question:
When save excel file using workbook.save(xlsName) which has hidden columns,
the hidden column became visible.
so this means it is not related with protecting sheets.

thanks.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

I tested your sample code with your template file and latest Aspose.Cells version (attached) and it works fine. Please try the attached latest version of Aspose.Cells and check if it works fine for you.

Thank You & Best Regards,

Hello

Could you tell me what’s the difference between v2.1.1 and latest version you sent me.

thanks.

Hi,

The latest version v2.1.1.16 (i.e. in the format/series v2.1.1.x - provided by Nausherwan) is actually a bug fix version posted in the forums for the users. Normally, we post the bug fixes in the forums dynamically at runtime for the users need. Suppose, a user points out a bug or demand for a new feature and if he has no time to wait until the next official release/hotfix is out, we always consider providing him with an intermediate build that resolves his problem immediately. However, the next official release of the product will always include the
functionality of the all the previous fixes (which we posted in the
forums).

Moreover, you may use this fix as long as you wish without any problem, it will behave like an official release.

Feel free to contact us any time if you have further questions/queries.

Thank you.