ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-11-20 04:20:57

GeorgeDeb4
Member
Registered: 2016-11-20
Posts: 2

Merge two XLSX files

Hello Forum,
           I'd like to open two Excel Workbooks and merge them into one ReoGrid control workbook. Is this the right direction below? I don't know the correct syntax to copy one sheet from one book to another book.
           
            ' Open first Excel  file into form control (VB.Net)
           WorkBook1 = Me.WorkBookControl
          WorkBook1.Load("C:/file1.xlsx", IO.FileFormat.Excel2007)
        dim   WorkSheets1Col as unvell.ReoGrid.WorksheetCollection
          WorkSheets1Col =  WorkBook1.Worksheets

           'Open Second Excel workbook into Memory workbook.
         Dim WorkBook2 = ReoGridControl.CreateMemoryWorkbook()
         WorkBook2.Load("C:/file2.xlsx", IO.FileFormat.Excel2007)
      dim   WorkSheets2Col as unvell.ReoGrid.WorksheetCollection
        WorkSheets2Col =   WorkBook2.Worksheets
       
 

       ' ""  copy each sheet from WorkBook2  "After"  existing sheets in WorkBook1 ""

           WorkSheets2col.CopyTo(WorkSheets1col, 0)             '  doesn't work.
   
         
     What is the actual  code for the copy step? 

Thank you.

George

Offline

#2 2016-12-16 09:09:59

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Merge two XLSX files

I think you can't merge two workbooks by using CopyTo or CopyWorksheet method. You can try to use worksheet.Clone method to get an instance of worksheet, and add into another workbook.

Sorry for late reply.

Last edited by Jingwood (2016-12-16 09:10:26)

Offline

Board footer

Powered by FluxBB