The code below will help you to implement an C# app to merge cells. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can be used to merge cells using C#.
This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to merge cells. Just copy and paste the code into your C# application’s code and follow the instruction. Code testing will allow the function to be tested and work properly with your data.
Our website provides trial version of ByteScout Spreadsheet SDK for free. It also includes documentation and source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using System.Diagnostics;
using System.IO;
namespace MergeCells
{
class Program
{
static void Main(string[] args)
{
// Create new Spreadsheet
Spreadsheet document = new Spreadsheet();
// Get worksheet by name
Worksheet worksheet = document.Workbook.Worksheets.Add("Sheet1");
// Merge cells
worksheet.Range("B6:D18").Merge();
// Write text
worksheet.Cell("C10").MergedWithCell.Value = "Bytescout.Spreadsheet";
// delete output file if exists already
if (File.Exists("Output.xls")){
File.Delete("Output.xls");
}
// Save document
document.SaveAs("Output.xls");
// Close document
document.Close();
// Open document in default xls viewer
Process.Start("Output.xls");
}
}
}
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: