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

Free Support Forum - aspose.com

Implement COM Series.Formula functionality in ASPOSE.CELLS

Hi,


I am trying to migrate an app from COM to aspose. At one point in the application we are generating a formula string such as “=SERIES(“FFFGen”,Generation!$A$33:$A$42,Generation!$B$33:$B$42,1)”. In COM i can pass it to series.formula() property and it gets the work done. Can I do the same with Aspose and how?

Hi,

Thanks for your posting and using Aspose.Cells.

Please provide us some simple excel file containing your COM series formula so that we could investigate it if such a formula can be created with Aspose.Cells APIs. Also if you could provide some screenshots illustrating your issue that will be helpful for us. Please also tell us the steps you take in Microsoft Excel to create such a formula. Thanks for your cooperation in this regard and have a good day.

I have attached screenshot of the excel file. Below is the sample code which does this in COM.


sFormula = “=SERIES(“FFFundGen”,FundGeneration!$A$33:$A$42,FundGeneration!$B$33:$B$42,1)”;

Excel.Series Chart= (Excel.Series)oChart.Chart.SeriesCollection(1);
Chart.Formula = sFormula;

Hi,

Thanks for your posting and using Aspose.Cells.

Please provide us the excel file as shown in your screenshot for our investigation. We will look into it and help you asap.

Hi,

Thanks for your posting and using Aspose.Cells.

After initial investigation we found your chart is creatable using Aspose.Cells APIs. We will look into it further and provide you a sample code how to achieve your desired output chart.

Hi,

Thanks for using Aspose.Cells.

Please see the following code, which I have executed on the latest version:
Aspose.Cells for .NET v8.7.1.3. The code loads your source excel file and generates the similar chart as shown in the screenshot.

I have also attached the output excel file generated by the code for your reference.

C#

string path = @“D:\Downloads\Sample Excel.xlsx”;

Workbook workbook = new Workbook(path);

Worksheet worksheet = workbook.Worksheets[0];

int idx = worksheet.Charts.Add(ChartType.Column, 5, 5, 25, 15);

Chart c = worksheet.Charts[idx];

c.NSeries.Add(“B33:B42”, true);
c.NSeries.CategoryData = “A33:A42”;

c.NSeries[0].Name = “FFFundGen”;
c.NSeries[0].DataLabels.ShowValue = true;
c.NSeries[0].DataLabels.Position = LabelPositionType.OutsideEnd;

c.Title.Text = “Generation”;

c.ShowLegend = false;

workbook.Save(“output.xlsx”);