Gets a list with the names of the worksheets in a Microsoft Excel (.XLS) file.
'Declaration
Public Function LoadExcelSheetNames( _
ByVal As String _
) As String()
'Usage
Dim instance As C1FlexGridBase
Dim fileName As String
Dim value() As String
value = instance.LoadExcelSheetNames(fileName)
Parameters
- fileName
- Name of the Excel file, including the path.
Return Value
An array containing the names of the worksheets defined in the file.
The code below loads all sheets in an Excel workbook into a collection of grids in a TabControl:
// clear tabControl
tabControl.TabPages.Clear();
// load sheet names
string fileName = "c:\book1.xls";
string[] sheets = _flexGrid.LoadExcelSheetNames(fileName);
// load each sheet
foreach (string sheetName in sheets)
{
// create a new grid for this sheet
C1FlexGrid flex = new C1FlexGrid();
flex.Dock = DockStyle.Fill;
// load sheet into new grid
flex.LoadExcel(fileName, sheetName);
// add grid to the tabControl
TabPage page = new TabPage();
page.Controls.Add(flex);
page.Text = sheetName;
tabControl.TabPages.Add(page);
}
Target Platforms: 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