I wish to read from and email password protected Stand out files. How do i achieve this using Apache POI API.

Thanks,

When the entire workbook is password protected (by studying the Stand out menu File > Save As... > Tools > General Options... then delivering your password) then your file is encoded and also you cannot read from and email the workbook through POI.

Excel Save As... General Options

POI should have the ability to open both protected xls files (using org.apache.poi.hssf.record.crypt) and guarded xlsx files (using org.apache.poi.poifs.crypt). Perhaps you have attempted these?

If you are using HSSF (for any xls file), you have to set the password before opening the file. You need to do this having a call to:

 org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword(password);

Next, HSSF should have the ability to open your file.

For XSSF, you would like something similar to:

    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("protect.xlsx"));
    EncryptionInfo info = new EncryptionInfo(fs);
    Decryptor d = new Decryptor(info);
    d.verifyPassword(Decryptor.DEFAULT_PASSWORD);
    XSSFWorkbook wb = new XSSFWorkbook(d.getDataStream(fs));