1

I am evaluating SpreadsheetGear2012 and I want to be able to open/save all types of Excel files: .xls, .xlsx, .xlsm and .xlsb. All extensions are working fine except for .xlsb.

Here is the code for creating a simple .xlsb file:

            SpreadsheetGear.FileFormat excelFormat = SpreadsheetGear.FileFormat.Excel12;
            SpreadsheetGear.IWorkbookSet workbookSet = SpreadsheetGear.Factory.GetWorkbookSet();

            SpreadsheetGear.IWorkbook workbook = workbookSet.Workbooks.Add(); 

            workbook.SaveAs(@"D:\test.xlsb", excelFormat);

            workbookSet.Workbooks.Close();

This code creates the file on disk, but it has only 3KB and if I try to open it manually I get the error from the title. If I create an .xlsb file directly from Excel it has 12 KB.

Is it something that I am missing here? Maybe for .xlsb file I need to set up some headers ?

Andrei Petrut
  • 390
  • 2
  • 15

1 Answers1

2

I work here at SpreadsheetGear and think I can clear the air on all of this: the Excel12 symbol should not even be an option in the SpreadsheetGear.FileFormat enum, as we do not yet support the XLSB file format.

This symbol was accidentally included in the .NET 2.0 build of SpreadsheetGear 2012 for .NET (SpreadsheetGear2012.dll). You'll notice that it is (correctly) missing from the .NET 4.0 build (SpreadsheetGear2012.Core.dll). Given we've never fully implemented this file format, attempting to use the Excel12 option would no doubt lead to unexpected results.

Furthermore, we'll be removing this option from future builds of our product, so you'll want to ensure that you remove any references to it.

Tim Andersen
  • 3,014
  • 1
  • 15
  • 11