Free Support Forum - aspose.com

Unprotect a WriteProtected workbook doesnt seems to work for PocketPC excel

Hello Support,

I've got a few workbooks which contains write protected sheets.

When I use the unprotect() method and save the workbook to a new file , the regular office 2000/ xp Excel allows writing.

However, when I open the same file in pocket Excel it says the workbook is still protected.

Code:

Dim excel As Aspose.Excel.Excel = New Aspose.Excel.Excel
Dim excelNew As Aspose.Excel.Excel = New Aspose.Excel.Excel
Dim fstream As FileStream = New FileStream("C:\\book1.xls", FileFormatType.Excel97, FileMode.Open)
excel.Open(fstream)
Dim worksheet As Aspose.Excel.Worksheet = excel.Worksheets(0)
Dim worksheetNew As Aspose.Excel.Worksheet = excelNew.Worksheets(0)
worksheetNew.Copy(worksheet)
Dim thePass As String = "xxx""
MsgBox(thePass)
worksheetNew.Unprotect(thePass)
excelNew.Save("C:\\output.xls", FileFormatType.Excel97)
fstream.Close()

To replay this just create an new workbook with 1 sheet. Go to tools/protection/protectsheet..enter xxx and ok.

Run the above code and open the output file in a PocketPC.

Could it be that the evaluation warning is messing up this protection ?

Thanks in advance.

Regards,

Leo G

Anyone has an update for this ? Its a very important issue for our customer.

Can I send you a Workbook so that you can test it without the evaluation warning i.e. the full version ?

Regards,

Leo

Hi Leo,

It has nothing to do with the evaluation edition.

I don't have a pocket pc on hand so I cannot make any further investigation.

Could you give me following information?

1. In you pocket pc, if you enter the password: "xxx", will the file be unprotected?

2. Could you post a simple worksheet-protected file created on pocket pc?

3. After you unprotect this file on your pocket pc, please post the unprotected file here. Thank you.

Hi Laurence,

Thank you very much for your reply. The problems is the PDA Windows CE software itself. The current Pocket Excel edition doesnt support "write Protected" sheets. When you open a regular workbook with 1 or more protected sheets on a PDA, the PocketPC gives an error like 'Can't open password protected worksheets'.

Since we have a fully loaded database with lots of 'worksheet protected' workbooks, served by the web to both regular Office 2000/XP clients and PDA users , we are trying to find a solution for this. Cause on this stage the PDA user cant open those workbooks.

This is were your ASPOSE Excel component comes in. As found in the API the setProtected() Method should be able to remove the WriteProtection. If that works we can stream the Unprotected version to the PDA.

Now, this unprotect method works for the Office 2000/XP clients. If I use the above code on a password protected sheet, and open the output.xls afterwards, the write protection is gone.

However, when I try to open that same output.xls on a pocketPC it still complains about the 'Can't open password protected worksheets' error. So somehow the PocketPC still thinks there's a password protection on it.

Thats why I thought that maybe by writing the Evaluation Warning to that sheet the PDA get confused.

Hope to get a solution for this since its a major issue at the moment.

Regards,

Leo

Hi Leo,

Please try this attached fix.