I need to add some extra cells to an excel row via OpenXML. However, the code below does not seem to be doing the trick. Would appreciate any help to get this working please.
private Row PadRow(Row row, int p)
{
try
{
int currentcount = p - row.Descendants<Cell>().Count<Cell>();
for (int count = 0; count < currentcount; count++)
row.Append(new Cell() { DataType = CellValues.String, CellValue = new CellValue(" ") });
}
catch (Exception ex)
{
throw ex;
};
return row;
}
Found a great fix.
http://lateral8.com/articles/2010/3/5/openxml-sdk-20-export-a-datatable-to-excel.aspx