We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge and copy data in one worksheet from multiple worksheets in .NET

Whenever I try to merge sheets, smart markers are not getting copied to right location in merged sheets (final one). Instead smart markers are being copied to old location (cells) when it was a separate sheet.

Kindly check once.

Sample Code:
foreach (var workBook in workbooks)
{
foreach (var workSheet in workBook.Worksheets?.Where(w => w.VisibilityType == VisibilityType.Visible))
{
Range sourceRange = workSheet.Cells.MaxDisplayRange;
Range destinationRange = _workBook.Worksheets[sheetName].Cells.CreateRange(sourceRange.FirstRow + totalRowCount, sourceRange.FirstColumn, sourceRange.RowCount, sourceRange.ColumnCount);

                destinationRange.Copy(sourceRange, new PasteOptions 
                {
                    PasteType = PasteType.Default         
                });
                destinationRange.CopyStyle(sourceRange);

                totalRowCount = sourceRange.RowCount + totalRowCount + 1;                    
            }
        }

To give more clarity:

Sheet 1 has 10 rows and 10 columns.
Sheet 2 has 5 rows and 5 columns,

If sheet2 has a smart marker on 5th row and 5th column, when sheet 1 & 2 gets merged - smart marker position in final sheet should be 15th row and 15th column. However position is still copying as 5th row and 5th column in new final sheet.

@PramodHegde,
Could you please share your sample Excel file(s) along with the runnable console application that can be compiled and executed here without any missing reference to reproduce this issue here? We will observe the issue and share our feedback at the earliest.

Would it be possible to call me at 91 - 888 699 1818 to discuss on this issue?

@PramodHegde,

I am afraid, we do not provide technical support via phone. The best way to get assistance on your issue is via forums. It seems your issue is due to your own code (you wrote to accomplish your task), so you should debug it line by line to try to fix it. Moreover, please create a standalone console application, zip the VS.NET project to post us with all the resource files (input Excel file, output Excel file, etc.) to reproduce the issue on our end. We will check your issue soon.