Hello, I am creating a workbook with a worksheet and a table. Afterwards I want to change the title of the header for each column. I have already tried different ways, but when I open the xmls file, excel shows an error message(after pressing repair file it opens). It seems like that other user had also the same problem, but not any these solutions have worked for me. Maybe someone can give me a hint. From my config, I am getting the new header text. Here my code:
var headerRows = myTable.HeadersRow();
for (var i = 1; i <= headerRows.CellCount(); i++)
{
var newheaderText = config.Columns[i - 1].HeaderText;
myTable.Field(headerRows.Cell(i).Value.ToString()).Name = newheaderText;
headerRows.Cell(i).SetValue(newheaderText);
}
myWorkBook.SaveAs(stream);