Show code in...     

  

 

Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


ExcelApplication Object Reference

GetDataFromDataTable Method

GetDataFromDataTable is available in .NET only. To import database values with ADO in ASP, using ExcelApplication, use CopyFromRecordSet or GetDataFromRecordset.

GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames, FirstRow, FirstCol, FieldList, FieldListMode)
GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames, FirstRow, FirstCol, MaxRows, MaxColumns)
GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames, FirstRow, FirstCol, MaxRows, MaxColumns, FieldList, FieldListMode)
GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames, FirstRow, FirstCol)

GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames,
                              FirstRow, FirstCol, FieldList, FieldListMode)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataTable(SAWorksheet Worksheet, DataTable DataTable,
		bool ShowFieldNames, int FirstRow, int FirstCol,
		string FieldList, SAXLFieldListMode FieldListMode)
Description:
GetDataFromDataTable imports an ADO.NET DataTable into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataTable will be imported to this worksheet.
  • DataTable
    The ADO.NET DataTable to import to the worksheet.
  • ShowFieldNames
    If set to True, DataTable column headers will be imported to the first row.
  • MaxRows
    Specifies the maximum number of rows to import from the data source. To import the maximum rows available, use the constant ExcelApplication.ALL_ROWS. Note: Excel 95 will delete rows after 16,384.
  • FieldList
    DataTable fields to include or exclude in the spreadsheet, depending on the value of FieldListMode. The parameter FieldList is a comma delimited string specifying DataTable fields to include or exclude. They may be referenced by field name or position, or both. The order in which fields are specified in the FieldList parameter is the order in which they will be returned.
  • FieldListMode
    Includes or excludes fields listed in FieldList parameter. To include only fields specified by the parameter FieldList, set FieldListMode to saxlsInclude.
Returns:
A Range object.
Example:
SARange Range1 = XlwApp.GetDataFromDataTable(WrkSht1, Table, true, 7, 1, 
		"ID,Category", saxlsExclude);

Top


GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames,
                              FirstRow, FirstCol, FieldList, FieldListMode)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataTable(SAWorksheet Worksheet, DataTable DataTable,
		bool ShowFieldNames, int FirstRow, int FirstCol,
		string FieldList, SAXLFieldListMode FieldListMode)
Description:
GetDataFromDataTable imports an ADO.NET DataTable into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataTable will be imported to this worksheet.
  • DataTable
    The ADO.NET DataTable to import to the worksheet.
  • ShowFieldNames
    If set to True, DataTable column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataTable.
  • FirstCol
    First worksheet column for the imported DataTable.
  • FieldList
    DataTable fields to include or exclude in the spreadsheet, depending on the value of FieldListMode. The parameter FieldList is a comma delimited string specifying DataTable fields to include or exclude. They may be referenced by field name or position, or both. The order in which fields are specified in the FieldList parameter is the order in which they will be returned.
  • FieldListMode
    Includes or excludes fields listed in FieldList parameter. To include only fields specified by the parameter FieldList, set FieldListMode to saxlsInclude.
Returns:
A Range object.
Example:
SARange Range1 = XlwApp.GetDataFromDataTable(WrkSht1, Table, true, 7, 1, 
		"ID,Category", saxlsExclude);

Top


GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames,
                              FirstRow, FirstCol, MaxRows, MaxColumns, FieldList, FieldListMode)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataTable(SAWorksheet Worksheet, DataTable DataTable,
		bool ShowFieldNames, int FirstRow, int FirstCol,
		string FieldList, SAXLFieldListMode FieldListMode)
Description:
GetDataFromDataTable imports an ADO.NET DataTable into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataTable will be imported to this worksheet.
  • DataTable
    The ADO.NET DataTable to import to the worksheet.
  • ShowFieldNames
    If set to True, DataTable column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataTable.
  • FirstCol
    First worksheet column for the imported DataTable.
  • MaxRows
    Specifies the maximum number of rows to import from the data source. To import the maximum rows available, use the constant ExcelApplication.ALL_ROWS. Note: Excel 95 will delete rows after 16,384.
  • MaxColumns
    Specifies the maximum number of columns to import from the data source. To import the maximum columns available, use the constant ExcelApplication.ALL_COLUMNS.
  • FieldList
    DataTable fields to include or exclude in the spreadsheet, depending on the value of FieldListMode. The parameter FieldList is a comma delimited string specifying DataTable fields to include or exclude. They may be referenced by field name or position, or both. The order in which fields are specified in the FieldList parameter is the order in which they will be returned.
  • FieldListMode
    Includes or excludes fields listed in FieldList parameter. To include only fields specified by the parameter FieldList, set FieldListMode to saxlsInclude.
Returns:
A Range object.
Example:
SARange Range1 = XlwApp.GetDataFromDataTable(WrkSht1, Table, true, 7, 1, 
		50, 10, "ID,Category", saxlsExclude);

Top


GetDataFromDataTable(Worksheet, DataTable, ShowFieldNames,
                              FirstRow, FirstCol)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataTable(SAWorksheet Worksheet, DataTable DataTable,
		bool ShowFieldNames, int FirstRow, int FirstCol)
Description:
GetDataFromDataTable imports an ADO.NET DataTable into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataTable will be imported to this worksheet.
  • DataTable
    The ADO.NET DataTable to import to the worksheet.
  • ShowFieldNames
    If set to True, DataTable column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataTable.
  • FirstCol
    First worksheet column for the imported DataTable.
Returns:
A Range object.
Example:
SARange Range1 = XlwApp.GetDataFromDataTable(WrkSht1, Table, true, 7, 1);

Top


Copyright © 2005, SoftArtisans, Inc.