|
-
Aug 7th, 2008, 01:47 PM
#1
Thread Starter
Addicted Member
Export to Spreadsheet, w/o Excel
I see a few tutorials pertaining to exporting data into an Excel spreadsheet. Looks straightforward, however I do not own Excel. I use Open Office (hey, it's free). I'm able to open Excel spreadsheet within Open Office Calc. However when I write my code, and I goto reference Excel, it's not there. Well I can figure this due to the fact I dont own Excel. Now Open Office doesnt show either.
So I was wondering if there is a way I can create an Excel file, without having Excel installed? Maybe download a component that allows me to, or maybe another work around?
-
Aug 7th, 2008, 01:58 PM
#2
Lively Member
Re: Export to Spreadsheet, w/o Excel
You're right, you don't see the driver because you don't own the software. You could just write to a delimited text file, which imports into any excel-like system.
-
Aug 7th, 2008, 02:02 PM
#3
Thread Starter
Addicted Member
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by asnider
You're right, you don't see the driver because you don't own the software. You could just write to a delimited text file, which imports into any excel-like system.
Yeah, thats what I was thinking. But you loose the "Coolness Factor" b/c you really cant open it from explorer like that. You'll have to import it. Oh well.
I'll continue on the delimited style, however, going straight to spreadsheet would be nice.
-
Aug 7th, 2008, 02:05 PM
#4
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by MotoMan_Yz400
Yeah, thats what I was thinking. But you loose the "Coolness Factor" b/c you really cant open it from explorer like that. You'll have to import it. Oh well.
I'll continue on the delimited style, however, going straight to spreadsheet would be nice.
Do you mean you want the CSV file to just open in Excel when you open it through explorer? because thats standard behavior for any machine with Excel on it... the CSV extension is associated with Excel when it gets installed.
Or did you just mean that for you (without excel obviously) when you open it you would like it to be in a more readable format?
-
Aug 7th, 2008, 02:12 PM
#5
Thread Starter
Addicted Member
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by chris128
Do you mean you want the CSV file to just open in Excel when you open it through explorer? because thats standard behavior for any machine with Excel on it... the CSV extension is associated with Excel when it gets installed.
Or did you just mean that for you (without excel obviously) when you open it you would like it to be in a more readable format?
Well the reason I wanted it in an Ecxel file is the standard of it all. That way I can open, print, modify, etc. in a standard way with many programs (In my case Open Office). With delimited format, it get uber clumsy to try to read the file, I would have to manually import it into OOffice every time I want to change something. I guess what I'll end up doing is assigning my delimited file an extension, and assigning that extension to Open Office. It's clumsy, however it'll work.
But I would still love to hear if someone has a work around for this!
-
Aug 7th, 2008, 02:16 PM
#6
Re: Export to Spreadsheet, w/o Excel
I'm pretty sure that without Excel your not going to do what you want I'm afraid. Although I guess you can never say never with programming!
-
Aug 7th, 2008, 02:21 PM
#7
Thread Starter
Addicted Member
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by chris128
I'm pretty sure that without Excel your not going to do what you want I'm afraid. Although I guess you can never say never with programming!
Well my other alternative was to find a standard file format (other than delimited) that was in ASCII. And "build" a spreadsheet file that way. But I'm almost better off just sticking to delimited.
-
Aug 7th, 2008, 02:26 PM
#8
Re: Export to Spreadsheet, w/o Excel
lol yeah I would say stick to CSV
-
Aug 7th, 2008, 02:47 PM
#9
Thread Starter
Addicted Member
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by chris128
lol yeah I would say stick to CSV
Yeah thats what I was thinking. Now I'm having trouble with setting it up correctly.
I have a indexing line in my file (first line). listing line data width (number of entries in all the lines), and a file length (how many entries). So it would look like this:
3,2
Data,Data,Data
Data,Data,Data
EOF
I know there has to be a better way. I know I can get rid of the line data width, that should be easy. How do I find the file length (# of lines)?
And I used to know, however I forgot how to `parse?' the file. I'm importing the entire file into an array, however I need to break each line up first.
Better way?
I'll need to add entries sorted by the first data in the line. Any suggestions on the best way to go about doing this? Importing the whole file into an array, edit, then pushing it back out just seems clumsy.
-
Aug 7th, 2008, 03:29 PM
#10
Re: Export to Spreadsheet, w/o Excel
So if I understand correctly - you need to find out how many lines are in the file and also need to know how to split the lines up using the comma as a seperator yeah?
This would display how many lines are in the file in a messagebox:
vb Code:
Dim AllLines() As String = IO.File.ReadAllLines("C:\test.csv")
MessageBox.Show(AllLines.Count)
To use the text file parser you would declare it like this:
vb Code:
Dim AllValues As New FileIO.TextFieldParser("C:\test.csv")
and then you would have to play around with the properties to set the delimiter and field width etc, I've never tried using it so cant tell you off the top of my head I'm afraid.
Should help you a bit though
-
Aug 7th, 2008, 03:36 PM
#11
Re: Export to Spreadsheet, w/o Excel
Another option is to write it to an OpenOffice standard, such as .XLSX. This will work with Office 2007 and earlier versions of Office that have the 2007 compatibility pack installed, as well as OpenOffice.
The standard is XML based and is an open standard. Shouldn't be too hard to write an export routine to it.
-
Aug 7th, 2008, 04:32 PM
#12
Re: Export to Spreadsheet, w/o Excel
xlsx is the Excel 2007 file extension which uses a xml based file format that is compressed.
You can write a Excel file (xls) without Excel but you need to study Microsoft's Binary Interchange File Format (BIFF).
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 7th, 2008, 04:34 PM
#13
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by Jenner
Another option is to write it to an OpenOffice standard, such as .XLSX. This will work with Office 2007 and earlier versions of Office that have the 2007 compatibility pack installed, as well as OpenOffice.
The standard is XML based and is an open standard. Shouldn't be too hard to write an export routine to it.
I thought openoffice couldnt open files saved from Excel in the 2007 format (XLSX) ?
-
Aug 7th, 2008, 04:38 PM
#14
Re: Export to Spreadsheet, w/o Excel
 Originally Posted by MotoMan_Yz400
Well my other alternative was to find a standard file format (other than delimited) that was in ASCII. And "build" a spreadsheet file that way. But I'm almost better off just sticking to delimited.
XML, pure and simple. Your own format.
-
Aug 7th, 2008, 04:52 PM
#15
Re: Export to Spreadsheet, w/o Excel
xlsx files are opensource and there are utilities to read/write to them without Excel from third party companies as well as Microsoft. But remember that its Excel 2007 file format so it cant be opened by Excel 2003 or earlier versions.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 7th, 2008, 05:04 PM
#16
Re: Export to Spreadsheet, w/o Excel
well ya learn something new every day... I thought XLSX was another Microsoft only format like XLS etc. Obviously I was wrong
-
Aug 7th, 2008, 05:06 PM
#17
Re: Export to Spreadsheet, w/o Excel
Yea, back in late 2006 MS announced they were making the file format "open source". If you are interested you can search the MS site for all the details and about the new format.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|