Version

Export(UltraGrid,String) Method

Exports the passed in grid to specified file.
Syntax
'Declaration
 
Public Overloads Function Export( _
   ByVal grid As Infragistics.Win.UltraWinGrid.UltraGrid, _
   ByVal fileName As String _
) As Infragistics.Documents.Excel.Workbook
public Infragistics.Documents.Excel.Workbook Export( 
   Infragistics.Win.UltraWinGrid.UltraGrid grid,
   string fileName
)

Parameters

grid
Grid to export.
fileName
Name and path of resulting excel file.

Return Value

Created Infragistics.Documents.Excel.Workbook.
Example
Following code shows how to use different Export overloads.

private void button2_Click(object sender, System.EventArgs e)
{
	// overload 1
	this.MyGridExporter.Export(this.ultraGrid1, "Test1.xls");
}

private void button3_Click(object sender, System.EventArgs e)
{
	// overload 2
	Workbook wb1 = this.MyGridExporter.Export(this.ultraGrid1);

	wb1.Save("Test2.xls");

	Workbook wb2 = new Workbook();

	// overload 3
	this.MyGridExporter.Export(this.ultraGrid1, wb2);

	Worksheet secondWS = wb2.Worksheets.Add("SecondSheet");

	// overload 4
	this.MyGridExporter.Export(this.ultraGrid1, secondWS);

	wb2.Save("Test3.xls");

	Workbook wb3 = new Workbook();

	// overload 5
	this.MyGridExporter.Export(this.ultraGrid1, wb3, 1, 2);

	Worksheet someWS = wb3.Worksheets.Add("SomeSheet");

	// overload 6
	this.MyGridExporter.Export(this.ultraGrid1, someWS, 2, 3);

	wb3.Save("Test4.xls");
}
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    ' overload 1
    Me.MyGridExporter.Export(Me.UltraGrid1, "Test1.xls")
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim wb1, wb2, wb3 As Workbook
    Dim secondWS, someWS As Worksheet

    ' overload 2
    wb1 = Me.MyGridExporter.Export(Me.UltraGrid1)

    wb1.Save("Test2.xls")

    wb2 = New Workbook()

    ' overload 3
    Me.MyGridExporter.Export(Me.UltraGrid1, wb2)

    secondWS = wb2.Worksheets.Add("SecondSheet")

    ' overload 4
    Me.MyGridExporter.Export(Me.UltraGrid1, secondWS)

    wb2.Save("Test3.xls")

    wb3 = New Workbook()

    ' overload 5
    Me.MyGridExporter.Export(Me.UltraGrid1, wb3, 1, 2)

    someWS = wb3.Worksheets.Add("SomeSheet")

    ' overload 6
    Me.MyGridExporter.Export(Me.UltraGrid1, someWS, 2, 3)

    wb3.Save("Test4.xls")
End Sub
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