Copy, modify and save a spreadsheet a from web application

  • Thread starter Copy, modify and save a spreadsheet
  • Start date
C

Copy, modify and save a spreadsheet

I have a template for an invoice. It just has placeholders for all of the
information I need to save to it.

I'm working in an asp.net environment (using VB) where I need to
programmatically generate invoices.

I need to copy the template spreadsheet and then modify the copy.

What's the code that I'll need to do this?

Also, given that the web app is multi-threaded, what do I need to keep in
mind to be sure that multiple invoices can be created simultaneously? Do I
have to worry about multiple instances of excel opening up?

I'm really a total noob with office programming. So forgive my dumb
questions. Your help will be GREATLY appreciated.
 
J

Jim Rech

I wouldn't "copy the template". Just open it read only, modify it and use
SaveAs. You should be able to find lots of examples of automating Excel on
the web if you search for them. I think your best bet is to write the code
in Excel and when you get that working make the modifications needed to run
externally, which is mostly to add the Excel object to the beginning of some
lines. And avoid any named constants which are undefined outside of Excel.
Just use the underlying constant like -4143 instead of xlWorkbookNormal.

I suppose having 100 instances of Excel open at a time might retard
performance I'm not sure what you can do about it. Just make sure your app
closes any instances it creates.

--
Jim
"Copy, modify and save a spreadsheet" <Copy, modify and save a
[email protected]> wrote in message
|I have a template for an invoice. It just has placeholders for all of the
| information I need to save to it.
|
| I'm working in an asp.net environment (using VB) where I need to
| programmatically generate invoices.
|
| I need to copy the template spreadsheet and then modify the copy.
|
| What's the code that I'll need to do this?
|
| Also, given that the web app is multi-threaded, what do I need to keep in
| mind to be sure that multiple invoices can be created simultaneously? Do I
| have to worry about multiple instances of excel opening up?
|
| I'm really a total noob with office programming. So forgive my dumb
| questions. Your help will be GREATLY appreciated.
 
T

Tim Williams

If the template is relatively simple then in the past I've saved it as XML
then just replaced placeholder tokens with data and sent it out as XML
(text) with an Excel header. Does not involve using Excel on the server.

Tim
 
Top