Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
39a1e34
Added compatibility with Qt 5.6
OlivierDelbeke Apr 19, 2016
3c474f3
Merge pull request #2 from OlivierDelbeke/Qt-5.6
VSRonin Apr 20, 2016
b14de62
NullPointer fix
Dec 12, 2016
37ef9da
Merge pull request #6 from CSendner/patch-1
VSRonin Dec 15, 2016
04d3eca
Added CMakeLists.txt
VSRonin Apr 19, 2017
c072fbc
Change install dir for QtXlsxWriterConfig.cmake
Apr 28, 2017
6895d8b
Merge pull request #10 from ohmyarch/patch-1
VSRonin Apr 28, 2017
e7f9d71
Properly check existence of protection data
hasselmm Jan 29, 2018
779555d
Merge pull request #16 from hasselmm/hasProtectionData-int-in-bool-co…
VSRonin Mar 7, 2018
d177d68
Added support of multy-block (<p>...</p>) html
drow-it Apr 6, 2018
57199a6
Coding style changed
drow-it Apr 6, 2018
06911c4
Merge pull request #24 from drow-it/master
VSRonin Apr 6, 2018
8af87ce
Added travis CI project
VSRonin Jan 29, 2019
cd31720
Fixed reading date/time even if null
VSRonin Jan 29, 2019
a7b04b2
Fixes example not having install target
VSRonin Jan 29, 2019
60785ce
Remove warning using ASCII strings
VSRonin Jan 29, 2019
ad44e69
Fix Travis script
VSRonin Jan 29, 2019
5ede82c
Separating test and release builds in CI
VSRonin Jan 29, 2019
cd33e43
Added Appveyor project
VSRonin Jan 29, 2019
5b685b5
Prevent loss of numeric precision
VSRonin Feb 1, 2019
b052e2e
Added ability to resize page margins
fralx Apr 9, 2019
671ba0b
Number format has been added
fralx Apr 16, 2019
061567b
Merge pull request #34 from fralx/master
VSRonin Apr 16, 2019
6c3614a
fix warnings about construction initialization order
MartinDelille May 2, 2019
9ba6f64
Merge pull request #35 from MartinDelille/fix-warnings
VSRonin May 3, 2019
76f7365
fix zero-as-null-pointer-constant warning
MartinDelille Jun 9, 2019
773e257
nullptr => Q_NULLPTR
MartinDelille Jun 12, 2019
ed26e5d
Merge pull request #38 from MartinDelille/fix-zero-as-null-pointer-co…
VSRonin Jun 12, 2019
7a54b18
Use QString::asprintf() instead of sprintf()
hasselmm Oct 11, 2019
d3bd83b
Merge pull request #42 from hasselmm/improvement/avoid-qstring-sprintf
VSRonin Oct 16, 2019
1d89bea
Add cmake target_include_directories INTERFACE
MartinDelille Aug 23, 2020
57021ef
Merge pull request #49 from MartinDelille/cmake-interface
VSRonin Sep 25, 2020
01eb671
added unmaintaned disclaimer
Jun 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '0.3.0.{build}'

image: Visual Studio 2015
clone_depth: 1
environment:
global:
# Appveyor doesn't have Qt 12 yet
LatestLTSQtVersion: 5.9
matrix:
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32
COMPILER: C:\Qt\Tools\mingw530_32
targetPlatform: x86
use_mingw: "true"
use_cmake: "false"
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
targetPlatform: amd64
use_mingw: "false"
use_cmake: "false"

matrix:
fast_finish: true

before_build:
- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH%
- set originalWD=%CD%
- call "%QT5%\bin\qtenv2.bat"
- cd %originalWD%
- if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform%
- if %use_mingw%==true (set MAKEENGINE=mingw32-make) else (set MAKEENGINE=nmake)
- if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=%

build_script:
- qmake "DEFINES += XLSX_TEST"
- '%MAKEENGINE%'
- '%MAKEENGINE% install'
- cd tests
- qmake
- '%MAKEENGINE%'
- '%MAKEENGINE% check TESTARGS="-o testResults.xml,xml"'

after_build:
- if %use_mingw%==true set PATH=C:\Program Files\Git\usr\bin;%PATH%

