Using OWC11 to export to Excel RRS feed

  • Question

  • 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"
    4    For Each dr As DataRow In ds.Tables(0).Rows
    6        xlsheet.ActiveSheet.Cells(i, 1) = dr.Item("Name").ToString()
    7        xlsheet.ActiveSheet.Cells(i, 2) = dr.Item("ProductNumber").ToString()
    9        i = i + 1
    11   Next
    13   Dim ws As Worksheet = xlsheet.ActiveWorkbook.Worksheets.Add(xlsheet.Worksheets(1), , 2)
    14   ws.Name = "AddedSheet"

    ... 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?



    Monday, June 8, 2009 11:30 AM

All replies

  • User1490610987 posted

    Since posting this questions, I have been told by my supervisor that we will not be moving forward with OWC since it is no longer supported by Microsoft, so please disregard the posting.



    Monday, June 8, 2009 2:27 PM