Using Fomula in ChartTitle

Hi,

is ist possible to use a formula as ChartTitle in XlsIO, so that the text of the chart title ist set dynamically, when entered in a cell of the worksheet.

In Excel itself and by using the interop in C# it is possible.
For example in Excel interop:

Chart1.ChartTitle.Formula = "='Sheet1'!$A$2";

So the title of Chart1 is set to a formula which refers to cell A2 in Sheet1.
This works fine an the chart title shows the text in cell A2.

But how can I do this in XlsIO?
I only found the property ChartTitle in the IChartShape interface or the Text property in the ChartTitleArea, but both dont work, when set to a formula.
The title only shows the text, because it is a string value.

What I found out is, that if I open a workbook created with the interop in XlsIO an have a look at the chart, I can find a non public property called "IsFormula" in the ChartTitleArea I think. This property ist set true, if the chart title is a formula.
But because it is a non public property I could not set it, when I use XlsIO to set the title.

Any help appreciated

Best regards

Christian

2 Replies

SK Shamini Kiruba Sobers Syncfusion Team May 14, 2020 11:02 AM UTC

Hi Christian, 

Greetings from Syncfusion. 

As you said, we are having the internal property “IsFormula” in ChartTextAreaImpl class which when set to true, we can use a formula as ChartTitle. The property will be made as Public in the next weekly NuGet release which will be rolled out on May 19, 2020. We will notify you once the release has been rolled out. 

We appreciate your patience. 
  
Regards, 
Shamini


SK Shamini Kiruba Sobers Syncfusion Team May 19, 2020 07:33 AM UTC

Hi Christian, 

We appreciate your patience. 

We are glad to announce that our latest weekly NuGet release v18.1.0.53 is rolled out and is available for download under the following link.   

This package includes the IsFormula property that can be set using the following code. 

Code snippet: 

(chart.ChartTitleArea as ChartTextAreaImpl).IsFormula = true; 
chart.ChartTitle = "='Sheet1'!$A$2"; 

Also, include the following namespace to access implementation class ChartTextAreaImpl
 
using Syncfusion.XlsIO.Implementation.Charts; 

We will also expose the property in IChartTextArea interface in our upcoming main release which is planned to be rolled out by the end of June 2020. After that release, you can access IsFormula property directly without casting like below. 

chart.ChartTitleArea.IsFormula = true; 

Kindly let us know if the solution helps. 

Regards, 
Shamini 


Loader.
Up arrow icon