Free Support Forum - aspose.com

ChartDataCell - how to update value?

The title says it all. I’m using C++.

How to update the value of Aspose::Slides::Charts::IChartDataCell?
What am I supposed to pass to set_Value() method?

It expects SharedPtr<System::Object>, but how do I create this?
Is this supposed to be a new ChartDataCell? ChartDataCell doesn’t even have a public constructor

All I want to do is update the value of the given ChartDataCell with a new string value. How do I do that?

Thanks in advance!

@gtamas

Aspose::Slides::Charts::IChartDataCell is actually representing a cell inside ChartDataWorkbook that holds any series or category data. it is used in GetCell() method of ChartDataWorkbook class. Please visit this Github example link and check GetCell() calls for your convenience. You can also visit this documentation link for your convenience. I hope this will be helpful.

@gtamas,
You can update the value of Aspose::Slides::Charts::IChartDataCell as follows:

// cell is IChartDataCell
cell->set_Value(ObjectExt::Box<String>(u"text"));

Also, you can use a code for getting the value back as follows:

SharedPtr<Object> value = cell->get_Value();
if(ObjectExt::Is<String>(value))
{
	String str = ObjectExt::Unbox<String>(value); // "text"
}

Numeric types are supported in the same way:

// cell is IChartDataCell
cell->set_Value(ObjectExt::Box<int32_t>(100));

Additional API reference: System::ObjectExt Class

OK I see. Thanks for the help!