Hi,
I have found a lot of code that explain how to export XamGrid with Grouping-By but it doesn't export the columns header.
Do you have any sample that show the way to do it, Exporting XamGrid wiht columns header and grouping-by please?!?
Thanks.
Gilles P.
Because I didn't have no answer, here is the solution I have found:
private void IterateRow(Row row)
{
int columnIndex = currentMergedColumn;
WorksheetCell worksheetCell;
// loap for the header column always to the top of the excel grid
foreach (Cell cell in row.Cells)
sheet.Rows[0].Cells[columnIndex].Value = cell.Column.HeaderText;
sheet.Columns[columnIndex].Width = (int)cell.Column.Width.Value.Value;
//Set header cell color and and borders
worksheetCell = sheet.Rows[0].Cells[columnIndex];
worksheetCell.CellFormat.FillPatternForegroundColor = Colors.LightGray;
worksheetCell.CellFormat.LeftBorderColor = Color.FromArgb(0, 178, 178, 178);
worksheetCell.CellFormat.RightBorderColor = Color.FromArgb(0, 178, 178, 178);
sheet.Columns[columnIndex].Width = 5000;
columnIndex++;
}
columnIndex = currentMergedColumn;
sheet.Rows[currentMergedRow].Cells[columnIndex].Value = cell.Value;
currentMergedRow++;