locked
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"
    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

    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.

     

    ---kpobar

    Monday, June 8, 2009 2:27 PM