on_finish:
- ps: if (Test-Path ".\tests\testResults.xml") {(new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\tests\testResults.xml));}
104 changes: 104 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
language: cpp

git:
depth: 1

matrix:
fast_finish: true
include:
- name: Ubuntu qmake test
os: linux
dist: xenial
group: stable
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial'
update: true
packages:
- qt512base
- qt512tools
- gcc-6
- g++-6
- libc6-i386
- libgl-dev
- libgl1-mesa-dev
- mesa-common-dev
script:
- PATH="/opt/qt512/bin:$PATH"
- CXX="g++-6"
- CC="gcc-6"
- qt512-env.sh
- qmake "DEFINES += XLSX_TEST"
- make
- sudo make install
- cd tests
- qmake
- make
- make check
- name: Ubuntu qmake release
os: linux
dist: xenial
group: stable
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial'
update: true
packages:
- qt512base
- qt512tools
- gcc-6
- g++-6
- libc6-i386
- libgl-dev
- libgl1-mesa-dev
- mesa-common-dev
script:
- PATH="/opt/qt512/bin:$PATH"
- CXX="g++-6"
- CC="gcc-6"
- qt512-env.sh
- qmake
- make
- sudo make install
- name: macOS qmake test
os: osx
osx_image: xcode10.1
compiler: clang
addons:
homebrew:
packages:
- qt
update: true
script:
- PATH="/usr/local/opt/qt5/bin:$PATH"
- qmake "DEFINES += XLSX_TEST"
- make
- make install
- cd tests
- qmake
- make
- make check
- name: macOS qmake release
os: osx
osx_image: xcode10.1
compiler: clang
addons:
homebrew:
packages:
- qt
update: true
script:
- PATH="/usr/local/opt/qt5/bin:$PATH"
- qmake
- make
- make install

notifications:
email: false

92 changes: 92 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
cmake_minimum_required(VERSION 3.2)

project(QtXlsxWriter)
add_definitions(-DQT_BUILD_XLSX_LIB)
set(BUILD_SHARED_LIBS TRUE)
set(CMAKE_AUTOMOC ON)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

