I want to update a cell in a spreadsheet that is used by a chart, using the Open XML SDK 2.0 (CTP). All the code samples I have found insert new cells. I am struggling with
var sheetData = new SheetData();
var row = UpdateCell("A","Hello World", 5);
sheetData.Append(row);
worksheet.Append(sheetData);
private static Row UpdateCell(string columnName, string value, int rowIndex)
{
Row row = new Row { RowIndex = (uint)rowIndex };
Cell c1 = new TextCell(columnName, value, rowIndex);
row.Append(c1);
return row;
}
public class TextCell : Cell
{
public TextCell(string header, string text, int index)
{
this.DataType = CellValues.InlineString;
this.CellReference = header + index;
//Add text to the text cell.
this.InlineString = new InlineString { Text = new Text { Text = text } };
}
}