Solved

how to generate excel docs

Posted on 2002-04-04
16
206 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
  • 5
  • 5
  • 2
  • +3
16 Comments
 
LVL 4

Expert Comment

by:AssafLavie
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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
Comment Utility
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
Comment Utility
Hmm, can't test it right now, but IIRC Access allows to save in Excel format...
0
 
LVL 3

Expert Comment

by:jtm111
Comment Utility
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
Comment Utility
Here's the source I use as a reference:
   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q179706
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:chrisshebib
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 200 total points
Comment Utility
0
 

Author Comment

by:chrisshebib
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now