Spread allows you to load and open an XML data file in the workbook. You can do this by using the OpenXML method of the IWorkbooks interface which accepts string type filename/stream as its parameter and returns an IWorkbook object.
The following code is used to open a data file using filename.
C# |
Copy Code
|
---|---|
// Opening XML data file in workbook using string type filename fpSpread1.Attach(fpSpread1.AsWorkbook().WorkbookSet.Workbooks.OpenXML("D:\\DataFormat.xml")); |
Visual Basic |
Copy Code
|
---|---|
' Opening XML data file in workbook using string type filename FpSpread1.Attach(FpSpread1.AsWorkbook().WorkbookSet.Workbooks.OpenXML("D:\DataFormat.xml")) |
The following code is used to open a workbook using stream parameter.
C# |
Copy Code
|
---|---|
// Opening XML data file in workbook using stream System.IO.FileStream stream = new System.IO.FileStream("D:\\DataFormat.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read); fpSpread1.Attach(fpSpread1.AsWorkbook().WorkbookSet.Workbooks.OpenXML(stream)); |
Visual Basic |
Copy Code
|
---|---|
' Opening XML data file in workbook using stream Dim stream As System.IO.FileStream = New System.IO.FileStream("D:\DataFormat.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read) FpSpread1.Attach(FpSpread1.AsWorkbook().WorkbookSet.Workbooks.OpenXML(stream)) |