[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

how to generate excel docs

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
chrisshebib
Asked:
chrisshebib
  • 5
  • 5
  • 2
  • +3
1 Solution
 
AssafLavieCommented:
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
 
chrisshebibAuthor Commented:
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
 
AssafLavieCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jkrCommented:
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
 
chrisshebibAuthor Commented:
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
 
jkrCommented:
Hmm, can't test it right now, but IIRC Access allows to save in Excel format...
0
 
jtm111Commented:
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
 
TriskelionCommented:
Here's the source I use as a reference:
   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q179706
0
 
chrisshebibAuthor Commented:
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
 
TriskelionCommented:
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
 
TriskelionCommented:
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
 
chrisshebibAuthor Commented:
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
 
TriskelionCommented:
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
 
TriskelionCommented:
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
 
clockwatcherCommented:
0
 
chrisshebibAuthor Commented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 5
  • 5
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now