0

I am running C#.NET, and Aspose version 7.3.

When I export my sheet, it exports completely fine. No problems. Nuttin but love.

However, when I click 'save as' in the browser options (as opposed to 'open'), and open that resultant file, there is an empty spreadsheet titled "Object."

Please see the screen shot below.

https://i.stack.imgur.com/Q03wo.jpg

Is there any way that I can suppress this? It's not showing in my worksheet collection at run-time. I am also having trouble googling it, as "object" is a pretty common word when it comes to Aspose Cells.NET development.

Your assistance is appreciated. Thanks.

user426364
  • 160
  • 9

1 Answers1

1

Probably, you might be creating Object worksheet accidentally or may be Object worksheet already exist in your template file.

Anyway, please try the following sample code and see what results you get. It should work fine without any problem.

If it works fine, you can then modify your code according to this code.

For saving in Xls format, please use XlsSaveOptions

and

For saving in Xlsx format, please use OoxmlSaveOptions

Sample Code in C#

//Create a new workbook
Workbook workbook = new Workbook();

//Get the first worksheet in the workbook
Worksheet sheet = workbook.Worksheets[0];

//Rest of your code goes here

string yourFileFormat = "XLS";

//Save file and send to client browser using selected format
if (yourFileFormat == "XLS")
{
    workbook.Save(HttpContext.Current.Response, "output.xls", ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
}
else
{
    workbook.Save(HttpContext.Current.Response, "output.xlsx", ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsx));
}

HttpContext.Current.Response.End();
shakeel
  • 1,717
  • 10
  • 14
  • You obviously work for Aspose. I prefer to talk to someone who has experienced the same problem I have. Thanks. – user426364 Oct 04 '12 at 19:07