Solved

Convert client Excel File to Xml File for DataSet VB.NET

Posted on 2004-10-20
3
520 Views
Last Modified: 2008-02-01
Hi,

I have a Windows App that converts a DataSet into an XML (WriteXml) file and then converts the XML file into a CSV file (XSLT) and then converts this to an Excel File.

I now want to do this in reverse, and let the client choose an Excel file to convert and import into the App to be viewed as a DataSet. The question has three parts:

1. I am stubbornly using XML as an intermediate so that I can learn to build more flexible applications. Is this a good idea, or should I just connect directly to the Client's Excel file to save myself some trouble?

2. What kind of connection works for reading Excel files into DataSets and will this work on any client's machine?

3. Does anyone know code that will let the user specify the Excel file to be converted, and then convert it to CSV so that I can transform it to XML?

Thanks.

0
Comment
Question by:nathanpz
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 500 total points
Comment Utility
1. It is a good idea to use XML as a intermediary. Since u are porting the information to a client computer Xml is a interoperable solution for such application. If u directly try to port a excel file there might be issues depending on the version of  Excel.

2 U can use System.Data.OleDbClient  connection
 Follow this link
http://codeproject.com/dotnet/ExportExcelData.asp


3. To convert a Excel to CSV u can use the following

 Public Function ConvertCSVToXLS(ByVal strCSVFile As String, ByVal strXLSFile As String)
  Dim oExcel As Excel.Application
  Set oExcel = New Excel.Application
 
  Dim oBook As Workbook
  Set oBook = oExcel.Workbooks.Open(strCSVFile)
    oBook.SaveAs strXLSFile, xlExcel9795
  Set oBook = Nothing
 
  oExcel.Quit
  Set oExcel = Nothing
End Function

Here u are basically saving the excel as CSV.

For futhur information about using Excel in a application u can follow this link
http://www.c-sharpcorner.com/winforms/ExcelReadMG.asp
0
 

Author Comment

by:nathanpz
Comment Utility
Thanks 123...

That looks great. I'll try a few of the things out and have a verdict in the next day or so.

Thanks again.
Nathan.
0
 

Author Comment

by:nathanpz
Comment Utility
Points are yours 123...

I'm not familiar with C# but I'm still getting somewhere now so thanks.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now