• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

Working with Microsoft.Office.Interop.Excel

I am trying to write using interop an excel book with multiple sheets.  I find that I am unable to get a good code sample to work with.  What I am looking for in the simplest level is a guide that shows how to add multiple worksheets to a workbook or even better still a very small code sample.  The is quite a bit more to the project but this appears to me the only stumbling block to completing the project.
0
Alyanto
Asked:
Alyanto
  • 2
1 Solution
 
CodeCruiserCommented:
Check following samples

http://www.dotnetperls.com/excel-vbnet

http://support.microsoft.com/kb/301982


To add a sheet, you can call the workbook.Sheets.Add method.
0
 
AlyantoAuthor Commented:
I am still looking for a little more on this perhaps a bit of psudo code will relate what i am trying to achive and perhaps I can sign off on the points.

Press button for the spreadsheet to be made
Call class xlFactory withcontructor receiving dataset and some structures to define the layout of the spreadsheet  

xlFactory make(dataset, formatInfo)
  in memory Excel application using Interop
  xlFactory make xlWorkbook(dataset, Formatinfo)
    For each table in the dataset
      make a sheet(enum FormatInfo = tablename)
    next
Save the file
do stuff with file i.e. email, open app on decktop etc

Where I keep failing to understand is the creation of the various elements.  I am sure it is really very straight forward but both of the example are fine but the seem to skip over the creation of the book, sheet etc from interop
0
 
AlyantoAuthor Commented:
Thank for the lead
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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