We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copy or move a worksheet from one workbook to another

Thread ID:

Created:

Updated:

Platform:

Replies:

17085 Jul 30,2004 02:30 PM UTC Jul 20,2005 06:11 AM UTC WinForms 3
loading
Tags: XlsIO
Mark di Giovanni
Asked On July 30, 2004 02:30 PM UTC

I''ve been trying to copy a worksheet to another workbook and I can''t seem to find an easy way to do this. I''m going to try to copy by a range. If that works, I will do it, but one would think there is a way to call a method like CopyTo(WorkSheetCollection) or something of that nature. Thanks --Mark

Administrator [Syncfusion]
Replied On August 2, 2004 02:52 AM UTC

Hi Mark, Sorry for the delay in responding. Currently there is no way to copy a worksheet to another workbook. I have contacted the development team regarding this issue and will update you will more information as soon as I hear from them. Thank you for your patience. Best regards, Stephen. >I''ve been trying to copy a worksheet to another workbook and I can''t seem to find an easy way to do this. > >I''m going to try to copy by a range. If that works, I will do it, but one would think there is a way to call a method like CopyTo(WorkSheetCollection) or something of that nature. > >Thanks >--Mark

nirav desai
Replied On July 19, 2005 05:42 AM UTC

Hi Stephen, I''ve been trying to copy data of one worksheet to another worksheet in other workbook using Syncfusion tool version 3.2. I am using Range method of worksheet to copy and paste the data from source sheet to destination sheet.Below is the code: ExcelEngine vacEngine=new ExcelEngine(); IApplication vacApplication=vacEngine.Excel; vacApplication.Workbooks.Open("C:\\ExcelData\\VAC document.xls"); IWorkbooks m_objBooksVAC=vacApplication.Workbooks; IWorkbook m_objBookVAC = m_objBooksVAC[0]; // Create a sheets objects.` IWorksheets m_objSheetsVAC=m_objBookVAC.Worksheets; //Source sheet from where data is required to copy. IWorksheet m_objSheet_VACSource = m_objSheetsVAC[o.DR_ExcelTableName.ToString()]; //Destination sheet IWorksheet m_objSheet_VACDestination=m_Workbook.Worksheets["VAC & Total Return"]; sRange=o.DR_Range; iColSt=1; iColEnd=9; sRowSt =1; sRowEnd =100; m_objSheet_VACDestination.Range[sRowSt,iColSt,sRowEnd,iColEnd].Value2 = m_objSheet_VACSource.Range[sRowSt,iColSt,sRowEnd,iColEnd].Text; When I execute the above code it does not throw any error but data is not pasted to the destination sheet. Please let me know the solution for the same.

Administrator [Syncfusion]
Replied On July 20, 2005 06:11 AM UTC

Hi Nirav, I will look into the issue with copying ranges across workbooks and update you shortly. However, here is a sample to copy a whole worksheet across workbooks. Sample Thanks, Stephen. >Hi Stephen, > >I''ve been trying to copy data of one worksheet to another worksheet in other workbook using Syncfusion tool version 3.2. > I am using Range method of worksheet to copy and paste the data from source sheet to destination sheet.Below is the code: > >ExcelEngine vacEngine=new ExcelEngine(); >IApplication vacApplication=vacEngine.Excel; >vacApplication.Workbooks.Open("C:\\ExcelData\\VAC document.xls"); >IWorkbooks m_objBooksVAC=vacApplication.Workbooks; >IWorkbook m_objBookVAC = m_objBooksVAC[0]; > >// Create a sheets objects.` >IWorksheets m_objSheetsVAC=m_objBookVAC.Worksheets; >//Source sheet from where data is required to copy. >IWorksheet m_objSheet_VACSource = m_objSheetsVAC[o.DR_ExcelTableName.ToString()]; > >//Destination sheet >IWorksheet m_objSheet_VACDestination=m_Workbook.Worksheets["VAC & Total Return"]; >sRange=o.DR_Range; >iColSt=1; >iColEnd=9; >sRowSt =1; >sRowEnd =100; >m_objSheet_VACDestination.Range[sRowSt,iColSt,sRowEnd,iColEnd].Value2 = m_objSheet_VACSource.Range[sRowSt,iColSt,sRowEnd,iColEnd].Text; > >When I execute the above code it does not throw any error but data is not pasted to the destination sheet. > >Please let me know the solution for the same.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;