file(
GLOB
QtXlsxWriter_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx/*.cpp
${CMAKE_CURRENT_BINARY_DIR}/QtXlsxWriterTest_automoc.cpp
)

find_package(Qt5 5.5 REQUIRED Core Gui Test)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx/
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Gui_PRIVATE_INCLUDE_DIRS} )

add_library(QtXlsxWriter SHARED "${QtXlsxWriter_SOURCE_FILES}")

# automatically add C++11 support with GCC
if(NOT MSVC)
target_compile_features(QtXlsxWriter PRIVATE cxx_range_for)
endif()

set_target_properties(QtXlsxWriter PROPERTIES DEBUG_POSTFIX "d")
target_link_libraries(QtXlsxWriter ${Qt5Core_LIBRARIES})
target_link_libraries(QtXlsxWriter ${Qt5Gui_LIBRARIES})

target_include_directories(QtXlsxWriter
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx
)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()

if(BUILD_EXAMPLES)
add_custom_command(TARGET QtXlsxWriter POST_BUILD
COMMAND ${CMAKE_COMMAND}
-E copy_directory $<CONFIGURATION> ${CMAKE_CURRENT_BINARY_DIR}/examples/xlsx/$<CONFIGURATION>)
add_subdirectory(examples/xlsx)
endif()

##
#
# QtxlsxwriterVersion.cmake creation
#
##
set(QtXlsxWriter_CONFIG_PATH ${CMAKE_INSTALL_PREFIX})
configure_file(QtXlsxWriterConfig.cmake.in QtXlsxWriterConfig.cmake @ONLY)

#####
#
# Installation configuration
#
#####
INSTALL(TARGETS QtXlsxWriter
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/QtXlsxWriterConfig.cmake DESTINATION lib/cmake/${PROJECT_NAME})

SET(INCLUDE_FILES
src/xlsx/xlsxabstractooxmlfile.h
src/xlsx/xlsxabstractsheet.h
src/xlsx/xlsxcell.h
src/xlsx/xlsxcellformula.h
src/xlsx/xlsxcellrange.h
src/xlsx/xlsxcellreference.h
src/xlsx/xlsxchart.h
src/xlsx/xlsxchartsheet.h
src/xlsx/xlsxconditionalformatting.h
src/xlsx/xlsxdatavalidation.h
src/xlsx/xlsxdocument.h
src/xlsx/xlsxformat.h
src/xlsx/xlsxglobal.h
src/xlsx/xlsxrichstring.h
src/xlsx/xlsxworkbook.h
src/xlsx/xlsxworksheet.h
)
INSTALL(FILES ${INCLUDE_FILES} DESTINATION include)

135 changes: 135 additions & 0 deletions COVER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
Documentation: http://qtxlsx.debao.me

QtXlsx is a library that can read and write Excel files. It doesn't require Microsoft Excel and can be used in any platform that Qt5 supported.
The library can be used to

* Generate a new .xlsx file from scratch
* Extract data from an existing .xlsx file
* Edit an existing .xlsx file

## Getting Started

> * For linux user, if your Qt is installed through package manager tools such "apt-get", make sure that you have installed the Qt5 develop package *qtbase5-private-dev*

### Usage(1): Use Xlsx as Qt5's addon module

#### Building the module

> **Note**: Perl is needed in this step.

* Download the source code.

* Put the source code in any directory you like

* Go to top directory of the project in a terminal and run

```
qmake
make
make install
```

The library, the header files, and others will be installed to your system.

> ```make html_docs``` can be used to generate documentations of the library, and ```make check``` can be used to run unit tests of the library.

#### Using the module

* Add following line to your qmake's project file:

```
QT += xlsx
```

* Then, using Qt Xlsx in your code

```cpp
#include <QtXlsx>
int main()
{
QXlsx::Document xlsx;
xlsx.write("A1", "Hello Qt!");
xlsx.saveAs("Test.xlsx");
return 0;
}
```

### Usage(2): Use source code directly

The package contains a **qtxlsx.pri** file that allows you to integrate the component into applications that use qmake for the build step.

* Download the source code.

* Put the source code in any directory you like. For example, 3rdparty:

```
|-- project.pro
|-- ....
|-- 3rdparty\
| |-- qtxlsx\
| |
```

* Add following line to your qmake project file:

```
include(3rdparty/qtxlsx/src/xlsx/qtxlsx.pri)
```

> **Note**: If you like, you can copy all files from *src/xlsx* to your application's source path. Then add following line to your project file:

> ```
include(qtxlsx.pri)
```

> **Note**: If you do not use qmake, you need to define the following macro manually

> ```
XLSX_NO_LIB
```


* Then, using Qt Xlsx in your code

```cpp
#include "xlsxdocument.h"
int main()
{
QXlsx::Document xlsx;
xlsx.write("A1", "Hello Qt!");
xlsx.saveAs("Test.xlsx");
return 0;
}
```

## References

* http://www.ecma-international.org/publications/standards/Ecma-376.htm
* http://www.iso.org/iso/catalogue_detail?csnumber=51463
* http://msdn.microsoft.com/en-us/library/ee908652%28v=office.12%29.aspx
* http://www.datypic.com/sc/ooxml/

### General

* https://github.com/jmcnamara/XlsxWriter
* http://openpyxl.readthedocs.org
* http://officeopenxml.com/anatomyofOOXML-xlsx.php
* http://www.libxl.com
* http://closedxml.codeplex.com/
* http://epplus.codeplex.com/
* http://excelpackage.codeplex.com/
* http://spreadsheetlight.com/

### Number formats

* http://msdn.microsoft.com/en-us/library/ff529356%28v=office.12%29.aspx
* http://www.ozgrid.com/Excel/excel-custom-number-formats.htm
* http://stackoverflow.com/questions/894805/excel-number-format-what-is-409
* http://office.microsoft.com/en-001/excel-help/create-a-custom-number-format-HP010342372.aspx

### Formula

* http://msdn.microsoft.com/en-us/library/ff533995%28v=office.12%29.aspx
* http://msdn.microsoft.com/en-us/library/dd906358%28v=office.12%29.aspx
* http://homepages.ecs.vuw.ac.nz/~elvis/db/Excel.shtml
* http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
Loading