Chuck_Loftin
asked on
Creating and populating an excel worksheet from VB.Net 2005.
How do I create an Excel workbook and worksheet, set data types for cells and transfer data to the worksheet?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad I could help and thanks for the grade!
ASKER
I've kind of had mixed results with this site, but you really nailed the solution in a way that I didn't have to to any extensive research to apply the results. The only other thing that I can see right now that I might give me a problem later is setting the data type for a range of cells. I don't see a way to do that, however it might not even be a problem. I won't know until I get the specs for the spreadsheet.
If you have any problem when you get the spec just say it!
ASKER
How would I format a cell from VB.Net to display a given number of decimal places?
It depends the method that you have follow, but you can do:
Selection.NumberFormat = "0.00"
If you choose this on (sheet.Cells(i, 1) = f.Name) then you must format after add the value:
sheet.Cells(i, 1).NumberFormat = "0.00"
sheet.Cells(i, 1) = f.Name
Selection.NumberFormat = "0.00"
If you choose this on (sheet.Cells(i, 1) = f.Name) then you must format after add the value:
sheet.Cells(i, 1).NumberFormat = "0.00"
sheet.Cells(i, 1) = f.Name
ASKER
Works great, I'm trying to find a good source of documantation for the Microsoft.Office.Interop.E xcel namespace. Any suggestions on where to find this information?
Try the msdn documentation. You have some examples there
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.excel(VS.80).aspx?wt.slv=RightRail
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.excel(VS.80).aspx?wt.slv=RightRail
ASKER
You've been very helpful. Thank you.
Just glad I could help you. Good luck with your projects.
ASKER