How can I merge two columns {for eg : column Q and column R} in a worksheet using closedxml and c#.
Appreciate any kind of help.
Thanks
How can I merge two columns {for eg : column Q and column R} in a worksheet using closedxml and c#.
Appreciate any kind of help.
Thanks
First You have to create the worksheet by the title. Then send datatable and work sheet to new function. Then You can create custom excel file.
var datatable = DivExportToExcelType1(dataDto);
var ws = workBook.Worksheets.Add(company.Value);
ExportToExcelType(ws, datatable);
private void ExportToExcelType(IXLWorksheet ws, DataTable datatable)
{
var rows = datatable.Rows;
var Cols = datatable.Columns;
for (int col = 1; col <= Cols.Count; col++)
{
//create your cols
}
for (int row = 1; row <= rows.Count ; row++)
{
//create your rows
}
ws.Range("range your cells").Merge(); //for example ws.Range("A11:A19")
}