using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NOPI
{
class Program
{
static void Main(string[] args)
{
//Create workbook
IWorkbook workbook = new XSSFWorkbook();
ISheet sheet = workbook.CreateSheet("MySheet");
//Set the value of the cell
sheet.CreateRow(0).CreateCell(0).SetCellValue("Spire.XLS");
//Merge the cell
CellRangeAddress region = new CellRangeAddress(0, 5, 0, 5);
sheet.AddMergedRegion(region);
//Save the file
FileStream file = File.Create("ExcelMerge.xlsx");
workbook.Write(file);
file.Close();
//Launch the file
System.Diagnostics.Process.Start("ExcelMerge.xlsx");
}
}
}