This article guides on how to unmerge cells in Excel using C#. It provides the resources to set the IDE for the development, a list of steps describing the complete process, and a sample code to unmerge cells without losing data using C#. Feel free to utilize this sample code on any operating system you prefer, and there’s no requirement to install any third-party tools.
Steps to Split Merged Cells using C#
- Set the development environment to use Aspose.Cells for .NET to split cells
- Load the source Excel file into the Workbook object for unmerging cells
- Access the target sheet and create a range of merged cells
- Call the Range.UnMerge() method to split the cells
- Save the output file
These steps summarize the process to develop an application demonstrating how to unmerge cells in Excel using C#. Commence the process by loading the source Excel file and creating the range of merged cells. Finally, call the UnMerge() method in the Range class to split the cells.
Code to Unmerge Cells using C#
The above code demonstrates the process to split merged cells in Excel using C#. You can repeat this process for multiple ranges on various sheets. You can similarly reverse the process by calling the Merge() method instead.
This article has taught us the process of breaking the merged cells. To learn the process to un-protect Excel files, refer to the article on How to unprotect Excel in C#.