【发布时间】:2019-07-08 18:43:44
【问题描述】:
我需要通过 OpenXML 在 Excel 行中添加一些额外的单元格。但是,下面的代码似乎并没有起到作用。希望有任何帮助以使这项工作正常进行。
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;
}
【问题讨论】: