Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Database > Database General Discussion

Database General Discussion General discussion on database related topics

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-25-2008, 8:10 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Nov 2008
Location: Singapore
Posts: 18
Reputation: 18
reubenfoo is on a distinguished programming path ahead
Default Convert XLS into Txt

Hi all,

may i ask how do I convert an Excel file(.xls) into a text file(.txt) using VB.NET.

Does anyone have the coding for this?

thanks a million!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-25-2008, 8:19 PM
cjard's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

That's like saying "how do i convert an mp3 into a jpeg?" You'll need to be more specific about the layout of both files.

Also your question has little to do with Visual Studio itself (the environment you write programs in) so this is probably the wrong forum
__________________
DW1 DW2 DW3 DW4 DNU PQ

Last edited by cjard; 11-25-2008 at 8:45 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-25-2008, 8:41 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Nov 2008
Location: Singapore
Posts: 18
Reputation: 18
reubenfoo is on a distinguished programming path ahead
Default XLS to TXT

hm.. i would say. the excel data would be extracted from a database into like a gridview format. from there, it should be converted into a txt format with the use of delimiters to end a line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-25-2008, 8:47 PM
cjard's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

you can use the automation (loading excel into memory as an object and using it programmatically) to convert the file to csv..

..or you can use the Microsoft Jet database driver in excel mode (ConnectionStrings.com - Forgot that connection string? You will find it right here!) to access it like a db, read the file into a datatable, and then write it to disk as delimited text


See my recent edit to the other post about this topic being in the wronf section
__________________
DW1 DW2 DW3 DW4 DNU PQ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-25-2008, 9:30 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Nov 2008
Location: Singapore
Posts: 18
Reputation: 18
reubenfoo is on a distinguished programming path ahead
Default

Firstly, i would be selecting the excel file which is pulled from macpac, from my computer, next i would click on the button convert.

Once converted, it would generate a text file. which looks something like that

--------------------------------------------------------------------------

BANK@@@@7010052@@@@@@@@@@@@@@@@@@@@@@@65123465@@@@ @@Orderin Party@@@@Sin Cash@@@@@@65123369@@@@@@@@


--------------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-26-2008, 4:52 AM
cjard's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

can you provide by way of forum attachment, a "before" and "after" file youre expecting from this process?
__________________
DW1 DW2 DW3 DW4 DNU PQ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-26-2008, 8:32 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Nov 2008
Location: Singapore
Posts: 18
Reputation: 18
reubenfoo is on a distinguished programming path ahead
Default

i've attached before

before.png

and after screen shots.

after.png
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-28-2008, 8:44 PM
cjard's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

using a connection string you find at ConnectionStrings.com - Forgot that connection string? You will find it right here! and the "Microsoft Access Database driver" in visual studio (for it is the Jet driver, it's just that jet can access excel too), [or OleDb if youre doing it in code rather than visual designer] are you able to connect to the spreadsheet and read its contents into a datatable?
__________________
DW1 DW2 DW3 DW4 DNU PQ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 6:31 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.