Results 1 to 17 of 17

Thread: Export to Spreadsheet, w/o Excel

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    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?

  2. #2
    Lively Member
    Join Date
    Jul 2008
    Posts
    89

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Export to Spreadsheet, w/o Excel

    Quote 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.

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Export to Spreadsheet, w/o Excel

    Quote 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?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Export to Spreadsheet, w/o Excel

    Quote 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!

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    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!
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Export to Spreadsheet, w/o Excel

    Quote 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.

  8. #8
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Export to Spreadsheet, w/o Excel

    lol yeah I would say stick to CSV
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Export to Spreadsheet, w/o Excel

    Quote 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.

  10. #10
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    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:
    1. Dim AllLines() As String = IO.File.ReadAllLines("C:\test.csv")
    2. MessageBox.Show(AllLines.Count)

    To use the text file parser you would declare it like this:
    vb Code:
    1. 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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  11. #11
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    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.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  13. #13
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Export to Spreadsheet, w/o Excel

    Quote 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) ?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Export to Spreadsheet, w/o Excel

    Quote 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.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  16. #16
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width