Version

ExcelFormatStr Property (InitializeColumnEventArgs)

Excel specific format string.
Syntax
'Declaration
 
Public Property ExcelFormatStr As String
public string ExcelFormatStr {get; set;}
Example
Following code uses InitializeColumn event to convert .NET specific format strings to Excel specific format strings. Two of the format strings are "manually" converted and all other formats are just copied (be careful with copying as some more complex format strings can cause Microsoft Excel to throw an error if not converted properly).

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub MyGridExporter_InitializeColumn(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.InitializeColumnEventArgs) Handles MyGridExporter.InitializeColumn
    Select Case e.FrameworkFormatStr
        Case "##.##"
            e.ExcelFormatStr = "[<>0]##.##;[=0]\" \ ";"

        Case "hh:mm:ss"
            e.ExcelFormatStr = "m.d.yy h:mm;@"

        Case Else
            e.ExcelFormatStr = e.FrameworkFormatStr
    End Select
End Sub
private void InitializeColumn_EH(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.InitializeColumnEventArgs e)
{
	switch(e.FrameworkFormatStr)
	{
		case "##.##":
			e.ExcelFormatStr = "[<>0]##.##;[=0]\"\";";
			break;

		case "hh:mm:ss":
			e.ExcelFormatStr = "m.d.yy h:mm;@";
			break;

		default:
			e.ExcelFormatStr = e.FrameworkFormatStr;
			break;
	}
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also