Qlibxlsxwriter

Read this in other languages: English, :kr: 한국어

예제 (헬로우 월드!)

// main.cpp
//
// Qlibxlsxwriter MIT license https://github.com/QtExcel/Qlibxlsxwriter
// libxlsxwriter  FreeBSD license https://github.com/jmcnamara/libxlsxwriter

#include <QCoreApplication>

#include "xlsxwriter.h"

int main(int argc, char **argv)
{
     QCoreApplication app(argc, argv); // It is a Qt code.

     // See Tutorial 1: Create a simple XLSX file.
     // http://libxlsxwriter.github.io/tutorial01.html

     /* Some data we want to write to the worksheet. */
     struct expense {
         char item[32];
         int  cost;
     };
     
     struct expense expenses[] = {
         {"Rent", 1000},
         {"Gas",   100},
         {"Food",  300},
         {"Gym",    50},
     };

    /* Create a workbook and add a worksheet. */
     lxw_workbook  *workbook  = workbook_new("tutorial01.xlsx");
     lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

     /* Start from the first cell. Rows and columns are zero indexed. */
     int row = 0;
     int col = 0;

     /* Iterate over the data and write it out element by element. */
     for (row = 0; row < 4; row++) {
         worksheet_write_string(worksheet, row, col,     expenses[row].item, NULL);
         worksheet_write_number(worksheet, row, col + 1, expenses[row].cost, NULL);
     }

     /* Write a total using a formula. */
     worksheet_write_string (worksheet, row, col,     "Total",       NULL);
     worksheet_write_formula(worksheet, row, col + 1, "=SUM(B1:B4)", NULL);

     /* Save the workbook and free any allocated memory. */
     return workbook_close(workbook);
}

먼저 설치하여야 할 것들 (선행 사항)

설정하는 방법 (설치)

# YourQtProject.pro

# Qlibxlsxwriter의 값을 설정하십시오.
# 기본값을 사용하셔도 됩니다.
QLIBXLSXWRITER_PARENTPATH = ../libxlsxwriter/
include(../Qlibxlsxwriter/Qlibxlsxwriter.pri)

테스트 환경

Travis CI
Build Status

라이센스와 링크

:mailbox: 문의

비슷한 프로젝트

:star: QXlsx https://github.com/QtExcel/QXlsx

:star: Qxlnt https://github.com/QtExcel/Qxlnt

:star: QSimpleXlsxWriter https://github.com/QtExcel/QSimpleXlsxWriter