Tools We Need
- Visual Studio
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight.
Download Spire.XLS Here
How to Copy Excel Cells with Spire.XLS by Using C#
Make sure Spire.XLS and Visual Studio are correctly installed on system. Follow the simple instruction below to copy Excel cells.
Step 1 Create a Project
Create a C# project in Visual Studio and Add Spire.Pdf.dll as reference. The default setting of Spire.Pdf.dll is placed under "C:\Program Files\e-iceblue\Spire.Pdf\Bin”. Select assembly Spire.Pdf.dll and click OK to add it to the project.
static void Main(string args)
Step 2 Load Excel Files
Put the Excel file which has the cells we need copy into the project folder and use the code below to load it into the project.
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets;
Step 3 Copy Excel Cells
Select the cell range which we need copy and use the simple one sentence code below to copy the content and style into another area.
Step 4 Save and Preview
The following code can save the Excel file and preview the effect after launch the program.
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight. It supports C#, VB.NET, ASP.NET, ASP.NET MVC and Silverlight. Click to learn more...