?
Solved

how to generate excel docs

Posted on 2002-04-04
16
Medium Priority
?
212 Views
Last Modified: 2010-04-02
Does anyone know of components available to generate excel documents?  Even a good lead on how to do this using office web components would work well for me.

There are some out there, but are there good multithraded ones?

Its a little off topic but I'm willing to pay the points for a good lead :)

Thanks,
Chris
0
Comment
Question by:chrisshebib
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +3
16 Comments
 
LVL 4

Expert Comment

by:AssafLavie
ID: 6920068
The excell documents Are COM components.
For instance, you can instantiate Excel.Sheet or Excel.Application and use them to manipulate the data inside the sheet and save it somewhere. Anything you can do manually in excel you can do using it's object model.
Open VB and Add a Reference to the Excell library. Then swtich to the object browser and check out the structure of this API. It's very easy to use.
You can also see the full documentation about it in the MSDN site.
0
 

Author Comment

by:chrisshebib
ID: 6920075
My apologies, I should have expanded...

I'm looking for something that is thread safe.  If you use office, my understanding is that multiple document creation would be serialized due to the excel object being single threaded.  Its possible that I'm wrong on this but I don't think so.  

Also, I would prefer not to install office on the server in order to do this.

Again, I should have said.  Thanks for your response all the same though.

Chris
0
 
LVL 4

Expert Comment

by:AssafLavie
ID: 6920087
The fact that the access is serialized is what makes it thread safe.
If you want to use multiple threads you can create an object per thread.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:jkr
ID: 6921567
BTW, DAO should be able to generate Excel sheets also - all you have to do is using a DB connect string like

"Excel 8.0; DATABASE=c:\\mypath\\myfile.xls"
0
 

Author Comment

by:chrisshebib
ID: 6921895
Really, that is pretty interesting.  Do you know where I could get more information on how this works?  I really know nothing about DAO.

I'm going to be getting my data back from an sql 2000 server, can I turn that into excel sheets?

Chris
0
 
LVL 86

Expert Comment

by:jkr
ID: 6921970
Hmm, can't test it right now, but IIRC Access allows to save in Excel format...
0
 
LVL 3

Expert Comment

by:jtm111
ID: 6922083
Dude, here is a link to a tutorial on accessing Excel via C++. It should point you in the right direction.

http://www.codeproject.com/com/xoffice.asp
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6922291
Here's the source I use as a reference:
   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q179706
0
 

Author Comment

by:chrisshebib
ID: 6922300
Thank you.

This is using the Office suite to generate the documents though, I'm not able to use office at this point on a production server.  I'm considering writting a component to generate the BIF format from scratch but the effort would be significant.

Anyone know of any third party COM components out there that would do this already?
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6922302
Your best bet, then, is to create a comma separated value(CSV) file.  You can still load it with Excel and keep formulas in it.

It really depends on what you want to do with the data after you create it.

If you want fancy stuff, you'll need the Office stuff as I posted before.  If you just want the file to load in Excel, then many formats will work (CSV, TXT, etc.)
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6922309
Example...
This output (stored in a .CSV file)will load properly in Excel.
The developer must keep track of what's in each virtual cell:

"First","Second","Third","FORMULA"
1,2,3,"=a2+b3+c2"
4,5,6,"=a2+b2+c3"
0
 

Author Comment

by:chrisshebib
ID: 6922310
Well, what my end goal is, is to create many excel docs per day.  The docs will have images in them, and some basic formatting.  I don't want to use office on a production server.  It sounds like I'm left finding a third part component that will generate excel docs by writing out the BIF format, or creating my own component to do it.

I would have thought that office web components would have done this for sure, but it doens't unfortunately.
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6922314
I understand.
You don't have to load office on the production server.
All you need is the OLB/TLB file from MS Office to incorporate into your product.

If that's still too heavy, why not create HTML?
You can have that load pictures from remote locations and it's easily maintained.  You can have formatting and colors and pictures and active content and a lot of other stuff without having to have ANY third party products or even Office.
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6922697
Also (I forgot this part),
if you know about mime types, you can output the HTML to look like Excel.  The users would load the reports (I'm assuming reports) with the browser and the contents would look like a spreadsheet.  You can still have formatting and formulas (if necessary).
This would not require anything special of the server, but the users would need to have the necessary mime type registered on their machines.  Since your original target was Excel, I'm sure all of your potential users have Excel loaded -- therefore, no problem.
0
 
LVL 25

Accepted Solution

by:
clockwatcher earned 600 total points
ID: 6923027
0
 

Author Comment

by:chrisshebib
ID: 6926299
Thanks Triskelion, I appreciate your ideas.

I would very much prefer that we use HTML to do this, but the customer may not go for it.  Until then, investigation into excel generation continues....

Thanks again,
Chris
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question