的ExcelCellFormatting
事件可能帮助您:
它提供对单个单元格的SingleStyleElement的访问权限,允许您进行其他格式设置(添加边框,设置对齐方式,文本字体,公司lours,对于每一个更改单元格值等)优于相关出口RadGridView细胞:
void exporter_ExcelCellFormatting(object sender,Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventArgs e)
{
if (e.GridRowInfoType == typeof(GridViewTableHeaderRowInfo))
{
BorderStyles border = new BorderStyles();
border.Color = Color.Black;
border.Weight = 2;
border.LineStyle = LineStyle.Continuous;
border.PositionType = PositionType.Bottom;
e.ExcelStyleElement.Borders.Add(border);
}
else if (e.GridRowIndex == 2 && e.GridColumnIndex == 1)
{
e.ExcelStyleElement.InteriorStyle.Color = Color.Yellow;
e.ExcelStyleElement.AlignmentElement.WrapText = true;
}
}
点击here以获取更多信息。
感谢您的回答,但它给了我一个GridLines和BorderStyle的错误行。有什么我需要添加? – fadd
您可以在aspx页面中设置这些属性。 –
我正在运行Windows应用程序 – fadd