Can Aspose Open and Save .xltx- .xltm files - Excel 2007

Hi,

Could you please tell me how I can open and save .xltm ( Excel Macro-Enabled Template) and .xltx (Excel Template) files using Aspose Cells.

string fn = @"C:\ test\macrotemplate.xltm";

Workbook book = new Workbook();

book.Open(fn, FileFormatType.??);

book.Save(fn, FileFormatType.??);

Thank you.

Hi,

Currently you can open .xltx and .xltm format file with Aspose.Cells for .net. Just like:

string infn = @"E:\ test\Book11.xltx";

Workbook book = new Workbook();

book.Open(infn); //or book.Open(infn, FileFormatType.Excel2007Xlsx);

But it is not supported to save to .xltx and .xltm format yet, you may save them to .xlsx or .xlsm format.

book.Save(outfn, FileFormatType.Excel2007Xlsx); //or book.Open(infn, FileFormatType.Excel2007Xlsm);

We will soon provide a version that support to save to .xltx and .xltm format. Thank you for your patience.

Hi,

Please try the attached version. We added “FileFormatType.Excel2007Xltx” and “FileFormatType. Excel2007Xltm”.
e.g.

string fn = @"C:\ test\macrotemplate.xltm";

Workbook book = new Workbook();

book.Open(fn, FileFormatType. Excel2007Xltm); // change FileFormatType to Excel2007Xltx if opening an .xltx file

book.Save(fn, FileFormatType. Excel2007Xltm); // change FileFormatType to Excel2007Xltx if opening an .xltx file

If you do not specifies the FileFormatType, aspose.Cells for .net will auto judge the file type by the file name suffix.
e.g

string infn = path + "TEST_xltx.xltx";

string outfn = path + "TEST_xltx_out.xltx";

Workbook book = new Workbook();

book.Open(infn);

book.Save(outfn);

Thank you.

Hi Karen,

I tried the attached version and I get an error as below when opening xltm file.

"This file's format is not supported or you don't specify a correct format."

Thank you.

Hi,

Please try this fix.

We have supported to open xltm file.

Hi Simon,

I still get the same error as before opening xltm file.

Thanks,

Hi,

Please try the attached version.

Thank you

Hi,

This version worked.

Thank you.