Solved

Working with Microsoft.Office.Interop.Excel

Posted on 2012-03-29
3
288 Views
Last Modified: 2012-04-03
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
Comment
Question by:Alyanto
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37782836
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
 
LVL 1

Author Comment

by:Alyanto
ID: 37786515
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
 
LVL 1

Author Closing Comment

by:Alyanto
ID: 37802682
Thank for the lead
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

15 Experts available now in Live!

Get 1:1 Help Now