728x90
반응형
728x90
반응형
728x90
반응형

XlsxFactory


What is this?
이건 뭔가요?

  • Excel(*.xlsx) Viewer in Windows.
    엑셀(*.xlsx) 뷰어 (윈도우즈 용) 입니다.

  • This program is based on the QXlsx library.
    이 프로그램은 QXlsx 라이브러리에 기반한 프로그램입니다.


Download
🇰🇷 다운로드


Usage
사용법

  • Open a file : Main menu > Open

Environment
환경

  • Windows 64bit (Windows 10 or higher version is recommended)
    64비트 윈도우즈 (Windows 10 이상 권장)

License
라이센스

Personal users
개인 사용자

  • Personal users are free to use.
    개인 사용자는 무료 사용 가능합니다.

Corporate and Government
기업과 정부

  • Corporate and government versions are commercial programs. If you need a commercial license, please contact me.
    기업 및 관공서용 버전은 상용입니다. 상업적인 라이센스 사용이 필요하시면 연락주세요.

License and Source Code
라이선스와 소스코드

  • The source code of this program cannot be released open source, because it contains commercial license code.
    이 프로그램의 소스코드는 상업적인 라이센스 코드가 포함되어 있어서 공개할 수 없습니다.
728x90
반응형
728x90
반응형


  • QXlsx는 엑셀 파일(*.xlsx)을 읽고 쓰는 라이브러리입니다.
    • QtXlsx가 더 이상 지원되지 않기 때문에(2014), QtXlsx에 기반한 새로운 프로젝트를 만들었습니다. (2017-)
  • QXlsx는 개발언어로 C++을 사용합니다. (Qt 사용)
  • QXlsx는 정적 또는 동적 라이브러리를 사용하지 않아도 되도록 제작되었습니다.
    • 물론 정적 라이브러리(static library)로 사용할 수도 있습니다.
728x90
반응형
728x90
반응형

Qxlnt

  • Qxlnt는 xlnt를 Qt에서 사용하도록 구성한 도우미 프로젝트 입니다. https://github.com/j2doll/Qxlnt

  • Qt에서 cmake를 직접 사용하여 프로젝트를 구성하기 어려운 경우, 활용해 보세요.

728x90
반응형
728x90
반응형
  • msys2를 설치 후 다음과 같은 항목들을 설치합니다.
 pacman -Syu bash pacman pacman-mirrors msys2-runtime base-devel gcc make cmake git wget p7zip 
  • github에서 xlnt 소스코드를 받습니다.
 git clone https://github.com/tfussell/xlnt.git 
  • xlnt 경로에서 빌드를 수행합니다.
 cd xlnt
 cmake -G "Unix Makefiles"
 make
  • cmake 옵션은 -G "MSYS Makefiles" 가 될 수도 있습니다. cmake --help를 통해 지원하는 항목을 확인하세요.

  • 빌드가 성공하였다면, 테스트 프로그램을 실행합니다.

 cd test
 cp ../source/msys-xlnt-1.2.dll .
 ./xlnt.test 
  • *.dll 이 있는 경로를 실행 경로로 설정하였다면, dll 을 테스트 경로로 복사하지 않아도 됩니다.

  • 다음과 같은 결과가 나오면 성공입니다.

 ......................................................................................................................................................................................................................................................................
  • 하나의 점(dot)은 단위 테스트를 성공하였음을 의미합니다.

  • 만약 테스트 중 실패가 생기면 해당 메시지를 전시합니다.

  • 필자가 수행한 테스트 환경은 다음과 같습니다. (테스트 일자는 18년 3월말)

  • 물론 테스트 환경과 코드가 다르면 결과가 다르게 나올 수 있습니다.

default-user@DESKTOP-826T7L9 MSYS /d/workspace/github/xlnt/tests
$ uname -a
MSYS_NT-10.0 DESKTOP-826T7L9 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys
default-user@DESKTOP-826T7L9 MSYS /d/workspace/github/xlnt/tests
$ gcc --version
gcc (GCC) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
default-user@DESKTOP-826T7L9 MSYS /d/workspace/github/xlnt/tests
$ cmake --version
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
default-user@DESKTOP-826T7L9 MSYS /d/workspace/github/xlnt/tests
$ make --version
GNU Make 4.2.1
x86_64-pc-msys 빌드
Copyright (C) 1988-2016 Free Software Foundation, Inc.
라이선스 GPLv3+: GNU GPL 버전 3 또는 이후 <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

다음글

728x90
반응형
728x90
반응형

간단한 예제

  • 새로운 xlsx 스프레드 쉬트에 값 쓰기
#include <iostream>
#include <xlnt/xlnt.hpp>
#include <vector>
#include <string>

