New to Telerik UI for WPFStart a free 30-day trial

InitializingExcelMLStyles

Updated on Sep 15, 2025

his event will be only raised when exporting with ExportFormat.ExcelML

You can define a Style when InitializingExcelMLStyles event is raised. For example:

Example 1: Define a style:

C#
	ExcelMLStyle style = new ExcelMLStyle("0");
	style.Alignment.Horizontal = ExcelMLHorizontalAlignment.Automatic;
	e.Styles.Add(style);

You can find a list of the properties that could be set for ExcelMLStyle:

Alignment:

  • Horizontal - you can choose a specific alignment through ExcelMLHorizontalAlignment enumeration.
  1. Vertical - you can choose a specific alignment through ExcelMLVerticalAlignment enumeration.
  2. Indent
  3. Rotate
  4. ShrinkToFit
  5. VerticalText
  6. WrapText

Font:

  • Bold
  1. Color
  2. FontName
  3. Italic
  4. Outline (only for Mac)
  5. Size
  6. StrikeThrough
  7. Underline - you can choose a specific underline through ExcelMLUnderline

Interior:

  • Color - You must also set Pattern in order to be applied Interior.Color
  1. Pattern - you can choose a specific pattern through ExcelMLPattern
  2. PatternColor - You must also set Pattern in order to be applied Interior.PatternColor

NumberFormat:

  • Format

Example 7: Apply a style before exporting:

C#
	private void clubsGrid_InitializingExcelMLStyles_1(object sender, ExcelMLStylesEventArgs e)
	{
	    ExcelMLStyle style = new ExcelMLStyle("0");
	
	    // Alignment
	    style.Alignment.Horizontal = ExcelMLHorizontalAlignment.Automatic;
	    style.Alignment.Vertical = ExcelMLVerticalAlignment.Top;
	    style.Alignment.Indent = 5;
	    style.Alignment.Rotate = 0;
	    style.Alignment.ShrinkToFit = true;
	    style.Alignment.VerticalText = true;
	    style.Alignment.WrapText = true;
	
	    // Font
	    style.Font.Bold = true;
	    style.Font.Color = "Beige";
	    style.Font.FontName = "Calibri";
	    style.Font.Italic = true;
	    style.Font.Outline = true;
	    style.Font.Shadow = true;
	    style.Font.Size = 10;
	    style.Font.StrikeThrough = true;
	    style.Font.Underline = ExcelMLUnderline.Double;
	
	    // Interior
	    style.Interior.Color = "Green";
	    style.Interior.Pattern = ExcelMLPattern.Solid;
	    style.Interior.PatternColor = "#FF0000";
	
	    // NumberFormat
	    style.NumberFormat.Format = "00.00";
	
	    e.Styles.Add(style);
	}

See Also

In this article
See Also
Not finding the help you need?
Contact Support