ByteScout Data Extraction Suite - VB.NET - Convert xml to xls with spreadsheet sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Data Extraction Suite – VB.NET – Convert xml to xls with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – VB.NET – Convert xml to xls with spreadsheet sdk

How to convert xml to xls with spreadsheet sdk in VB.NET with ByteScout Data Extraction Suite

Step-by-step tutorial on how to convert xml to xls with spreadsheet sdk in VB.NET

Source code documentation samples give simple and easy method to install a needed feature into your application. ByteScout Data Extraction Suite is the set that includes 3 SDK products for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK. It can be applied to convert xml to xls with spreadsheet sdk using VB.NET.

This prolific sample source code in VB.NET for ByteScout Data Extraction Suite contains various functions and other necessary options you should do calling the API to convert xml to xls with spreadsheet sdk. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Use of ByteScout Data Extraction Suite in VB.NET is also described in the documentation included along with the product.

The trial version of ByteScout Data Extraction Suite can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Module1.vb
      
Imports System.Drawing Imports System.Xml Imports Bytescout.Spreadsheet Imports Bytescout.Spreadsheet.Constants Module Module1 Sub Main() ' Load XML document Dim xmlDocument = New XmlDocument() xmlDocument.Load("sample.xml") ' Read columns information from XML data Dim columns = New List(Of String)() Dim columnNodeList = xmlDocument.SelectNodes("/Report/Columns/Column") For Each node As XmlNode In columnNodeList columns.Add(node.Attributes("Name").Value) Next ' Read row nodes from XML data Dim rowNodeList = xmlDocument.SelectNodes("/Report/ReportData") ' Create new spreadsheet Dim spreadsheet = New Spreadsheet() spreadsheet.RegistrationName = "demo" spreadsheet.RegistrationKey = "demo" ' Add worksheet Dim worksheet = spreadsheet.Worksheets.Add() ' Add column headers For c As Integer = 0 To columns.Count - 1 worksheet(0, c).Value = columns(c) worksheet(0, c).FillPattern = PatternStyle.Solid worksheet(0, c).FillPatternForeColor = Color.LightGray Next Dim rowIndex = 1 ' Add rows For Each rowNode As XmlNode In rowNodeList ' Get cell values from XML data For Each childNode As XmlNode In rowNode.ChildNodes ' Get cell info from XML data Dim columnIndex = columns.IndexOf(childNode.Name) Dim cellValue = childNode.InnerText Dim cell = worksheet(rowIndex, columnIndex) ' Set cell text Cell.Value = cellValue ' Set cell text alignment cell.AlignmentHorizontal = IIf(columnIndex = 0, AlignmentHorizontal.Left, AlignmentHorizontal.Right) Next ' Add the row to the table rowIndex = rowIndex + 1 Next ' Fit columns width to cell data For c As Integer = 0 To columns.Count - 1 worksheet.Columns(c).AutoFit() Next ' Save document to file spreadsheet.SaveAsXLS("result.xls") ' Cleanup spreadsheet.Dispose() ' Open document in Excel Process.Start("result.xls") End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next