Free Support Forum - aspose.com

Chart data range isn't updated in the second sheet

Hi,

I found a problem while using Aspose Cells.

I made an example which explains my problem better.

I created a table and using data from this table I created two identical charts, one in the first sheet and the other in the second sheet.
I inserted new fields in the table with Aspose and saved the document. The problem is that the chart data range isn't updated in the second sheet of the output file.

Thanks,

Devid

Hi,

Thanks for the sample project with template file.

After an initial test, I can notice the issue as you have mentioned. I simply used the template file and sample code you have provided via your project. After inserting new area with data/values b/w the source data range for the chart, the chart in the first sheet is updated fine but the chart in the second sheet is not updated with respect to expanded data.


Sample code:

string filePath = @"e:\test2\Test_Chart.xlsx";
//First copy ole object from source workbook into destination workbook
Workbook start = new Workbook(filePath);

Workbook workbook = new Workbook(start.SaveToStream());

//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

var area = CellArea.CreateCellArea(3, 0, 3, 1);

worksheet.Cells.InsertRange(area, 3, ShiftType.Down, true);

worksheet.Cells["A4"].PutValue("D");
worksheet.Cells["B4"].PutValue(40);

worksheet.Cells["A5"].PutValue("E");
worksheet.Cells["B5"].PutValue(50);

worksheet.Cells["A6"].PutValue("F");
worksheet.Cells["B6"].PutValue(60);

//Saving the modified Excel file
workbook.Save(filePath + "OUTPUT1.xlsx", SaveFormat.Xlsx);

I have logged a ticket with an id "CELLSNET-41525" for your issue. We will look into your issue soon.

Once we have any update on it, we will let you know here.

Thank you.


Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET v7.4.2.2 and let us know your feedback.

Hi,

I found a problem while using Aspose Cells.

I made an example which explains my problem better.

I created a table and using data from this table I created two identical charts, one in the first sheet and the other in the second sheet.
I inserted new fields in the table with Aspose and saved the document. The problem is that using worksheet.Cells.InsertRow(0) the graph data in the second sheet of the output file is not updated correctly.

Thanks,

Devid

Hi,

Thanks for your posting and using Aspose.Cells.

We have found the same problem.We have logged your comments in our database. We will look into it and fix it. Once the issue is fixed or we have some other update for you, we will let you know asap.

Hi,


Thanks for your posting and using Aspose.Cells.


Please change worksheet.Cells.InsertRow(0) to worksheet.Cells.InsertRows(0,1,true) for updating the reference of the chart in sheet2.

Hi,

Ok, I tested it and it works!

Are you going to fix InsertRow() in the future?

Thanks,

Devid

Hi,

Thanks for your feedback.

We will take it into consideration. It is good to know that your issue is resolved now. If you face any other issue, please feel free to let us know, we will be glad to help you further.