Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
Multiple Ultragrids export in Same workbook (in version: 6.0.20063.1091)
posted

Dim uWorkBook As WorkBook = Nothing

Dim sTempFileName As String = "krish.xls"

If uWorkBook Is Nothing Then

    If My.Computer.FileSystem.FileExists(sTempFileName) Then

        My.Computer.FileSystem.DeleteFile(sTempFileName)

    End If

    uWorkBook = mExcelExp.Export(mUltraGrid_ONE, sTempFileName)

    'THIS WILL EXPORT FIRST GRID TO WORKBOOK OBJECT, IN SHEET1

Else

    uWorkBook.Worksheets.Add("Sheet" & uWorkBook.Worksheets.Count + 1)

    uWorkBook = mExcelExp.Export(mUltraGrid_TWO, uWorkBook.Worksheets(uWorkBook.Worksheets.Count - 1))

    'I WANT SECOND GRID TO BE EXPORTED IN SECOND SHEET2, IN SAME WORKBOOK. And it does too. BUT when Process.Start command runs and opens the tile, it opens the excel file with only one sheet into it, i.e. with the first grid. When you see uWorkBook object in Watch window, you can see two sheets in there.

End If

System.Diagnostics.Process.Start(sTempFileName)

May be I am doine something wrong? !! ?? My company is using this version: 6.0.20063.1091. I don't have any Load or Save method in uWorkBook object. (This is in .Net 2.0 Framework)

Parents
  • 469350
    Verified Answer
    Offline posted

    I think you need to do something like this:

            Dim wb As New Workbook

            Dim ws1 As Worksheet = wb.Worksheets.Add("Worksheet 1")
            Me.UltraGridExcelExporter1.Export(Me.UltraGrid1, ws1)

            Dim ws2 As Worksheet = wb.Worksheets.Add("Worksheet 2")
            Me.UltraGridExcelExporter1.Export(Me.UltraGrid2, ws2)

            BIFF8Writer.WriteWorkbookToFile(wb, fileName)

Reply Children
No Data