sheetType.Chart with Chart on single sheet -> Zoom is not responsive

Good afternoon . I’ve created a basic method to output chart on a 2nd sheet (as a single object per sheet) and noticed that when split the screen o see 2, 3 workbooks at once the one created with Aspose doesn’t shrink according to the aspect ratio. The method:
public static void ResponsiveZoom()
{
Workbook workbook = new Workbook(@“C:\Temp\Test1.xlsx”);
int sheetIndex = workbook.Worksheets.Add(SheetType.Chart);
Worksheet sheetChart = workbook.Worksheets[sheetIndex];
int chartIndex = sheetChart.Charts.Add(ChartType.Line, 1, 1, 25, 10);
Chart chart = sheetChart.Charts[chartIndex];
chart.SetChartDataRange($"=Sheet1!$A$1:$B$7", true);
workbook.Save(@“C:\Temp\Test1.xlsx”);
}

I attach a picture opening 2 workbooks -> One created with Aspose (left hand side) and another one) to see the difference (it doesn’t shrinkResponsiveZoom.PNG (62.7 KB)
)

@Remus87,

We are not sure about your issue. Could you elaborate it more, zip and attach your input Excel file (used in your code) and output Excel file (by Aspose.Cells) for reference. This will help us evaluate your issue precisely to figure it out soon.

I attached below the:

  • Input excel file -> in Input.xlsx
  • Output excel (with Aspose) -> ActualResult.xlsx

To have a better understanding i created from the input file in MS Excel a Chart (Insert Chart from MS Excel ribbon), Move the Chart to a New Sheet (right click on Chart -> select Move Chart -> select New Sheet) and saved the workbook as ExpectedResult.xlsx.
Now run both workbooks and split them on your screen -> play around with the map window of each of them -> you’ll notice that the one created in MS Excel is shrinking based on the size of the window, the one created with Aspose is keeping the same zoom (same chart size) and not responding to the window scaling event.
And another Samples_NotResponsive_ExcelObject.zip (68.4 KB)

Plus in relation with the same issue the Chart is not zooming to the full screen length, therefore the sheet with Chart is keeping a fixed Zoom at 100% when it should adapt to the excel process map window (or the user screen resolution) -> see attached screen shot

@Remus87,

Thanks for the details.

Please notice, I am able to reproduce the issue with the output file generated by Aspose.Cells when opening the file into MS Excel. I found Excel Zoom is not responsive with Chart sheet (SheetType.Chart), I simply used your template file and sample code. Even when we open the output file into MS Excel manually and select the Chart sheet. Now resize/scale (decrease or increase, etc.) the MS Excel window via mouse, we can notice Chart is not scaling accordingly and Zoom is constantly set to 100% no matter we decrease or increase the window’s height/width. The behavior is expected when we manually create the similar chart (in Chart Sheet) in MS Excel. I have logged a ticket with an id “CELLSNET-48057” for your issue. We will look into it soon.

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

Thanks for the update Amjad.

@Remus87,

You are welcome.

@Remus87,

Please set Chart.SizeWithWindow Boolean property as true in your code. See the lines of code that works fine fine:
e.g.
Sample code:

.......
Chart chart = sheetChart.Charts[chartIndex];
chart.SizeWithWindow = true; 

Let us know if you still find any issue.

Good morning! I’ve tested the fix and it works perfect.
Thank you.

@Remus87,

Good to know that your issue is resolved by the suggested Boolean property. In the event of further queries or issue, feel free to write us back.