generating Office documents

D

Dave Calkins

I'm trying to figure out the best way to generate MS Office documents
(primarily Excel, but perhaps Word as well). For example, we have an app
which generates a bunch of data and we'd like to give the user the ability to
generate an Excel document which would have the data, charts, images, etc.

Is the best bet using the automation interface? If so, where's the best
place to start for more info on that?

How about directly generating the file? Anyone have experience using
commercial libraries which do this? Any products you could reccommend?

Also, how do templates fit into this? i.e., does it work well to create a
template file in Excel, for example, and then load it, fill in the specifics
and save it out? Or are you better just generating the whole document from
code.

Our code is Win32 native C++, however, we'd be open to using mixed-mode to
call managed APIs if that is necessary.

Thanks! :)
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGF2ZSBDYWxraW5z?=,

In part, the answer to this depends on which versions of Office you're
targeting, and how soon this has to be realized...
I'm trying to figure out the best way to generate MS Office documents
(primarily Excel, but perhaps Word as well). For example, we have an app
which generates a bunch of data and we'd like to give the user the ability to
generate an Excel document which would have the data, charts, images, etc.

Is the best bet using the automation interface? If so, where's the best
place to start for more info on that?

How about directly generating the file? Anyone have experience using
commercial libraries which do this? Any products you could reccommend?

Also, how do templates fit into this? i.e., does it work well to create a
template file in Excel, for example, and then load it, fill in the specifics
and save it out? Or are you better just generating the whole document from
code.

Our code is Win32 native C++, however, we'd be open to using mixed-mode to
call managed APIs if that is necessary.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
D

Dave Calkins

I would guess MS Office 2000 and newer and this has to be realized in the
very near future. So, relying on Office 2007's open format isn't an option
(I'm guessing that might have been what you were hinting at?). Even if
Office 2007 was already out, we couldn't rely on our customers using it for
when we need to have this feature.


Dave
 
C

Cindy M -WordMVP-

Hi Dave,
I would guess MS Office 2000 and newer and this has to be realized in the
very near future. So, relying on Office 2007's open format isn't an option
(I'm guessing that might have been what you were hinting at?). Even if
Office 2007 was already out, we couldn't rely on our customers using it for
when we need to have this feature.
that's where my thoughts were headed, yes :) Microsoft says it's going to release a
converter for earlier versions of Word, so that they can open and write to the new
XML formats. That would have been ideal, but that won't be available before 2007 is
released.

If you want to go the BIFF route, it's possible. I understand it works better for
Excel than for Word :) See this link (the BIFF section) for more info:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/vsoffi
cedev.asp

Other than that, for Word there's the possibility of generating RTF (the RTF spec is
on the msdn site) or Word's round-trip HTML (pretty much undocumented).

I'm not familiar with any third-party products.

Or, you'd need to automate the applications. If you decide to go this route (and it
might be best for creating charts and such), then templates could definitely be a
big help.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :)
 
D

Dave Calkins

Cindy M -WordMVP- said:
If you want to go the BIFF route, it's possible. I understand it works better for
Excel than for Word :) See this link (the BIFF section) for more info:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/vsofficedev.asp

Thanks for the link! I was able to find the referenced out-of-print "Excel
97 Developer's Kit" on Amazon and ordered one of those as well.
Other than that, for Word there's the possibility of generating RTF (the RTF spec is
on the msdn site) or Word's round-trip HTML (pretty much undocumented).

For now, Excel is the big concern, but I'll keep the above in mind for Word.
We've generated RTF in the past so if/when Word becomes a need we should be
able to go that route.
I'm not familiar with any third-party products.

I found one which was written up in the MSDN Magazine Toolbox column (June
'06), called OfficeWriter (www.softartisans.com). Looks very full featured
and it does write the native format. One issue with that product is that the
licensing model is geared toward running it on your web server generating
documents for tons of web clients as opposed to including it in your end-user
application, so making it a reasonable choice would probably require working
out some sort of custom licensing agreement.
Or, you'd need to automate the applications. If you decide to go this route (and it
might be best for creating charts and such), then templates could definitely be a
big help.

The downside there is requiring Office to be installed on the user's
machine. On the machines where the export has to occur, there isn't a need
to have Office installed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top