Results 1 to 3 of 3

Thread: Entire Gridview to excel in Defined cell value

  1. #1

    Thread Starter
    Junior Member feroguz's Avatar
    Join Date
    Aug 2013
    Posts
    22

    Question Entire Gridview to excel in Defined cell value

    Hi, good morning!!

    In this code I have specific values , but I require that fill the excel worksheet start range in " C7 " to " I" cell ..
    it's possible to export all gridview table in a specific cell values?
    Gridview1 values start in C7 to finish value..

    I use devexpress gridcontrol..

    Code:
    Dim CellValue, CellValue2, CellValue3, CellValue4, CellValue5, CellValue6 As String
            CellValue = GridView1.GetFocusedRowCellValue("project")
            CellValue2 = GridView1.GetFocusedRowCellValue("project_type")
            'CellValue3 = GridView1.GetFocusedRowCellValue("date")
            CellValue3 = DateTime.Today
            CellValue4 = GridView1.GetFocusedRowCellValue("user_name")
            CellValue5 = GridView1.GetFocusedRowCellValue("number")
    
            
            TextBox1.Text = CellValue
            TextBox2.Text = CellValue2
            TextBox3.Text = CellValue3
            TextBox4.Text = CellValue4
            TextBox5.Text = CellValue5
    
    'OPEN MY TEMPLATE
            Dim workbook As New Workbook
            workbook.LoadDocument("C:\info.xlsx")
            workbook.Worksheets(0).Cells("G1").Value = CellValue
            workbook.Worksheets(0).Cells("G2").Value = CellValue2
            workbook.Worksheets(0).Cells("G3").Value = CellValue3
            workbook.Worksheets(0).Cells("G4").Value = CellValue4
            workbook.Worksheets(0).Cells("E4").Value = CellValue5
            workbook.Worksheets(0).Cells("C7:C10").Value = CellValue6
    
                workbook.SaveDocument("c:\info2.xlsx")
            MsgBox("file saved to " & "c:\info2.xlsx", MsgBoxStyle.Information, "Template created..")
            Process.Start("EXCEL.EXE", """c:\info2.xlsx""")

    Best Regards!!

  2. #2

    Thread Starter
    Junior Member feroguz's Avatar
    Join Date
    Aug 2013
    Posts
    22

    Re: Entire Gridview to excel in Defined cell value

    An apologize.. attached a screenshot..

    Name:  export_range.jpg
Views: 600
Size:  45.8 KB

    Best Regards!!

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Entire Gridview to excel in Defined cell value

    Have you asked in the devexpress support forums?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width