New to Telerik UI for WinForms? Start a free 30-day trial
Set Column Width and Row Height with ExcelML format
Updated over 6 months ago
Columns Width
You can set the columns with by using the ExcelTableCreated event. This event allows you to access the the column attributes and set the columns width.
C#
private void Exporter_ExcelTableCreated(object sender, Telerik.WinControls.UI.Export.ExcelML.ExcelTableCreatedEventArgs e)
{
foreach (ColumnElement item in e.ExcelTableElement.Columns)
{
item.Attributes["ss:Width"] = "300";
}
}
Rows Height
You can set the rows height by using the ExcelRowFormating event. This event allows you to access the the row attributes and set the height.
C#
private void Exporter_ExcelRowFormatting(object sender, ExcelRowFormattingEventArgs e)
{
if (e.ExcelRowElement.Attributes.Contains("ss:Height"))
{
var att = e.ExcelRowElement.Attributes["ss:Height"];
if (Convert.ToInt32(att) > 400)
{
e.ExcelRowElement.Attributes["ss:Height"] = "400";
}
}
}