Free Support Forum - aspose.com

Worksheet Copy copying merged cells unmerged

I attached the project so you can check it out. I tried Worksheet copy method and it copied the merged cells unmerged. I also tried copying the full range, but this one has not carried over the columns widths and still cells unmerged. Is there any workaround? Am I doing something wrong? I did some research and saw the Combine on Workbook, but it doesn’t fit my scenario. I need to copy the content over (can’t have files combined).

AsposeTest7.zip (17.8 KB)

@brunojuliao,

Thanks for your query.

Please try to load the source file by setting MergedArea flag in the LoadDataFilterOptions and share the feedback.

var sourceWb = new Workbook(filename, new LoadOptions() { LoadFilter = new LoadFilter(LoadDataFilterOptions.CellData | LoadDataFilterOptions.DefinedNames | LoadDataFilterOptions.MergedArea), CheckExcelRestriction = true });

1 Like

OMG… I’m sorry. I missed that. Adding MergedArea fixed my issue. Thanks.

@brunojuliao,

Good to know that your issue is sorted out by the suggested line of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

1 Like