// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml");
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument
' Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile("C:\Samples\XML Spreadsheet.xml")
C++// Create an instance of the class that imports Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook) ;
// Import XML Spreadsheet Excel file
workbook->easy_LoadXMLSpreadsheetFile_2("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code ListingC++.NET// Create an instance of the class that imports Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import XML Spreadsheet Excel file
workbook->easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code Listing
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml");
.NET:// Create an instance of the class that imports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import XML Spreadsheet Excel file
$workbook->easy_LoadXMLSpreadsheetFile_2("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code ListingJava:// Create an instance of the class that imports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import XML Spreadsheet Excel file
$workbook->easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code Listing
' Create an instance of the class that imports Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile_2("C:\Samples\XML Spreadsheet.xml")
' Create an instance of the class that imports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile_2("C:\Samples\XML Spreadsheet.xml")
' Create an instance of the class that imports Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import XML Spreadsheet Excel file
workbook.easy_LoadXMLSpreadsheetFile_2("C:\Samples\XML Spreadsheet.xml")
<!-- Create an instance of the class that imports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import XML Spreadsheet Excel file --><cfset ret = workbook.easy_LoadXMLSpreadsheetFile(C:\Samples\XML Spreadsheet.xml")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import XML Spreadsheet file
workbook.easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code ListingJava:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import XML Spreadsheet file
workbook.easy_LoadXMLSpreadsheetFile("C:\\Samples\\XML Spreadsheet.xml")
Click here to see Continuous Code Listing
Read XML Spreadsheet file into DataTable in C# and VB.NET
EasyXLS library can be used to import XML Spreadsheet file into DataTable. The DataTable can be the used as data source of a GridView, DataGridView, DataGrid or for any other purposes.
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import XML Spreadsheet to DataTable
DataSet ds = workbook.easy_ReadXMLSpreadsheet_AsDataSet(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
DataTable dt = ds.Tables[0];
// Display imported DataTable valuesfor (int row = 0; row < dt.Rows.Count; row++)
for (int column = 0; column < dt.Columns.Count; column++)
Console.WriteLine("At row " + (row + 1) + ", column " + (column + 1) +
" the value is '" + dt.Rows[row].ItemArray[column] + "'");
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument()
' Import XML Spreadsheet to DataTableDim ds As DataSet = workbook.easy_ReadXMLSpreadsheet_AsDataSet(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
Dim dt As DataTable = ds.Tables(0)
' Display imported DataTable valuesFor row As Integer = 0 To dt.Rows.Count - 1
For column As Integer = 0 To dt.Columns.Count - 1
Console.WriteLine("At row " & (row + 1) & ", column " & (column + 1) &
" the value is '" & dt.Rows(row).ItemArray(column) & "'")
NextNext
Read XML Spreadsheet file into GridView in C# and VB.NET from ASP.NET
EasyXLS library can be used to import XML Spreadsheet data into GridView from ASP.NET web applications.
The data from the XML Spreadsheet file file can be read using ExcelDocument.easy_ReadXMLSpreadsheet_AsDataSet method and then the DataTable for the GridView can be obtained from the imported DataSet.
Read XML Spreadsheet file into DataGridView in C# and VB.NET
EasyXLS library can be used to import XML Spreadsheet data into DataGridView from windows applications and windows forms.
The data from the XML Spreadsheet file can be read using ExcelDocument.easy_ReadXMLSpreadsheet_AsDataSet method and then the DataTable for the DataGridView can be obtained from the imported DataSet.
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import XML Spreadsheet to DataSet
DataSet ds = workbook.easy_ReadXMLSpreadsheet_AsDataSet(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
DataTable dt = ds.Tables[0];
// Display imported DataSet valuesfor (int row = 0; row < dt.Rows.Count; row++)
for (int column = 0; column < dt.Columns.Count; column++)
Console.WriteLine("At row " + (row + 1) + ", column " + (column + 1) +
" the value is '" + dt.Rows[row].ItemArray[column] + "'");
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument()
' Import XML Spreadsheet to DataSetDim ds As DataSet = workbook.easy_ReadXMLSpreadsheet_AsDataSet(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
Dim dt As DataTable = ds.Tables(0)
' Display imported DataSet valuesFor row As Integer = 0 To dt.Rows.Count - 1
For column As Integer = 0 To dt.Columns.Count - 1
Console.WriteLine("At row " & (row + 1) & ", column " & (column + 1) &
" the value is '" & dt.Rows(row).ItemArray(column) & "'")
NextNext
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import the XML Spreadsheet file to List
EasyXLS.Util.List rows = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List values
EasyXLS.Util.List row;
for (int rowIndex=0; rowIndex < rows.size(); rowIndex++)
{
row = (EasyXLS.Util.List)rows.elementAt(rowIndex);
for (int cellIndex=0; cellIndex < row.size(); cellIndex++)
{
Console.WriteLine("At row " + (rowIndex + 1) +
", column " + (cellIndex + 1) +
" the value is '" + row.elementAt(cellIndex));
}
}
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument
' Import the XML Spreadsheet file to ListDim rows As EasyXLS.Util.List = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
' Display imported List valuesDim row As EasyXLS.Util.List
For rowIndex As Integer = 0 To rows.size - 1
row = rows.elementAt(rowIndex)
For cellIndex As Integer = 0 To row.size() - 1
Console.WriteLine("At row " & (rowIndex + 1) & ", column " &
(cellIndex + 1) & " the value is '" & row.elementAt(cellIndex))
NextNext
C++// Create an instance of the class that imports Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook) ;
// Import the XML Spreadsheet file to List
EasyXLS::IListPtr rows = workbook->easy_ReadXMLSpreadsheet_AsList_2(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List valuesfor (int rowIndex=0; rowIndex<rows->size(); rowIndex++)
{
EasyXLS::IListPtr row = (EasyXLS::IListPtr)rows->elementAt(rowIndex);
for (int cellIndex=0; cellIndex<row->size(); cellIndex++)
{
printf("At row %d, column %d the value is '%s'\n",
(rowIndex+ 1), (cellIndex+ 1),
(LPCSTR)((_bstr_t)row->elementAt(cellIndex)));
}
}
C++.NET// Create an instance of the class that imports Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import the XML Spreadsheet file to List
EasyXLS::Util::List^ rows = workbook->easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List values
EasyXLS::Util::List ^row;
StringBuilder ^str;
for (int rowIndex=0; rowIndex < rows->size(); rowIndex++)
{
row = safe_cast<EasyXLS::Util::List^>(rows->elementAt(rowIndex));
for (int cellIndex=0; cellIndex < row->size(); cellIndex++)
{
str = gcnew StringBuilder();
str->Append(String::Concat("At row ", (rowIndex + 1).ToString(),
", column ", (cellIndex + 1).ToString()));
str->Append(String::Concat(" the value is '",
row->elementAt(cellIndex)->ToString()));
Console::WriteLine(str);
}
}
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import the XML Spreadsheet file to List
EasyXLS.Util.List rows = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List values
EasyXLS.Util.List row;
for (int rowIndex=0; rowIndex < rows.size(); rowIndex++)
{
row = (EasyXLS.Util.List)rows.elementAt(rowIndex);
for (int cellIndex=0; cellIndex < row.size(); cellIndex++)
{
System.out.println("At row " + (rowIndex + 1) +
", column " + (cellIndex + 1) +
" the value is '" + row.elementAt(cellIndex));
}
}
.NET:// Create an instance of the class that imports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import the XML Spreadsheet file to List
$rows = $workbook->easy_ReadXMLSpreadsheet_AsList_2(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List valuesfor ($rowIndex=0; $rowIndex<$rows->size(); $rowIndex++)
{
$row = $rows->elementAt($rowIndex);
for ($cellIndex=0; $cellIndex<$row->size(); $cellIndex++)
{
echo"At row ".($rowIndex + 1).", column ".($cellIndex + 1).
" the value is '".$row->elementAt($cellIndex)."'<br>";
}
}
Java:// Create an instance of the class that imports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import the XML Spreadsheet file to List
$rows = $workbook->easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1");
// Display imported List valuesfor ($rowIndex=0; $rowIndex<(int)(string)$rows->size(); $rowIndex++)
{
$row = $rows->elementAt($rowIndex);
for ($cellIndex=0; $cellIndex<(int)(string)$row->size(); $cellIndex++)
{
echo"At row ".($rowIndex + 1).", column ".($cellIndex + 1).
" the value is '".$row->elementAt($cellIndex)."'<br>";
}
}
' Create an instance of the class that imports Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import the XML Spreadsheet file to List
Set rows = workbook.easy_ReadXMLSpreadsheet_AsList_2( _
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
' Display imported List valuesfor rowIndex = 0 to rows.size() - 1
Set row = rows.elementAt(rowIndex)
for cellIndex = 0 to row.size - 1
response.write("At row " & (rowIndex + 1) & _
", column " & (cellIndex + 1) & _
" the value is '" & row.elementAt(cellIndex) & "'< br>")
nextnext
' Create an instance of the class that imports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import the XML Spreadsheet file to ListSet rows = workbook.easy_ReadXMLSpreadsheet_AsList_2( _
"C:\Samples\XML Spreadsheet.xml", "Sheet1")
' Display imported List valuesFor rowIndex = 0 To rows.Size() - 1
Set row = rows.elementAt(rowIndex)
For cellIndex = 0 To row.Size - 1
Me.Label1 = Me.Label1 & "At row " & (rowIndex + 1) & ", column " & _
(cellIndex + 1) & " the value is '" & _
row.elementAt(cellIndex) & "'" & vbCrLf
NextNext
' Create an instance of the class that imports Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import the XML Spreadsheet file to Listset rows = workbook.easy_ReadXMLSpreadsheet_AsList_2( _
"C:\Samples\XML Spreadsheet.xml", "Sheet1")
' Display imported List valuesFor rowIndex = 0 To rows.Size() - 1
Set row = rows.elementAt(rowIndex)
For cellIndex = 0 To row.Size - 1
WScript.StdOut.WriteLine("At row " & (rowIndex + 1) & _
", column " & (cellIndex + 1) & _
" the value is '" & row.elementAt(cellIndex) & "'")
NextNext
<!-- Create an instance of the class that imports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import the XML Spreadsheet file to List --><cfset rows = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")><!-- Display imported List values --><cfobject type="java"class="EasyXLS.Util.List"name="row"action="CREATE"><cfloop from="0"to="#rows.size()-1#"index="rowIndex"><cfset row = rows.elementAt(rowIndex)><cfloop from="0"to="#row.size()-1#"index="cellIndex"><cfoutput>
At row #evaluate(rowIndex + 1)#, column #evaluate(cellIndex + 1)#
the value is '#row.elementAt(cellIndex)#'<br>
</cfoutput>
</cfloop>
</cfloop>
.NET:# Create an instance of the class that imports Excel files
workbook = ExcelDocument()
# Import the XML Spreadsheet file to List
rows = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
# Display imported List valuesfor rowIndex in range(rows.size()):
row = rows.elementAt(rowIndex)
for cellIndex in range(row.size()):
print("At row " + str(rowIndex + 1) + ", column " + str(cellIndex + 1) +
" the value is '" + str(row.elementAt(cellIndex)) + "'")
Java:# Create an instance of the class that imports Excel files
workbook = gateway.jvm.ExcelDocument()
# Import the XML Spreadsheet file to List
rows = workbook.easy_ReadXMLSpreadsheet_AsList(
"C:\\Samples\\XML Spreadsheet.xml", "Sheet1")
# Display imported List valuesfor rowIndex in range(rows.size()):
row = rows.elementAt(rowIndex)
for cellIndex in range(row.size()):
print("At row " + str(rowIndex + 1) + ", column " + str(cellIndex + 1) +
" the value is '" + str(row.elementAt(cellIndex)) + "'")
Read XML Spreadsheet file into DataGrid in C# and VB.NET
EasyXLS library can be used to import XML Spreadsheet data into DataGrid from windows applications and windows forms.
The data from the XML Spreadsheet file can be read using ExcelDocument.easy_ReadXMLSpreadsheet_AsDataSet method and then the DataTable for the DataGrid can be obtained from the imported DataSet.