how to unprotect the password protected Excel file using Jxl

hi,I hv some doubt in JXL .1 . How to unprotect the password protected Excel file using jxl program.is there any predefined methods to unprotect the Password protected Excel ?please let me know ..Thnx & regards,Ramesh P
[265 byte] By [RameshPa] at [2007-11-26 18:59:30]
# 1

import java.io.File;

import java.io.IOException;

import jxl.Workbook;

import jxl.read.biff.BiffException;

import jxl.write.WritableSheet;

import jxl.write.WritableWorkbook;

import jxl.write.WriteException;

public class JExcelApiTest

{

public static void main(String[] args)

{

try

{

Workbook workbook = Workbook.

getWorkbook(new File("/path/to/protected.xls"));

WritableWorkbook copy = Workbook.

createWorkbook(new File("/path/to/unprotected.xls"), workbook);

WritableSheet[] sheets = copy.getSheets();

for (WritableSheet sheet : sheets)

{

sheet.getSettings().setProtected(false);

}

copy.write();

copy.close();

}

catch (BiffException e)

{

e.printStackTrace();

}

catch (IOException e)

{

e.printStackTrace();

}

catch (WriteException e)

{

e.printStackTrace();

}

}

}

Hope this helps

AbiSSa at 2007-7-9 20:40:50 > top of Java-index,Java Essentials,Java Programming...
# 2

goodmorning,

I'm facing the problem to read an excel file password protected using java excel api.

I KNOW THE RIGHT PASSWORD but I'm not able to use it while opening the file.

The instruction you suggested:

workbook = Workbook.getWorkbook(new File(sAbsPathExcel));

GIVES the exception.

Does anyone know how to read an excel file password protected if I KNOW THE PASSWORD with java code?

Thanks

ventodimarea at 2007-7-9 20:40:50 > top of Java-index,Java Essentials,Java Programming...