Exception when generating a pivot table with a single data record

We have an application that uses aspose.grid to generate dynamic table reports from data extracted from a sql database.


It works fine, excepting when the query retrieves only one record and the pivot table is grouped by two fields in columns and two fields in rows. In that case the following exception is thrown :

The pivottable named Form WebWorksheet has existed.
Parameter name: tableName

If the same data source (just one record) is used tow build a pivot table with two fields grouping columns and only one field grouping rows the pivot table is generated successfully.

Attached you will find an example application that shows how to replicate the exception. It opens a form with a grid and two buttons: The first button (2 columns 2 rows) generate the exception, while the second button (2 columns 1 row) works fine.

The grouping fields in first button are: State and city for rows, year and month for columns.
The grouping fields in second button are: State for rows, year and month for columns.

Data in this example is retrieved from an excel file with only a record.

NOTE: Application mus be closed after each test.

Thanks for your help, we have spend several weeks trying to fix this problem and we believe is a bug of the component






Hi,


We have fixed the bug to create 2 row fields and 2 column fields with 1 row data in Aspose.Cells.GridWeb v2.2.0.2001(attached). Also, we have modified your test project for solving "the pivottable named Form WebWorksheet has existed". This exception appears because "Form WebWorksheet" has existed. You can shield the issues by yourself. For using the PivotTable Api better, we need to understand the relation of PivotCache, PivotTable and the target worksheet. The PivotCache binds the data source, the PivotTable manages the report, the target worksheet tells PivotTable where the report is placed. PivotTable and the target worksheet has one-to-one relationship. The PivotCache has one-to-more relationship.


Thank you.