Cannot open pivot table source file

Hi,

I am using pre - designed template to generate .xls file. I am using Response.Write method to show Open/Save File Dialog box in my asp.net application. When user directly saves the file then Pivot table is generated properly. But when user clicks open then pivot table does not contain any data. Only outline is shown I mean all the filters are shown but no data is shown. When I click Refresh then “Cannot open pivot table source file” error comes.

Thanks,
Deepali

Hi,

Thank you for considering Aspose.

We are working on the feature of reading pivot table from template file. You may try to change the source of the pivot table if it fits your need. Please see the following documentation link:

Thank You & Best Regards,

I think you misunderstood the problem. Pivot Table is working fine when I am opening this file in desktop application. This is causing error when I am opening this file through Open/Save File dialog box in Internet Explorer. Similar to the problem as described in this thread Cannot open pivotTable source file�

But I am not using any kind of querystring parameters so the solution suggested in this thread dint work for me.

Hi,

Could you check the document: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/pivot-table-issue.html
if it can provide some help/reference to sort out your issue.

If you still find any issue, kindly provide more details, sample code, template file etc for your issue. Also, mention the product version, .NET framework, browser type, OS etc.

Thank you.

Hi Amjad,

Thanks for the suggestion using “inline” instead of “attachment” does solves my problem but it has added new problems. Now when user clicks open then a confirmation dialog box is shown to the user. I have attached the image and then excel is opened in minimized format and the .xls file is also opened in minimized format.

I am using following code as suggested on the link

Response.AddHeader(“Content-Disposition”, “inline; filename=” + fileName);
Response.ContentType = “application/octet-stream”;
Response.WriteFile(“App_Data/” + fileName);

Thanks,
Deepali

Hi,

I think you may try to use instead:
workbook.Save(“myfile.xls”, FileFormatType.Default,SaveType.OpenInBrowser, System.Web.HttpContext.Current.Response);

Or you may change your code line i.e.

Response.ContentType = “application/octet-stream”;
to:
Response.ContentType = “application/vnd.ms-excel”;

if it works fine for you.

Thank you.

And, if you are using Response object, you may add a line at the end:

Response.End();

Thank you.

I have tried both the methods but result is same. Found it during the investigation : "The problem with the Content-Disposition: inline is that it doesn’t
pick the file name from filename attribute we use in AddHeader function
rather, it always takes the name of web page from the URL while saving
the document. Content-Disposition: attachment seems to be working fine.

workbook.Save(“myfile.xls”, FileFormatType.Default,SaveType.OpenInBrowser, System.Web.HttpContext.Current.Response); dint solve the problem.

I am using I.E. 7.0.

Hi,

Thank you for considering Aspose.

After further investigating your issue, we think you may need to change the registry settings. Please see the following link for details.

http://support.microsoft.com/kb/948615

Thank You & Best Regards,

Well this will not solve my error.

1. This need registry editing and I cannot edit registry settings of my web application users.
2. File Name gets changed to WebReporting.aspx instead of the filename given by application
3. It does opens the file without showing confirmation message but it opens the excel application and excel file in minimized form which is not acceptable to our users.
4. After clicking “Open” silent downloading of the file gets started but I want to show the standard downloading of the file i.e. user should be able to see x kb downloaded of total y size…

So it brings me back to the original position I cannot use “inline” with the Response.AddHeader as this will not be acceptable to our client due to above mentioned reasons. Can you please suggest some other suggestion or way to remove all above errors.

Thanks,
Deepali

Hi Deepali,

When using "attachement" header or OpenInExcel option, there is the problem of "Cannot open pivot table source file...". However, this problem is caused by MS Excel and IE. It doesn't matter with Aspose.Cells.

You can easily verify the problem through following code (without using Aspose.Cells):

FileStream fs = File.OpenRead(@"C:\FileTemp\book1.xls"); //read an Excel file with pivot table
byte[] data = new byte[fs.Length];
fs.Read(data,0,data.Length);
fs.Close();
Response.Clear();
Response.ClearHeaders();
Response.ContentType = "application/vnd.ms-excel";

Response.AddHeader("Content-Length", data.Length.ToString());
//Add header
Response.AddHeader("content-disposition", "attachment; filename=test.xls");
Response.BinaryWrite(data);

Response.End();

Editing registry and using "inline" header to stream file to client browser also is not a good solution because of your reasons.

I have another workaround. Maybe you can generate your files on webservers and provide a hyperlink to allow your users to download them. But again it is not an elegant solution because you have to take care of those extra files generated on server.

All these awkward problems are caused by MS Excel and IE so we cannot find an easy solution for them.