locked
does Office automation works without installing office RRS feed

  • Question

  • Hi all. I want to use Office Automation to create Excel files.

    I'm worry if Office or excel were'nt installed in client computer, it works, or not? how about web server?

    tanks in advance

    Sunday, January 9, 2011 9:44 PM

Answers

  • It will not work if there is not office installed....

    You're alternatives are to:

    1) use the oledb jet drivers to create an excel file.  This works, but is very limited in functionality

    2) find a 3rd party dll that can generate an excel spreadsheet.

    3) if you are working with versions of excel from 2007 on, you can use the OpenXML sdk to generate your spreadsheets - though, it is really slow when you have more then about a 1000 rows and the api really sucks.

    4) You can just create your own api - which is what I did.  I simply used ISharpZipLib to handle the zip part of the process and spent sometime with the xml standard.  It's not all that hard once you understand all of the internal relationships :)  For, a xlsx is simply a zipfile (change the extension to .zip and you will be able to open it in explorer and look at the structure) with specific directories and files that describe the various relationships.  If you working with excel 2007, dates are the biggest problem...  It takes a little thrashing around to discover if a field is a date.

    5) You could write them out as 2003 SpreadsheetML - much simpler structure then the newer formats, and it's readable by 2003 and up.  Though, the file sizes can get really big if your dealing with lots of data...  For instance, I dumped a db table in this format and it was something like 8MB.  Where as the xlsx was only like 600K - as a csv it was like 800K - this is because 1) xlsx uses an internal referencing system so that duplicate string values are only repeated once in the document, and 2) it is compressed using the zip format.

    So, there you go.  All kinds of ways to skin this cat :)


    Tom Shelton
    • Marked as answer by Zarei Ramin Tuesday, January 11, 2011 10:08 PM
    Monday, January 10, 2011 12:30 AM

All replies

  • It will not work if there is not office installed....

    You're alternatives are to:

    1) use the oledb jet drivers to create an excel file.  This works, but is very limited in functionality

    2) find a 3rd party dll that can generate an excel spreadsheet.

    3) if you are working with versions of excel from 2007 on, you can use the OpenXML sdk to generate your spreadsheets - though, it is really slow when you have more then about a 1000 rows and the api really sucks.

    4) You can just create your own api - which is what I did.  I simply used ISharpZipLib to handle the zip part of the process and spent sometime with the xml standard.  It's not all that hard once you understand all of the internal relationships :)  For, a xlsx is simply a zipfile (change the extension to .zip and you will be able to open it in explorer and look at the structure) with specific directories and files that describe the various relationships.  If you working with excel 2007, dates are the biggest problem...  It takes a little thrashing around to discover if a field is a date.

    5) You could write them out as 2003 SpreadsheetML - much simpler structure then the newer formats, and it's readable by 2003 and up.  Though, the file sizes can get really big if your dealing with lots of data...  For instance, I dumped a db table in this format and it was something like 8MB.  Where as the xlsx was only like 600K - as a csv it was like 800K - this is because 1) xlsx uses an internal referencing system so that duplicate string values are only repeated once in the document, and 2) it is compressed using the zip format.

    So, there you go.  All kinds of ways to skin this cat :)


    Tom Shelton
    • Marked as answer by Zarei Ramin Tuesday, January 11, 2011 10:08 PM
    Monday, January 10, 2011 12:30 AM
  • Hi Mr. Tom Shelton. Can i use oledb jet drivers to create charts?

     

    Tuesday, January 11, 2011 11:00 AM
  • I'm really not sure.  I had a lot of problems getting some basic stuff to actually work, so I actually just wrote my own api for generating xlsx files.  And, I haven't done any work with charts there...  Haven't had a cause yet.
    Tom Shelton
    Tuesday, January 11, 2011 4:14 PM
  • tank u so much.
    Tuesday, January 11, 2011 10:08 PM