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

Free Support Forum - aspose.com

Xlsm Support

I would like to know about support for opening xlsm files with Aspose.Cells. Is this available, or when will it be available I can only see xlsx support in the doucmentation.

Thanks.

Note: I have been trying to search your site and forums but the searches keeps throwing errors.

Hi,

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

File format .xlsm is supported in Aspose.Cells for .Net now. Macro/vba data will be preserved when you load and save the file. Kindly consult the code:

string fn = @"E:\ test\KeepMacro.xlsm";

Workbook book = new Workbook();

book.Open(fn, FileFormatType.Excel2007Xlsm);

book.Save(fn, FileFormatType.Excel2007Xlsm);

Please try the attached version.

Thank you,

Thanks for the dll and the sample.

I did notice that the version we had was 4.4.1.0 and the version you sent me 4.4.1.12 which included the new format. When was this version released?

I am now getting a “Cannot find central directory” when accessing the file. This is an asp.net application, however this code is in a c# class called from a page and is not a code behind page.

Here is the code:

License license = new License();
license.SetLicense("…\Aspose.Cells.lic");

DataTable dt = new DataTable();
Workbook excel = new Workbook();

if (filetype.EndsWith(“xlsm”)) {
excel.Open(filename, FileFormatType.Excel2007Xlsm);
} else if (filetype.EndsWith(“xls”)) {
excel.Open(filename);
} else if (filetype == “”) {
excel.Open(filename, FileFormatType.Default);
}



Thanks for you help with this.

Hi,

Could you post your .xlsm file here, we will check it soon.

Thank you.

I had to zip it because it wouldn’t take a file with an “xlsm” extension.

Sorry for the delay, other projects to precendence

Tim

I had to zip it because it wouldn’t take a file with an “xlsm” extension.

Sorry for the delay, other projects to precedence

Tim

Hi,

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

Normally, .xlsx and .xlsm format file is zip format. We can open them with Winzip tool.

But your .xlsm file is workbook protected. It is not a normal zip file now. It cannot be opened by Winzip tool.

Currently Aspose.Cells does not support to open workbook protected xlsx/xlsm files.

Thank you.

Dear Tim,

Now, you can also attach XLSM/XLSX files with your posts. We have allowed these file extensions.

Have a good time.

As a quick follow up and I found the following. If lock cells and protect all the worksheets and also protect the VBA code then Aspose.Cells is still able to open the file.

If the workbook is protected, or the file is protected either for open or modify then the zip file is no longer readable.

For our users they will just protect the VBA and worksheets and have to call that good, or save the protected file as an xls file which Aspose.Cells seems to handle just fine.

Are you guys still researching the possibility of supporting protected xlsm/xlsx files in the future?

Thanks for your help.

Hi,

Please try this fix and open the file with the method Workbook.Open(string fileName,FileFormatType fileFormatType,string password) method.

I will try later tody and let you know, Thanks.

I have tried the following with Workbook.Open

Excel is VBA protected: Open w/out password: OK
Excel is VBA protected: Open with password: CellsException Thrown (OK)

Excel is Worksheet protected: Open w/out password: OK

Excel is Worksheet protected: Open with password: CellsException Thrown (OK)

Excel is Workbook protected: Open w/out password: OK

Excel is Workbook protected: Open with password: CellsException Thrown (OK)

Excel is File Modify protected: Open w/out password: OK

Excel is File Modify protected: Open with password: CellsException Thrown (OK)

Excel is File Open protected: Open with password: CellsException Thrown (OK)

Excel is File Open protected: Open w/out password: OK

So for us, who just need to open and read data out this was a very successful test. Thanks for the time you guys took to look into this. This is going to make our users very happy.