ok, this is the code
worksheet.Cells.InsertRow(0);
worksheet.Cells.InsertRow(0);
//set the font styles for Report Name and view name.
string[] rptName = r.Name.Split((char)10);
worksheet.Cells[0, 0].PutValue(r.Name); // Report name
worksheet.Cells[0, 0].Characters(0, rptName[0].Length).Font.Size = 16;
worksheet.Cells[0, 0].Characters(0, rptName[0].Length).Font.IsBold = true;
worksheet.Cells[0, 0].Characters(rptName[0].Length + 1, rptName[1].Length).Font.Size = 12;
worksheet.Cells[0, 0].Characters(rptName[0].Length + 1, rptName[1].Length).Font.IsBold = false;
worksheet.Cells[0, 0].Style.IsTextWrapped = true;
//worksheet.Cells.SetRowHeightPixel(0, 45);
worksheet.Cells[0, 0].Style.Font.Color = System.Drawing.Color.White;
worksheet.Cells[0, 0].Style.HorizontalAlignment = TextAlignmentType.Left;
int intFreezCol = 0;
if (intcol != 0)
{
//for table reports
intFreezCol = intcol;
}
else
{
//for matrix reports
intFreezCol = curCol;
}
worksheet.Cells[0, intFreezCol].Style.HorizontalAlignment = TextAlignmentType.Right;
worksheet.Cells.Merge(0, 0, 1, intFreezCol);
// indicates that 2 rows are added, this must be taken care of while freezing panes.
intFreezRow = intFreezRow + 2;
for (int i = 0; i <= intFreezCol; i++)
{
worksheet.Cells[0, 0].Style.IsTextWrapped = true;
worksheet.Cells[0, i].Style.ForegroundColor = workbook.GetMatchingColor(System.Drawing.Color.Black);
worksheet.Cells[0, i].Style.Pattern = BackgroundType.Solid;
}
worksheet.AutoFitRow(0);