📊 Cross-platform user-friendly xlsx library for C++11+
Go to file
2016-11-19 16:50:35 -05:00
benchmarks clean up cmake build, fix warnings, improve configuration, general 2016-10-25 20:22:22 -04:00
cmake make build system modular 2016-10-27 18:40:20 -04:00
docs clean up zip.cpp, enable and fix compiler warnings, use equality instead of hashing for style components, compile all cpp files in sample directory, track remote branches for submodules 2016-10-31 20:48:43 -04:00
include/xlnt begin cleaning up xml handling in consumer 2016-11-19 16:42:16 -05:00
samples clean up zip.cpp, enable and fix compiler warnings, use equality instead of hashing for style components, compile all cpp files in sample directory, track remote branches for submodules 2016-10-31 20:48:43 -04:00
source reformat cell.cpp 2016-11-19 16:50:35 -05:00
tests optimize format garbage collection and apply style fills to formats correctly, fixes #79, fix cell iteration, closes #73, add third-party licenses to LICENSE.md, update README, fix all clang and msvc warnings 2016-11-09 19:52:18 -05:00
third-party finish implementing comment positioning, closes #68 2016-11-12 17:38:29 -05:00
.appveyor.yml clean up zip.cpp, enable and fix compiler warnings, use equality instead of hashing for style components, compile all cpp files in sample directory, track remote branches for submodules 2016-10-31 20:48:43 -04:00
.clang-format fix formatting 2016-01-17 22:23:31 -08:00
.gitattributes clean up gitattributes 2016-11-09 17:24:47 -05:00
.gitignore fix all tests 2015-11-01 23:52:19 -05:00
.gitmodules optimize format garbage collection and apply style fills to formats correctly, fixes #79, fix cell iteration, closes #73, add third-party licenses to LICENSE.md, update README, fix all clang and msvc warnings 2016-11-09 19:52:18 -05:00
.travis.yml fix coveralls call and ignore unknown pragmas 2016-10-31 23:30:21 -04:00
AUTHORS.md Update AUTHORS.md 2016-06-04 09:08:03 -06:00
CMakeLists.txt make build system modular 2016-10-27 18:40:20 -04:00
CONTRIBUTING.md Clarify how to contribute to the project 2016-09-07 18:36:36 -04:00
LICENCE.md optimize format garbage collection and apply style fills to formats correctly, fixes #79, fix cell iteration, closes #73, add third-party licenses to LICENSE.md, update README, fix all clang and msvc warnings 2016-11-09 19:52:18 -05:00
README.md optimize format garbage collection and apply style fills to formats correctly, fixes #79, fix cell iteration, closes #73, add third-party licenses to LICENSE.md, update README, fix all clang and msvc warnings 2016-11-09 19:52:18 -05:00

xlnt

Travis Build Status AppVeyor Build status Coverage Status ReadTheDocs Documentation Status License

Introduction

xlnt is a C++14 library for reading, writing, and modifying xlsx files as described in ECMA 376 4th edition. The API was initially based on openpyxl, a Python library to read/write Excel 2007 xlsx/xlsm files, which was itself based on PHPExcel, pure PHP library for reading and writing spreadsheet files. xlnt is still very much a work in progress, but the core development work is complete. For a high-level summary of what you can do with this library, see here.

Usage

Including xlnt in your project

// with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
#include <xlnt/xlnt.hpp>

Creating a new spreadsheet and saving it as "example.xlsx"

xlnt::workbook wb;
xlnt::worksheet ws = wb.get_active_sheet();
ws.get_cell("A1").set_value(5);
ws.get_cell("B2").set_value("string data");
ws.get_cell("C3").set_formula("=RAND()");
ws.merge_cells("C3:C4");
ws.freeze_panes("B2");
wb.save("example.xlsx");

Building

xlnt uses continous integration (thanks Travis CI and AppVeyor!) and passes all 270+ tests in GCC 4, GCC 5, VS2015 U3, and Clang (using Apple LLVM 8.0). Build configurations for Visual Studio 2015, GNU Make, and Xcode can be created using cmake v3.1+. A full list of cmake generators can be found here. A basic build would look like (starting in the root xlnt directory):

mkdir build
cd build
cmake ..
make -j8

The resulting shared (e.g. libxlnt.dylib) library would be found in the build/lib directory. Other cmake configuration options for xlnt can be found using "cmake -LH". These options include building a static library instead of shared and whether to build sample executables or not. An example of building a static library with an Xcode project:

mkdir build
cd build
cmake -D STATIC=ON -G Xcode ..
cmake --build .
cd bin && ./xlnt.test

Note for Windows: cmake defaults to building a 32-bit library project. To build a 64-bit library, use the Win64 generator

cmake -G "Visual Studio 14 2015 Win64" ..

Dependencies

xlnt requires the following libraries which are all distributed under permissive open source licenses. All libraries are included in the source tree as git submodules for convenience except for pole and partio's zip component which have been modified and reside in xlnt/source/detail:

Additionally, the xlnt test suite (bin/xlnt.test) requires two extra libraries. This test executable is separate from the main xlnt library assembly so the terms of these libraries' licenses should not apply to users of solely the xlnt library:

Initialize the submodules from the HEAD of their respective Git repositories with this command called from the xlnt root directory:

git submodule update --init --remote

Documentation

More detailed documentation with examples can be found on Read The Docs (Warning: As of November 9, 2016 this is very out of date).

License

xlnt is released to the public for free under the terms of the MIT License. See LICENSE.md for the full text of the license and the licenses of xlnt's third-party dependencies. LICENSE.md should be distributed alongside any assemblies that use xlnt in source or compiled form.