I used e.Worksheet.Table.Columns.RemoveAt(3) under ExcelMLExportRowCreated to remove column (TagID) but doesn't work.
I can't make the TagID column invisible on the grid display because I need to use this TagID for checking when remove selected rows. .
-----------------------------------------------------------------------------------
if (!list.Contains(e.Row.Cells.GetCellByName("TagID"
{
if (e.RowType == GridExportExcelMLRowType
{
Int32
e.Worksheet.Table.Rows.Remove(e.Row); // remove rows worked
}
}
{
e.Worksheet.Table.Columns.RemoveAt(3); // want to remove TagID column from excel display (index id is 3) but didn't work
}
Please help!
8 Answers, 1 is accepted
You can hide the desired column by setting the Hidden property of the ColumnElement to true. Otherwise you will have to remove not only the column element but the relevant cells also.
ExcelML structure / GridExcelBuilder
Please use the Code snippet tool (in the toolbox above) when you paste code in the forum thread.
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Thanks,
Jessie
You have to hide the column in the ExcelMLExportRowCreated event if you use pre-Q1 2011 version. A possible approach would be to check whether the current item is the last one so that you can hide the desired columns. Dummy code:
if
(e.Worksheet.Table.Rows.Count == RadGrid1.Items.Count)
{
foreach
(ColumnElement col
in
... )
{
col.Hidden =
true
;
}
}
Note that this is just an example and not a runnable code - you will have to take the header row into consideration.
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
I don't see the col (ColumnElement col) has property "hidden"- pre-Q1 2011
Just add the ss:Hidden attribute to the ColumnElement object as shown below:
colElement.Attributes.Add(
"ss:Hidden"
,
"1"
);
Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
I'm glad that my suggestions were helpful to you. I would recommend that you bookmark the link below, it points to Microsoft's XMLSS documentation:
XML Spreadsheet Reference
Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Jessie