Details on Workbook.Save overloads having SaveType parameter in .NET

What replaces - SaveType.OpenInExcel - that does not exist in Cells 7.6.

wb.Save("MyBook.xls", FileFormatType.Excel97To2003, SaveType.OpenInExcel, HttpContext.Current.Response);

Thanks.

Hi Mark,

Thanks for your posting and using Aspose.Cells.

You can replace the above code like this.


wb.Save(HttpContext.Current.Response, “MyBook.xls”, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));

Let us know if you face any issue. We will look into it and help you asap.

The "ContentDisposition" and "XlsSaveOptions(SaveFormat " aren't found? Here is the broader code.

Aspose.Cells.License AsposeCells = new Aspose.Cells.License();
using (System.IO.FileStream fs = new System.IO.FileStream(HttpContext.Current.Server.MapPath("Aspose.Total.lic"), System.IO.FileMode.Open))
{
AsposeCells.SetLicense(fs);
}
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
workbook.Worksheets.Add();
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells.ImportDataTable(dt, true, 0, 0);
//workbook.Save(fileName, Aspose.Cells.FileFormatType.Excel97To2003, Aspose.Cells.SaveType.OpenInExcel, HttpContext.Current.Response);
workbook.Save(HttpContext.Current.Response, fileName, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));

Thanks Again.

Hi,


FYI :
Once, you will download and install/extract the major release of the product (e.g v7.6.0), you will find the following folders at your installation locations.

Please note:

1 - net2.0 - Dll(s) for normal/regular frameworks
2 - net3.5_ClientProfile - Dll for client profile frameworks only
etc.

If your .NET framework is a normal/regular framework and greater than or equal to 2.0 (i.e 2.x, 3.x, 4.0, 4.5 etc.), then you must use the Aspose.Cells.dll inside the net2.0 folder.

But if your .NET framework is a ClientProfile framework and greater or equal to 3.5 (e.g 3.x, 4.0, 4.5 etc), then you should use Aspose.Cells.dll inside the net3.5_ClientProfile folder. For your information, ClientProfile framework is a kind of framework where you often create console application as some APIs of Aspose.Cells product for web scenarios won’t be available due to the restriction of that framework.

I think you are using Aspose.Cells.Dll from “net3.5_ClientProfile” folder which won’t provide your desired overloads/methods or APIs for your web projects / solutions, so please use Aspose.Cells.Dll in net2.0 folder.


Thank you.

Amjad, still getting same result. Have redownloaded/reinstalled Aspose.Cells 7.6. We are using .NET 4.5 Framework with VS 2012.

workbook.Save(HttpContext.Current.Response, fileName, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));

These are the workbook Saves in the Object Browser.

public void Save(string fileName, Aspose.Cells.SaveFormat saveFormat)
Member of Aspose.Cells.Workbook

public void Save(string fileName, Aspose.Cells.SaveOptions saveOptions)
Member of Aspose.Cells.Workbook

Hi,


I still suspect that your project is referencing to the Aspose.Cells.dll file from “net3.5_ClientProfile” folder at your installation location of Aspose.Cells for .NET v7.6.0, please double check its path under “References” node for Aspose.Cells component in Solution explorer in VS.NET.

If you still could not evaluate, kindly do create a separate sample web project (runnable), zip it and post it here, we will check it soon.

Thank you.

Yes, you seem to be right. I added a reference to the file "c:\program files (x86)\aspose\aspose.cells for .net\bin\net2.0\aspose.cells.dll". It shows in Visual Studio 2012 solution object browser as path "C:\Program Files (x86)\Aspose\Aspose.Cells for .NET\Bin\net3.5_ClientProfile\Aspose.Cells.dll" though. How can this be? I get the same result putting the net2.0 aspose.cells.dll into the GAC and reference it from there.

We are running Win 2008 R2 with IIS 7.5. The IIS web site is set to run at 64 bit. The IIS App Pool is set to "Enable 32 bit applications = false". We hope run all as 64 bit.

Hi,


Well, I think the reference to the correct Aspose.Cells.dll (from net2.0 folder) is not updated correctly on your project/solution. Please remove the Aspose.Cells.dll file manually in your project’s bin folder and then copy the Aspose.Cells.dll file (from net2.0 folder) to it and then add reference to the specified Aspose.Cells.dll file in solution explorer, it should work fine.

If you still find the issue with Aspose.Cells component, kindly do create a separate sample web project (runnable), zip it and post it here, we will check it soon.


Thank you.


Working with the Aspose.Cells.dll file from the bin folder works. I tried going back to using and referencing it from the GAC and get the same mismatch pathing to the 3.5 client version. Confused on that.

Hi,


Good to know that it is working now on your end.
Regarding GAC issue, I think you may try to re-install/register the assembly (Aspose.Cells for .NET in net2.0 folder) using some .NET tool e.g Gacutil.exe.

Thank you.