int main()
{
    //Creating a 2 dimensional vector which we will write values to
    std::vector< std::vector<std::string> > wholeWorksheet;
  
    //Looping through each row (100 rows as per the second argument in the for loop)
    for (int outer = 0; outer < 100; outer++)
    {
        //Creating a fresh vector for a fresh row
        std::vector<std::string> singleRow;
      
        //Looping through each of the columns (100 as per the second argument in the for loop) in this particular row
        for(int inner = 0; inner < 100; inner++)
        {
          //Adding a single value in each cell of the row 
          std::string val = std::to_string(inner + 1);
          singleRow.push_back(val);            
        }
      
        //Adding the single row to the 2 dimensional vector
        wholeWorksheet.push_back(singleRow);
        std::clog << "Writing to row " << outer << " in the vector " << std::endl;
    }
  
    //Writing to the spread sheet
    //Creating the output workbook 
    std::clog << "Creating workbook" << std::endl;
  
    xlnt::workbook wbOut;
  
    //Setting the destination output file name
    std::string dest_filename = "output.xlsx";
  
    //Creating the output worksheet
    xlnt::worksheet wsOut = wbOut.active_sheet();
  
    //Giving the output worksheet a title/name
    wsOut.title("data");
  
    //We will now be looping through the 2 dimensional vector which we created above
    //In this case we have two iterators one for the outer loop (row) and one for the inner loop (column)
    std::clog << "Looping through vector and writing to spread sheet" << std::endl;
  
    for (int fOut = 0; fOut < wholeWorksheet.size(); fOut++)
    {
        std::clog << "Row" << fOut << std::endl;
        for (int fIn = 0; fIn < wholeWorksheet.at(fOut).size(); fIn++)
        {
            //Take notice of the difference between accessing the vector and accessing the work sheet
            //As you may already know Excel spread sheets start at row 1 and column 1 (not row 0 and column 0 like you would expect from a C++ vector) 
            //In short the xlnt cell reference starts at column 1 row 1 (hence the + 1s below) and the vector reference starts at row 0 and column 0
            wsOut.cell(xlnt::cell_reference(fIn + 1, fOut + 1)).value(wholeWorksheet.at(fOut).at(fIn));
            //Further clarification to avoid confusion
            //Cell reference arguments are (column number, row number); e.g. cell_reference(fIn + 1, fOut + 1)
            //Vector arguments are (row number, column number); e.g. wholeWorksheet.at(fOut).at(fIn)
        }
    }
  
    std::clog << "Finished writing spread sheet" << std::endl;
  
    wbOut.save(dest_filename); 
  
    return 0;
}

다음글

728x90
반응형
728x90
반응형

간단한 예제 - 기존의 xlsx 스프레드 쉬트파일에서 읽기

  • 다음의 C++ 코드는 xlsx 파일로 부터 값을 읽고 값을 화면으로 출력하는 예제입니다. 이 예제는 시작하는 이들에게 매우 쉬운 예제가 될 것입니다.
#include <iostream>
#include <xlnt/xlnt.hpp>

int main() 
{
  xlnt::workbook wb;
  wb.load("/home/timothymccallum/test.xlsx");
  auto ws = wb.active_sheet();
  std::clog << "Processing spread sheet" << std::endl;     
  for (auto row : ws.rows(false)) {         
    for (auto cell : row) {    
      std::clog << cell.to_string() << std::endl; 
    }     
  }
  std::clog << "Processing complete" << std::endl;     
  return 0; 
}
  • 위의 내용을 다음과 같이 저장하세요.
/home/timothymccallum/process.cpp
  • 다음과 같은 명령을 입력하여 컴파일하십시오.
g++ -std=c++14 -lxlnt process.cpp -o process
  • 다음과 같은 명령을 입력하여 실행하십시오.
./process
  • 프로그램의 결과는 다음과 같을 것입니다.
Processing spread sheet
This is cell A1.
This is cell B1
… and this is cell C1
We are now on the second row at cell A2
B2
C2
Processing complete
  • process.cpp 파일을 보시는 바와 같이 스프레드 쉬트의 값들의 열단위 행단위로 진행합니다.

다음글

728x90
반응형

'C C++' 카테고리의 다른 글

Xlnt (4) 값 쓰기 예제  (0) 2017.10.15
Xlnt (3) Vector를 이용한 예제  (0) 2017.10.15
Xlnt (1) 소개 : C++14 기반 excel(xlsx) 라이브러리  (0) 2017.10.15
Qt single instance process  (0) 2017.09.08
Determining 32 vs 64 bit in C++  (0) 2017.09.07
728x90
반응형

xlnt

소개

  • Xlnt는
    • 스프레드쉬트를 메모리 상에서 조작하며,
    • ECMA 376 4쇄 에서 기술된 XLSX 파일을 읽고 쓰는,
    • 모던 C++ 라이브러리입니다.
  • 현재 작업으로 호환성을 늘리고, 성능을 개선하고, 미래 개발 목표에 대한 브레인스토밍을 진행하고 있습니다.
  • 라이브러리에 대한 고수준 정리는 특징 목록(homepage)을 참고하시기 바랍니다.

빌드 환경

  • gcc 4.8(또는 4.7) 이상 지원 (Linux/Unix/Mac/Windows)
  • Visual Studio(C++) 2015/2017 이상 지원 (Windows)

다음글

728x90
반응형

'C C++' 카테고리의 다른 글

Xlnt (3) Vector를 이용한 예제  (0) 2017.10.15
Xlnt (2) 입문 예제 : Hello, Xlnt !!  (1) 2017.10.15
Qt single instance process  (0) 2017.09.08
Determining 32 vs 64 bit in C++  (0) 2017.09.07
함수의 인자를 const로 사용  (0) 2014.12.07

+ Recent posts