Pivot table error while trying to open the excel

Hello,

I tried to open the generated excel file from the "Open" button of the IE. The excel has been generated by reading an excel template.While I am clicking the Open button it is opening and at the same time it is popping up an error message saying "Cannot open Pivot Table Source file.....".

But when I am saving the generated excel file using the "save" button and opening it from the file from the saved path it is opening properly without any error.

Please let me know how to handle this error.

I am also attaching one screenshot with this post.

Thanks and regards,

Mridul Paul

Hi Mridul,

Thanks for considering Aspose.

Well, Actually Aspose.Cells does not create pivot table report rather sets the pivot data formats and forces MS Excel to create pivot table report and other calculation tasks based on the data source when the workbook opens into MS Excel. So you should use SaveType.OpenInBrowser rather than using SaveType.OpenInExcel. One of the many reason is when you use OpenInExcel option while saving the output generated file into MS Excel at runtime using "Open" button of the download dialog box, MS Excel could not parse the Workbook data to generate pivot table report. This is caused by the filename problem, It is the routine of IE as it appends something like "[1]" to make it as "fileName"+ "[1]"+ ".xls" to the original name and thus nothing to do with Aspose.Cells. (i.e.... it always adds "[1]" to make "fileName"+ "[1]"+ ".xls" and not like fileName.xls). In short, if a file contains pivot table, it cannot be opened using OpenInExcel SaveType option and this will apply for both i.e., if you create the file from scrach or using any template file for source data to create pivot table report. So, you should use OpenInBrowser SaveType option if the file has pivot table data in it to create pivot table report.

Kindly change your code and update to SaveType.OpenInBrowser if you are using Workbook.Save() method

//Or update to make "inline" if you are using "attachment" option in your code. i.e.,

//Response.AddHeader( "content-disposition","inline; filename=MyBook.xls");

Hope, you will get some insight. Kindly check now if it is fine. If you still find some problems or pivot table does not create fine, feel free to let us know.

If you still could not resolve it, please create a sample test and post your template file with code.

Thank you.

Hi,

My requirement is that the IE will popup the option window for Open, Save or Cancel. If the user wants to open the file it will open.

I am not able to find the SaveType API. I am using Aspose.Cells.jar. Wherew I can find this API?

Thanks and regards,

Mridul Paul

Hi,

In java version, we do not support SaveType.

If you want to open the file in IE, please set the option of the response.See following codes:

private void setResponseHeader(HttpServletResponse response, String resultXLS)
{
response.setContentType("application/vnd.ms-excel");
response.addHeader("content-disposition", "inline; filename=" + resultXLS);
}

Hi,

I have few worksheets. I have to add a flag and a logo in the top left hand corner of each sheet. For this I have a worksheet where the flag and the logo are being attached with a particular name.

I am able to attach the picture in that particular cell of that particular worksheet but the name is coming as default "Picture 1". For this reason the picture and the logo are not shown in the other worksheets.

Please let me know how to handle this problem.

Thanks and regads,

Mridul Paul

Hi,

Could you post your sample file and codes?

Hi ,

Here I am sending the sample code.

Worksheet worksheet = worksheets.getSheet("wksBrandCountry");

Pictures p = worksheet.getPictures();
try{
FileInputStream fin = new FileInputStream("C://Documents and Settings//kumarso2//Desktop//Argentina.gif");
p.add(3,3,fin);
}
catch(FileNotFoundException e)
{
e.printStackTrace();
}

The Picture is getting attached in the worksheet ,but the name is always Picture 1.

Regards,

Mridul Paul

Hi,

We do not set the name of the picture. Where do you see the name of the picture. I could not set the name of the picture in Ms Excel.

We will support setting/getting the name of the shape soon.Thanks for your patience.