rbates
April 29, 2007, 9:21am
1
I've not figured out how to do this one. In Excel you can set the series name in VBA to a cell reference:
.SeriesCollection(1).Name ='sheet1'!$B$1:$D$1
This will reference the contents of that cell as the series name. This allows you to easily change the name of the series by simply changing the cell contents.
How is this done in Aspose.cells? The command:
nseries[1].name =
only seems take a string. Is there another way?
Thanks,
Rob
Hi Rob,
Thanks for considering Aspose.
Well you can do it both ways E.g.,
//Reference name to a cell
chart.NSeries[0].Name = "=A1";
//Set a string to name
chart.NSeries[0].Name = “First Series”;
And you may try like this: for ( int i = 0; i< chart.NSeries.Count ; i ++)
{
//Set the name of nseries
chart.NSeries[i].Name = cells[0,i+1].Value.ToString();
}
Thank you.
rbates
April 29, 2007, 3:42pm
3
Thanks for your reply. I'm trying to reference another worksheet cell since the chart is in its own sheet. I get an invalid name. Example:
chart.NSeries[0].Name = "='Segment Data!'" + CellsHelper.CellIndexToName(3,3); // invalid name
"=Segment Data!" + CellsHelper.CellIndexToName(3, 3); // invalid name
= "Segment Data!" + CellsHelper.CellIndexToName(3, 3); // returns string "Segment Data!B4"
I use it just previous to create the series and it works fine:
m_sAddress1 = CellsHelper.CellIndexToName(5, m_icol);
m_sAddress2 = CellsHelper.CellIndexToName(m_inumrows, m_icol);
m_sNseriesAddr = m_sAddress1 + ":" + m_sAddress2;
chart.NSeries.Add("Segment Data!" + m_sNseriesAddr, true);
Thanks,
Rob
Warren
April 30, 2007, 1:23am
4
Hi,
Thanks for your info. We have fixed this problem and will attach the fix in a few days.Thanks for your patience.
Hi,
Please try the attached version (4.2.0.2).
Thank you.