Solved

Working with Microsoft.Office.Interop.Excel

Posted on 2012-03-29
3
287 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
Comment Utility
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
 

Author Comment

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

Author Closing Comment

by:Alyanto
Comment Utility
Thank for the lead
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

12 Experts available now in Live!

Get 1:1 Help Now