Hi folks,
my first question would be the following. I am trying to Export a Webgrid which is design with multi column headers. Each time the export works fine except the mutli cloumn header wich i added in the webgrid's UWG_InitializeLayout Method the following way.
In the Browser it works fine. But after Export it is invisible.
Dim ch As New Infragistics.WebUI.UltraWebGrid.ColumnHeader(True) ch.Caption = "Employee's Name" ' set the origin to be on the top most level of the header ch.RowLayoutColumnInfo.OriginY = 0 ' extend the newly added header over 3 columns ch.RowLayoutColumnInfo.SpanX = 20 ' add the header into the header layout e.Layout.Bands(0).HeaderLayout.Add(ch)
This is LINQ, I am using VS.NEt 2008 , Insetad of looping to match the cell value with the loop's cell value I used this statement:
childCell = cells.Where(i => i.Value.ToString() == cells[cnt].Value.ToString()).LastOrDefault();
Count() function on row and cell is also being provided as part of LINQ.
if (e.CurrentWorksheet.Rows.Count() == 1)
for (int cnt = 0; cnt <= cells.Count() - 1; cnt++)
{
all these are not working for me. if u see in the above if and for conditions rows.count() and cells.count() function is not working. There is no count option after rows and cells.
childCell = cells.Where(i => i.Value.ToString() == cells[cnt].Value.ToString()).LastOrDefault(); - this statement also its not working. what this actually means. from where does that "i" comes from. why it is not working? should i need to add anything. please help me out.
This indeed is C#.
Hi,
Can i know in which language u posted the above code? Is it C#..because some of the functionalities are not working in C#. I have the same problem of exporting the multicolumn header.
Sure, I got it work by doing following Steps:
1) Add the Column as a new Grid Row in begin Export method.
2) In HeaderCellExporting event, you will get the Sub Column, Change the export to write our main Column headers.
3) In RowExporting event, merge the Header Columns to have Sub-Columns.
What I did is I added all the events to the excel Exporter to track the Export progess.
excelExporter1.RowExporting += new RowExportingEventHandler(excelExporter1_RowExporting);
In begin Export:
newRow.Cells.Add(new UltraGridCell(item.HeaderText));
//item.Header.Style.BackColor = ColorTranslator.FromHtml(GRID_MAIN_HEADER_COLOR);
}
e.CurrentWorksheet.PrintOptions.Header = "Report";
e.CurrentWorksheet.PrintOptions.PaperSize = PaperSize.A4;
//Header Export
e.HeaderText= 'Change the way you want.
//Merge the Header Cells
Infragistics.Excel.WorksheetCell childCell;
e.CurrentWorksheet.MergedCellsRegions.Add(0, cnt, 0, childCell.ColumnIndex);
cnt = childCell.ColumnIndex;
e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].ClearComment();
Let me know if you need any further help.