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.
Unfortunately, activation email could not send to your email. Please try again.

Problems with sheet copy

Thread ID:

Created:

Updated:

Platform:

Replies:

32460 Aug 1,2005 10:41 AM Aug 3,2005 08:03 AM Windows Forms 3
loading
Tags: XlsIO
Administrator [Syncfusion]
Asked On August 1, 2005 10:41 AM

Hi! I have some problrm with copying sheet from one workbook to another. Here is simple code that demonstrate the problem static void Main(string[] args) { IWorkbook wbMain = ExcelUtils.Open("templ.xls"); IWorksheet shTempl = wbMain.Worksheets["Template"]; IWorkbook wb = ExcelUtils.CreateWorkbook(1); IWorksheet sh1 = wb.Worksheets.AddCopy(shTempl); // Ok sh1.Name = "Sh1"; wb.Worksheets.AddCopy(shTempl); // Exception Can you help me? Thanks a lot for help

Administrator [Syncfusion]
Replied On August 2, 2005 02:16 AM

Hi , I put together a sample based on your requirements. Please take a look at this sample from Knowledge base and let me know if you have any questions. How do i copy worksheet from one workbook to another Workbook? Best Regards, Seetha >Hi! I have some problrm with copying sheet from one workbook to another. Here is simple code that demonstrate the problem > >static void Main(string[] args) >{ > IWorkbook wbMain = ExcelUtils.Open("templ.xls"); > IWorksheet shTempl = wbMain.Worksheets["Template"]; > > IWorkbook wb = ExcelUtils.CreateWorkbook(1); > IWorksheet sh1 = wb.Worksheets.AddCopy(shTempl); // Ok > sh1.Name = "Sh1"; > wb.Worksheets.AddCopy(shTempl); // Exception > >Can you help me? Thanks a lot for help

Administrator [Syncfusion]
Replied On August 2, 2005 02:59 AM

>Hi , > >I put together a sample based on your requirements. Please take a look at this sample from Knowledge base and let me know if you have any questions. > >How do i copy worksheet from one workbook to another Workbook? > >Best Regards, >Seetha > > Thanks a lot for answer. I readed this help topic. Problem is still staying. I think this is bug. Here is code fragment that demonstrate the problem: [STAThread] static void Main(string[] args) { ExcelUtils.ThrowNotSavedOnDestroy = false; IWorkbook wbSrc = ExcelUtils.Open("Src.xls"); IWorkbook wbDest = ExcelUtils.CreateWorkbook(1); wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Ok wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Ok wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Exception An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.excelrw.base.dll Additional information: Object reference not set to an instance of an object wbDest.SaveAs("Dest.xls"); }

Administrator [Syncfusion]
Replied On August 3, 2005 08:03 AM

Hi, I was able to see the issue and have filed a bug report with the development team. Defect #552 - AddCopy does not work properly when copying multiple times Best Regards, Seetha > > >>Hi , >> >>I put together a sample based on your requirements. Please take a look at this sample from Knowledge base and let me know if you have any questions. >> >>How do i copy worksheet from one workbook to another Workbook? >> >>Best Regards, >>Seetha >> >> >Thanks a lot for answer. I readed this help topic. Problem is still staying. I think this is bug. Here is code fragment that demonstrate the problem: > >[STAThread] >static void Main(string[] args) >{ >ExcelUtils.ThrowNotSavedOnDestroy = false; >IWorkbook wbSrc = ExcelUtils.Open("Src.xls"); >IWorkbook wbDest = ExcelUtils.CreateWorkbook(1); >wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Ok >wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Ok >wbDest.Worksheets.AddCopy(wbSrc.Worksheets[0]); // Exception An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.excelrw.base.dll Additional information: Object reference not set to an instance of an object >wbDest.SaveAs("Dest.xls"); >}

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.

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.

;