[Qt-interest] qt and excel

Ross Bencina rossb-lists at audiomulch.com
Mon Jun 7 11:12:09 CEST 2010


Hi Ken

I havn't done this for a long time, actually I talked to Word not Excel. But either way, all MSOffice products have an extensive COM interface which you can access remotely using the usual DCOM infrastructure (or whatever it's called this week). In you C++ IDE you need to generate client stub interfaces from the Excel type library. At the time, I did it with Borland C++ builder but I imagine there is a similar wizard to do it in MSVC. Basically all you do is generate the stubs and then you can call them and manipulate Excel from a separate C++ app using the same API used from VBA and similar... you should be able to find some code examples on line.

One thing: it can be quite slow. so if you can get a result using a CSV file as others have recommended then do that. The advantage of the COM way is that you can do pretty much anything you can do directly in Excel (forumulas, graphs, styling etc etc).

Another option is to generate an ODS (see http://en.wikipedia.org/wiki/OpenDocument) which is "just" a bunch of XML files in a zip file... but I'm not sure if there's a good C++ library for manipulating the document format at a higher level than the usual DOM apis which Qt provides.

Actually, the most recent solution I used was for adding new lines to the bottom of an OpenOffice spreadsheet. I just used Qt to copy CSV data to the clipboard and then required the user to manually paste it into the spreadsheet. Works fine for my app.

HTH

Ross.




  ----- Original Message ----- 
  From: pengliang(彭亮) 
  To: Trolltech list 
  Sent: Monday, June 07, 2010 3:08 PM
  Subject: [Qt-interest] qt and excel


  Hi All

       Did anybody have experience to read/write data from/to Excel (or spreadsheet)?

       Or does anyone have any ideas?

  Thanks

  Ken

   

   



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


  _______________________________________________
  Qt-interest mailing list
  Qt-interest at trolltech.com
  http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100607/2bedfaa8/attachment.html 


More information about the Qt-interest-old mailing list