?
Solved

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

Posted on 2004-10-20
3
Medium Priority
?
531 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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