Merge Cells Example

Demonstrates how to merge cells

This example demonstrates how to generate a simplest .xlsx file which contians merged cells with Qt Xlsx Library.

Create an format which will be applied to the merged cells:

Format format;
format.setHorizontalAlignment(Format::AlignHCenter);
format.setVerticalAlignment(Format::AlignVCenter);

Merge cells.

xlsx.write("B4", "Hello Qt!");
xlsx.mergeCells("B4:F6", format);
xlsx.write("B8", 1);
xlsx.mergeCells("B8:C21", format);
xlsx.write("E8", 2);
xlsx.mergeCells("E8:F21", format);

Files: