Solved

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

Posted on 2004-10-20
3
529 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 500 total points
ID: 12366997
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
ID: 12367181
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
ID: 12375962
Points are yours 123...

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb.net and creating a class 5 31
Get sourcecode path 14 47
Copying from a network share 3 26
Convert VB web project to C# 3 40
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 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