File: mergecells.cpp

package info (click to toggle)
libqt5qxlsx 1.4.4-1.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,304 kB
  • sloc: cpp: 17,870; ansic: 4,644; python: 15; makefile: 4
file content (43 lines) | stat: -rw-r--r-- 646 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// mergecells.cpp

#include <QtGlobal>
#include <QDebug>

#include "xlsxdocument.h"
#include "xlsxformat.h"

QXLSX_USE_NAMESPACE

int mergecells()
{
    Document xlsx;

    //![0]
    Format format;
    format.setHorizontalAlignment(Format::AlignHCenter);
    format.setVerticalAlignment(Format::AlignVCenter);
    //![0]

    //![1]
    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);
    //![1]

    //![2]

    // mergedCells




    //![2]

	xlsx.saveAs("mergecells.xlsx"); 

    return 0;
}