User1490610987 posted
Hello there---
We have recently decided not to install the Excel application on the web server, so I am working with OWC11 to allow for data to be exported to an Excel spreadsheet. I have successfully pulled data from a database and loaded it into a worksheet. The
exported Excel file displays the data on a worksheet called Sheet. I would like to alter the worksheet name so that it says BaseInformation instead of Sheet, then add an additional worksheet, but the code I have used is not making any changes to the exported
file...
1 Dim xlsheet As New SpreadsheetClass
2 xlsheet.ActiveSheet.Name = "BaseInformation"
3
4 For Each dr As DataRow In ds.Tables(0).Rows
5
6 xlsheet.ActiveSheet.Cells(i, 1) = dr.Item("Name").ToString()
7 xlsheet.ActiveSheet.Cells(i, 2) = dr.Item("ProductNumber").ToString()
8
9 i = i + 1
10
11 Next
12
13 Dim ws As Worksheet = xlsheet.ActiveWorkbook.Worksheets.Add(xlsheet.Worksheets(1), , 2)
14 ws.Name = "AddedSheet"
15
16
... this code successfully performs the For Each loop, but the xlsheet.ActiveSheet.Name line of code has no effect at all... any ideas as to why?
Thanks!
---kpobar