We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Cells - C# - 20.1.0.0 - Integrity error saving as xls or xlsx

Hi,

When I create excel file only with data it works fine. As soon as I add pivot table, excel gives:

  • with XLS - Integrity Error
  • with XLSX:
    Removed Feature: PivotTable report from /xl/pivotCache/pivotCacheDefinition1.xml part (PivotTable cache)
    Removed Feature: PivotTable report from /xl/pivotTables/pivotTable1.xml part (PivotTable view)
    Removed Records: Workbook properties from /xl/workbook.xml part (Workbook)

Aspose Cells version: 20.1.0.0

Corrupted excel file:

The code for adding pivot table was used from your example page:
pivotTable.RowGrand = true;
pivotTable.AddFieldToArea(PivotFieldType.Row, 0);
pivotTable.AddFieldToArea(PivotFieldType.Column, 1);
pivotTable.AddFieldToArea(PivotFieldType.Data, 2);

without this code, it works fine.

Kind regards

@gtrcek,

Thanks for the output file and details.

I noticed the issue as you mentioned when opening the file into MS Excel, I got the same error. To evaluate your issue precisely, we need your template file (input file if any) and complete sample code, so we could generate such a file. We appreciate if you could provide us a sample console demo application (runnable) with template file(s) to reproduce the issue on our end. We will log appropriate ticket(s) after confirmation.

PS. you may zip the project (excluding Aspose.Cells Dll) and files prior attaching here.

Hi,
I can give you the source, but it won’t work for you because we are using data from sql server and then we put it into excel file.
I can give you clean (without pivot table) excel file so that you can see that the code for adding data to excel works perfectly.

After the data is added, i added code:
pivotTable.RowGrand = true;
pivotTable.AddFieldToArea(PivotFieldType.Row, 0);
pivotTable.AddFieldToArea(PivotFieldType.Column, 1);
pivotTable.AddFieldToArea(PivotFieldType.Data, 2);

and then error occured.

Please, let me know if you still need the source or should i give you clean file and then you can try and add pivotTable?

Kind regards

@gtrcek,

Do you mean you have your source file which has existing pivot table whose source comes from SQL Sever and later you manipulate pivot table? Please note, Aspose.Cells does not support to create or manipulate PivotTable whose data source is external (e.g SQL Server or external files). Aspose.Cells supports to create pivot table and all types of manipulations plus calculations if the data source is there in the file (Workbook). Anyways, we can evaluate your issue. Can you reproduce the issue using a file which should contain all its data in it and then create the pivot table based on that data? You may provide us source file (with all its data present in it), and paste sample code (runnable) to reproduce the issue, we will check it soon.

Hi,

we take the data from sql and then put it into excel file (sheet name: BC Data),
then we create additional sheet (sheet name: Porocilo) and put pivot table there.
data for pivot table comes from BC Data sheet.
We do not connect pivot to external data source. It is all in excel file.

Kind regards

@gtrcek,

Thanks for further details.
Please provide us a sample console demo application (runnable) with template file to reproduce the issue on our end.

Hi,

I prepared the test project for you.

download link:

Kind regards

Hi,

I found the problem!

If the name of the sheet for source for pivot table contains space (eg: “BC Data”), then produces the error. If I remove the space from the sheet name (eg: “BCData”) then it works fine.

Can you confirm/reproduce this?

Kind regards

ps:

if I change
var tableRange = “=BC Data!A13:E3224”;
to
var tableRange = “=‘BC Data’!A13:E3224”;

it works

Kind regards

@gtrcek,

Thanks for the sample project and details.

It looks like you have already sorted it out. And, yes, while adding pivot table, when there is space char(s) in the source worksheet name, you need to mention it in single quotes in code as you have done it already.

Let us know if you still have any issue or queries, we will be happy to assist you soon.

Thank you for quick response and your time.

This topic can be closed, no further assistence is needed. Have a lovely day.

Kind regards

@gtrcek,

You are welcome.