This commit is contained in:
Thomas Fussell 2017-01-21 10:29:32 -05:00
commit 7a991da9df
85 changed files with 5424 additions and 2489 deletions

3
.gitignore vendored
View File

@ -1,8 +1,9 @@
bin/
lib/
build/
docs/_*/
docs/build/
docs/doxyxml/
node_modules/
*.obj
*.sdf
*.suo

27
.gitmodules vendored
View File

@ -3,30 +3,3 @@
url = http://scm.codesynthesis.com/libstudxml/libstudxml.git
branch = master
ignore = dirty
[submodule "third-party/cxxtest"]
path = third-party/cxxtest
url = https://github.com/CxxTest/cxxtest
branch = master
ignore = dirty
[submodule "third-party/utfcpp"]
path = third-party/utfcpp
url = https://github.com/nemtrif/utfcpp
branch = master
ignore = dirty
[submodule "third-party/botan"]
path = third-party/botan
url = https://github.com/randombit/botan
branch = master
ignore = dirty
[submodule "third-party/zlib"]
path = third-party/zlib
url = https://github.com/madler/zlib.git
branch = develop
ignore = dirty
[submodule "third-party/cryptopp"]
path = third-party/cryptopp
url = https://github.com/weidai11/cryptopp

View File

@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.1)
set(LIBRARY_NAME xlnt)
project(${LIBRARY_NAME}_all VERSION ${LIBRARY_VERSION} LANGUAGES CXX C)
project(xlnt_all)
# This indicates to CMakeLists in subdirectories that they are part of a larger project
set(COMBINED_PROJECT 1)
set(COMBINED_PROJECT TRUE)
# Library type
option(STATIC "Set to ON to build ${PROJECT_NAME} as a static library instead of a shared library" OFF)

115
README.md
View File

@ -1,4 +1,4 @@
<img height="100" src="https://raw.githubusercontent.com/tfussell/xlnt/gh-pages/images/xlnt.png" alt="xlnt"><br/>
<img height="100" src="https://raw.githubusercontent.com/tfussell/xlnt/gh-pages/images/logo.png" alt="xlnt"><br/>
====
[![Travis Build Status](https://travis-ci.org/tfussell/xlnt.svg)](https://travis-ci.org/tfussell/xlnt)
@ -8,17 +8,17 @@
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
## Introduction
xlnt is a C++14 library for reading, writing, and modifying xlsx files as described in [ECMA 376 4th edition](http://www.ecma-international.org/publications/standards/Ecma-376.htm). The API was initially based on [openpyxl](https://bitbucket.org/openpyxl/openpyxl), a Python library to read/write Excel 2007 xlsx/xlsm files, which was itself based on [PHPExcel](https://github.com/PHPOffice/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](http://xlnt.readthedocs.io/en/latest/#summary-of-features).
xlnt is a modern C++ library for manipulating spreadsheets in memory and reading/writing them from/to XLSX files as described in [ECMA 376 4th edition](http://www.ecma-international.org/publications/standards/Ecma-376.htm). xlnt is currently under active feature development and is on track for the version 1.0 release in the next few weeks. Until then, the API could have significant changes. For a high-level summary of what you can do with this library, see [here](https://thomas.fussell.io/xlnt/#features).
## Example
Including xlnt in your project, creating a new spreadsheet, and saving it as "example.xlsx"
## Usage
Including xlnt in your project
```c++
// with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
#include <xlnt/xlnt.hpp>
```
Creating a new spreadsheet and saving it as "example.xlsx"
```c++
int main()
{
xlnt::workbook wb;
xlnt::worksheet ws = wb.active_sheet();
ws.cell("A1").value(5);
@ -27,105 +27,14 @@ Creating a new spreadsheet and saving it as "example.xlsx"
ws.merge_cells("C3:C4");
ws.freeze_panes("B2");
wb.save("example.xlsx");
```
## Building
xlnt uses continous integration (thanks [Travis CI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/)!) 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](https://cmake.org/) v3.1+. A full list of cmake generators can be found [here](https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html). A basic build would look like (starting in the root xlnt directory):
```bash
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:
```bash
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*
```bash
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](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules) for convenience except for pole and partio's zip component which have been modified and reside in xlnt/source/detail:
- [zlib v1.2.8](http://zlib.net/) (zlib License)
- [libstudxml v1.1.0](http://www.codesynthesis.com/projects/libstudxml/) (MIT license)
- [utfcpp v2.3.4](http://utfcpp.sourceforge.net/) (Boost Software License, Version 1.0)
- [Crypto++ v5.6.5](https://www.cryptopp.com/) (Boost Software License, Version 1.0)
- [pole v0.5](https://github.com/catlan/pole) (BSD 2-Clause License)
- [partio v1.1.0](https://github.com/wdas/partio) (BSD 3-Clause License with specific non-attribution clause)
Additionally, the xlnt test suite (bin/xlnt.test) requires an extra testing library. This test executable is separate from the main xlnt library assembly so the terms of this library's license should not apply to users of solely the xlnt library:
- [cxxtest v4.4](http://cxxtest.com/) (LGPLv3 License)
Initialize the submodules from the HEAD of their respective Git repositories with this command called from the xlnt root directory:
```bash
git submodule update --init --remote
return 0;
}
// compile with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
```
## Documentation
Properties
```c++
xlnt::workbook wb;
wb.core_property(xlnt::core_property::category, "hors categorie");
wb.core_property(xlnt::core_property::content_status, "good");
wb.core_property(xlnt::core_property::created, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::creator, "me");
wb.core_property(xlnt::core_property::description, "description");
wb.core_property(xlnt::core_property::identifier, "id");
wb.core_property(xlnt::core_property::keywords, { "wow", "such" });
wb.core_property(xlnt::core_property::language, "Esperanto");
wb.core_property(xlnt::core_property::last_modified_by, "someone");
wb.core_property(xlnt::core_property::last_printed, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::modified, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::revision, "3");
wb.core_property(xlnt::core_property::subject, "subject");
wb.core_property(xlnt::core_property::title, "title");
wb.core_property(xlnt::core_property::version, "1.0");
wb.extended_property(xlnt::extended_property::application, "xlnt");
wb.extended_property(xlnt::extended_property::app_version, "0.9.3");
wb.extended_property(xlnt::extended_property::characters, 123);
wb.extended_property(xlnt::extended_property::characters_with_spaces, 124);
wb.extended_property(xlnt::extended_property::company, "Incorporated Inc.");
wb.extended_property(xlnt::extended_property::dig_sig, "?");
wb.extended_property(xlnt::extended_property::doc_security, 0);
wb.extended_property(xlnt::extended_property::heading_pairs, true);
wb.extended_property(xlnt::extended_property::hidden_slides, false);
wb.extended_property(xlnt::extended_property::h_links, 0);
wb.extended_property(xlnt::extended_property::hyperlink_base, 0);
wb.extended_property(xlnt::extended_property::hyperlinks_changed, true);
wb.extended_property(xlnt::extended_property::lines, 42);
wb.extended_property(xlnt::extended_property::links_up_to_date, false);
wb.extended_property(xlnt::extended_property::manager, "johnny");
wb.extended_property(xlnt::extended_property::m_m_clips, "?");
wb.extended_property(xlnt::extended_property::notes, "note");
wb.extended_property(xlnt::extended_property::pages, 19);
wb.extended_property(xlnt::extended_property::paragraphs, 18);
wb.extended_property(xlnt::extended_property::presentation_format, "format");
wb.extended_property(xlnt::extended_property::scale_crop, true);
wb.extended_property(xlnt::extended_property::shared_doc, false);
wb.extended_property(xlnt::extended_property::slides, 17);
wb.extended_property(xlnt::extended_property::template_, "template!");
wb.extended_property(xlnt::extended_property::titles_of_parts, { "title" });
wb.extended_property(xlnt::extended_property::total_time, 16);
wb.extended_property(xlnt::extended_property::words, 101);
wb.custom_property("test", { 1, 2, 3 });
wb.custom_property("Editor", "John Smith");
wb.save("lots_of_properties.xlsx");
```
Documentation for the current release of xlnt is available [here](https://thomas.fussell.io/xlnt).
## License
xlnt is released to the public for free under the terms of the MIT License. See [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) for the full text of the license and the licenses of xlnt's third-party dependencies. [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) should be distributed alongside any assemblies that use xlnt in source or compiled form.

View File

@ -1,24 +0,0 @@
set(LIBRARY_NAME xlnt)
set(LIBRARY_VERSION 0.9.3)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_policy(SET CMP0048 NEW)
# Global library directories
set(LIBRARY_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../include)
set(LIBRARY_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../source)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/../third-party)
# Put all output files in the same directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin)
endforeach()

88
docs/CHANGELOG.md Normal file
View File

@ -0,0 +1,88 @@
# Changelog
## Version 1.4.0
*November 24, 2016*
- Upgrade Middleman and Rouge gems, should hopefully solve a number of bugs
- Update some links in README
- Fix broken Vagrant startup script
- Fix some problems with deploy.sh help message
- Fix bug with language tabs not hiding properly if no error
- Add `!default` to SASS variables
- Fix bug with logo margin
- Bump tested Ruby versions in .travis.yml
## Version 1.3.3
*June 11, 2016*
Documentation and example changes.
## Version 1.3.2
*February 3, 2016*
A small bugfix for slightly incorrect background colors on code samples in some cases.
## Version 1.3.1
*January 31, 2016*
A small bugfix for incorrect whitespace in code blocks.
## Version 1.3
*January 27, 2016*
We've upgraded Middleman and a number of other dependencies, which should fix quite a few bugs.
Instead of `rake build` and `rake deploy`, you should now run `bundle exec middleman build --clean` to build your server, and `./deploy.sh` to deploy it to Github Pages.
## Version 1.2
*June 20, 2015*
**Fixes:**
- Remove crash on invalid languages
- Update Tocify to scroll to the highlighted header in the Table of Contents
- Fix variable leak and update search algorithms
- Update Python examples to be valid Python
- Update gems
- More misc. bugfixes of Javascript errors
- Add Dockerfile
- Remove unused gems
- Optimize images, fonts, and generated asset files
- Add chinese font support
- Remove RedCarpet header ID patch
- Update language tabs to not disturb existing query strings
## Version 1.1
*July 27, 2014*
**Fixes:**
- Finally, a fix for the redcarpet upgrade bug
## Version 1.0
*July 2, 2014*
[View Issues](https://github.com/tripit/slate/issues?milestone=1&state=closed)
**Features:**
- Responsive designs for phones and tablets
- Started tagging versions
**Fixes:**
- Fixed 'unrecognized expression' error
- Fixed #undefined hash bug
- Fixed bug where the current language tab would be unselected
- Fixed bug where tocify wouldn't highlight the current section while searching
- Fixed bug where ids of header tags would have special characters that caused problems
- Updated layout so that pages with disabled search wouldn't load search.js
- Cleaned up Javascript

9
docs/Gemfile Normal file
View File

@ -0,0 +1,9 @@
source 'https://rubygems.org'
# Middleman
gem 'middleman', '~>4.1.0'
gem 'middleman-syntax', '~> 3.0.0'
gem 'middleman-autoprefixer', '~> 2.7.0'
gem "middleman-sprockets", "~> 4.0.0"
gem 'rouge', '~> 2.0.5'
gem 'redcarpet', '~> 3.3.2'

122
docs/Gemfile.lock Normal file
View File

@ -0,0 +1,122 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.7.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
autoprefixer-rails (6.4.1)
execjs
backports (3.6.8)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.2)
contracts (0.13.0)
dotenv (2.1.1)
erubis (2.7.0)
execjs (2.7.0)
fast_blank (1.0.0)
fastimage (2.0.0)
addressable (~> 2)
ffi (1.9.14)
haml (4.0.7)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.4.4)
i18n (0.7.0)
json (1.8.3)
kramdown (1.12.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.15.0)
middleman (4.1.10)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.1.10)
middleman-core (= 4.1.10)
sass (>= 3.4.0, < 4.0)
middleman-autoprefixer (2.7.0)
autoprefixer-rails (>= 6.3.1, < 7.0.0)
middleman-core (>= 3.3.3)
middleman-cli (4.1.10)
thor (>= 0.17.0, < 2.0)
middleman-core (4.1.10)
activesupport (~> 4.2)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 1.1)
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.7.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 2.0)
sass (>= 3.4)
servolux
tilt (~> 1.4.1)
uglifier (~> 3.0)
middleman-sprockets (4.0.0)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.0.0)
middleman-core (>= 3.2)
rouge (~> 2.0)
minitest (5.9.0)
padrino-helpers (0.13.3.1)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.1)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.1)
activesupport (>= 3.1)
parallel (1.9.0)
rack (1.6.4)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
redcarpet (3.3.4)
rouge (2.0.5)
sass (3.4.22)
servolux (0.12.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
PLATFORMS
ruby
DEPENDENCIES
middleman (~> 4.1.0)
middleman-autoprefixer (~> 2.7.0)
middleman-sprockets (~> 4.0.0)
middleman-syntax (~> 3.0.0)
redcarpet (~> 3.3.2)
rouge (~> 2.0.5)
BUNDLED WITH
1.12.5

13
docs/LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

View File

@ -1,192 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/xlnt.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/xlnt.qhc"
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/xlnt"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/xlnt"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

110
docs/README.md Normal file
View File

@ -0,0 +1,110 @@
<p align="center">
<img src="https://raw.githubusercontent.com/lord/img/master/logo-slate.png" alt="Slate: API Documentation Generator" width="226">
<br>
<a href="https://travis-ci.org/lord/slate"><img src="https://travis-ci.org/lord/slate.svg?branch=master" alt="Build Status"></a>
</p>
<p align="center">Slate helps you create beautiful, intelligent, responsive API documentation.</p>
<p align="center"><img src="https://dl.dropboxusercontent.com/u/95847291/github%20images/slate/slate_screenshot_new.png" width=700 alt="Screenshot of Example Documentation created with Slate"></p>
<p align="center"><em>The example above was created with Slate. Check it out at <a href="https://lord.github.io/slate">lord.github.io/slate</a>.</em></p>
Features
------------
* **Clean, intuitive design** — With Slate, the description of your API is on the left side of your documentation, and all the code examples are on the right side. Inspired by [Stripe's](https://stripe.com/docs/api) and [Paypal's](https://developer.paypal.com/webapps/developer/docs/api/) API docs. Slate is responsive, so it looks great on tablets, phones, and even in print.
* **Everything on a single page** — Gone are the days when your users had to search through a million pages to find what they wanted. Slate puts the entire documentation on a single page. We haven't sacrificed linkability, though. As you scroll, your browser's hash will update to the nearest header, so linking to a particular point in the documentation is still natural and easy.
* **Slate is just Markdown** — When you write docs with Slate, you're just writing Markdown, which makes it simple to edit and understand. Everything is written in Markdown — even the code samples are just Markdown code blocks.
* **Write code samples in multiple languages** — If your API has bindings in multiple programming languages, you can easily put in tabs to switch between them. In your document, you'll distinguish different languages by specifying the language name at the top of each code block, just like with Github Flavored Markdown.
* **Out-of-the-box syntax highlighting** for [over 100 languages](https://github.com/jneen/rouge/wiki/List-of-supported-languages-and-lexers), no configuration required.
* **Automatic, smoothly scrolling table of contents** on the far left of the page. As you scroll, it displays your current position in the document. It's fast, too. We're using Slate at TripIt to build documentation for our new API, where our table of contents has over 180 entries. We've made sure that the performance remains excellent, even for larger documents.
* **Let your users update your documentation for you** — By default, your Slate-generated documentation is hosted in a public Github repository. Not only does this mean you get free hosting for your docs with Github Pages, but it also makes it simple for other developers to make pull requests to your docs if they find typos or other problems. Of course, if you don't want to use GitHub, you're also welcome to host your docs elsewhere.
Getting started with Slate is super easy! Simply fork this repository and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](http://lord.github.io/slate).
Getting Started with Slate
------------------------------
### Prerequisites
You're going to need:
- **Linux or OS X** — Windows may work, but is unsupported.
- **Ruby, version 2.2.5 or newer**
- **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal.
### Getting Set Up
1. Fork this repository on Github.
2. Clone *your forked repository* (not our original one) to your hard drive with `git clone https://github.com/YOURUSERNAME/slate.git`
3. `cd slate`
4. Initialize and start Slate. You can either do this locally, or with Vagrant:
```shell
# either run this to run locally
bundle install
bundle exec middleman server
# OR run this to run with vagrant
vagrant up
```
You can now see the docs at http://localhost:4567. Whoa! That was fast!
Now that Slate is all set up on your machine, you'll probably want to learn more about [editing Slate markdown](https://github.com/lord/slate/wiki/Markdown-Syntax), or [how to publish your docs](https://github.com/lord/slate/wiki/Deploying-Slate).
If you'd prefer to use Docker, instructions are available [in the wiki](https://github.com/lord/slate/wiki/Docker).
Companies Using Slate
---------------------------------
* [NASA](https://api.nasa.gov)
* [IBM](https://docs.cloudant.com/api.html)
* [Sony](http://developers.cimediacloud.com)
* [Mozilla](http://mozilla.github.io/localForage/)
* [Best Buy](https://bestbuyapis.github.io/api-documentation/)
* [Travis-CI](https://docs.travis-ci.com/api/)
* [Greenhouse](https://developers.greenhouse.io/harvest.html)
* [Woocommerce](http://woocommerce.github.io/woocommerce-rest-api-docs/)
* [Appium](http://appium.io/slate/en/master)
* [Dwolla](https://docs.dwolla.com/)
* [Clearbit](https://clearbit.com/docs)
* [Coinbase](https://developers.coinbase.com/api)
* [Parrot Drones](http://developer.parrot.com/docs/bebop/)
* [Fidor Bank](http://docs.fidor.de/)
You can view more in [the list on the wiki](https://github.com/lord/slate/wiki/Slate-in-the-Wild).
Need Help? Found a bug?
--------------------
[Submit an issue](https://github.com/lord/slate/issues) to the Slate Github if you need any help. And, of course, feel free to submit pull requests with bug fixes or changes.
Contributors
--------------------
Slate was built by [Robert Lord](https://lord.io) while interning at [TripIt](https://www.tripit.com/).
Thanks to the following people who have submitted major pull requests:
- [@chrissrogers](https://github.com/chrissrogers)
- [@bootstraponline](https://github.com/bootstraponline)
- [@realityking](https://github.com/realityking)
- [@cvkef](https://github.com/cvkef)
Also, thanks to [Sauce Labs](http://saucelabs.com) for helping sponsor the project.
Special Thanks
--------------------
- [Middleman](https://github.com/middleman/middleman)
- [jquery.tocify.js](https://github.com/gfranko/jquery.tocify.js)
- [middleman-syntax](https://github.com/middleman/middleman-syntax)
- [middleman-gh-pages](https://github.com/edgecase/middleman-gh-pages)
- [Font Awesome](http://fortawesome.github.io/Font-Awesome/)

39
docs/Vagrantfile vendored Normal file
View File

@ -0,0 +1,39 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 4567, host: 4567
config.vm.provision "bootstrap",
type: "shell",
inline: <<-SHELL
sudo apt-get update
sudo apt-get install -yq ruby2.0 ruby2.0-dev pkg-config build-essential nodejs git libxml2-dev libxslt-dev
sudo apt-get autoremove -yq
gem2.0 install --no-ri --no-rdoc bundler
SHELL
# add the local user git config to the vm
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
config.vm.provision "install",
type: "shell",
privileged: false,
inline: <<-SHELL
echo "=============================================="
echo "Installing app dependencies"
cd /vagrant
bundle config build.nokogiri --use-system-libraries
bundle install
SHELL
config.vm.provision "run",
type: "shell",
privileged: false,
run: "always",
inline: <<-SHELL
echo "=============================================="
echo "Starting up middleman at http://localhost:4567"
echo "If it does not come up, check the ~/middleman.log file for any error messages"
cd /vagrant
bundle exec middleman server --watcher-force-polling --watcher_latency=1 &> ~/middleman.log &
SHELL
end

View File

@ -1,30 +0,0 @@
Cell Module
===========
.. doxygenstruct:: xlnt::cell_reference_hash
:members:
.. doxygenclass:: xlnt::cell_reference
:members:
.. doxygenenum:: xlnt::cell_type
.. doxygenclass:: xlnt::cell
:members:
.. doxygenclass:: xlnt::comment
:members:
.. doxygentypedef:: xlnt::row_t
.. doxygenclass:: xlnt::column_t
:members:
.. doxygenstruct:: xlnt::column_hash
:members:
.. doxygenclass:: xlnt::formatted_text
:members:
.. doxygenclass:: xlnt::text_run
:members:

View File

@ -1,11 +0,0 @@
Packaging Module
================
.. doxygenclass:: xlnt::manifest
:members:
.. doxygenclass:: xlnt::relationship
:members:
.. doxygenclass:: xlnt::uri
:members:

View File

@ -1,11 +0,0 @@
Library Modules
===============
.. toctree::
xlnt.cell
xlnt.packaging
xlnt.styles
xlnt.utils
xlnt.workbook
xlnt.worksheet

View File

@ -1,37 +0,0 @@
Styles Module
=============
.. doxygenclass:: xlnt::alignment
:members:
.. doxygenenum:: xlnt::border_style
.. doxygenclass:: xlnt::border
:members:
.. doxygenclass:: xlnt::color
:members:
.. doxygenenum:: xlnt::diagonal_direction
.. doxygenclass:: xlnt::fill
:members:
.. doxygenclass:: xlnt::font
:members:
.. doxygenclass:: xlnt::format
:members:
.. doxygenenum:: xlnt::horizontal_alignment
.. doxygenclass:: xlnt::number_format
:members:
.. doxygenclass:: xlnt::protection
:members:
.. doxygenclass:: xlnt::style
:members:
.. doxygenenum:: xlnt::vertical_alignment

View File

@ -1,68 +0,0 @@
Utilities Module
================
.. doxygenclass:: xlnt::exception
:members:
.. doxygenclass:: xlnt::invalid_parameter
:members:
.. doxygenclass:: xlnt::invalid_sheet_title
:members:
.. doxygenclass:: xlnt::missing_number_format
:members:
.. doxygenclass:: xlnt::invalid_file
:members:
.. doxygenclass:: xlnt::illegal_character
:members:
.. doxygenclass:: xlnt::invalid_data_type
:members:
.. doxygenclass:: xlnt::invalid_column_string_index
:members:
.. doxygenclass:: xlnt::invalid_cell_reference
:members:
.. doxygenclass:: xlnt::invalid_attribute
:members:
.. doxygenclass:: xlnt::key_not_found
:members:
.. doxygenclass:: xlnt::no_visible_worksheets
:members:
.. doxygenclass:: xlnt::unhandled_switch_case
:members:
.. doxygenclass:: xlnt::unsupported
:members:
.. doxygenenum:: xlnt::calendar
.. doxygenstruct:: xlnt::date
:members:
.. doxygenstruct:: xlnt::datetime
:members:
.. doxygenstruct:: xlnt::time
:members:
.. doxygenstruct:: xlnt::timedelta
:members:
.. doxygenclass:: xlnt::utf8string
:members:
.. doxygenclass:: xlnt::optional
:members:
.. doxygenclass:: xlnt::path
:members:

View File

@ -1,23 +0,0 @@
Workbook Module
===============
.. doxygenclass:: xlnt::const_worksheet_iterator
:members:
.. doxygenclass:: xlnt::document_security
:members:
.. doxygenclass:: xlnt::external_book
:members:
.. doxygenclass:: xlnt::named_range
:members:
.. doxygenclass:: xlnt::theme
:members:
.. doxygenclass:: xlnt::workbook
:members:
.. doxygenclass:: xlnt::worksheet_iterator
:members:

View File

@ -1,72 +0,0 @@
Worksheet Module
================
.. doxygenclass:: xlnt::cell_vector
:members:
.. doxygenclass:: xlnt::cell_iterator
:members:
.. doxygenclass:: xlnt::column_properties
:members:
.. doxygenclass:: xlnt::const_cell_iterator
:members:
.. doxygenclass:: xlnt::const_range_iterator
:members:
.. doxygenclass:: xlnt::footer
:members:
.. doxygenclass:: xlnt::header_footer
:members:
.. doxygenclass:: xlnt::header
:members:
.. doxygenenum:: xlnt::major_order
.. doxygenenum:: xlnt::orientation
.. doxygenenum:: xlnt::page_break
.. doxygenclass:: xlnt::page_margins
:members:
.. doxygenstruct:: xlnt::page_setup
:members:
.. doxygenclass:: xlnt::pane
:members:
.. doxygenenum:: xlnt::paper_size
.. doxygenclass:: xlnt::range_iterator
:members:
.. doxygenclass:: xlnt::range_reference
:members:
.. doxygenclass:: xlnt::range
:members:
.. doxygenclass:: xlnt::row_properties
:members:
.. doxygenclass:: xlnt::selection
:members:
.. doxygenclass:: xlnt::sheet_protection
:members:
.. doxygenenum:: xlnt::sheet_state
.. doxygenclass:: xlnt::sheet_view
:members:
.. doxygenclass:: xlnt::worksheet_properties
:members:
.. doxygenclass:: xlnt::worksheet
:members:

View File

@ -1,4 +0,0 @@
0.9.0 (unreleased)
==================
Beta release

View File

@ -1,4 +0,0 @@
Charts
======
Charts aren't supported yet.

View File

@ -1,36 +0,0 @@
Comments
========
Adding a comment to a cell
--------------------------
Comments have a text attribute and an author attribute, which must both be set.
.. code-block:: cpp
xlnt::workbook workbook;
auto worksheet = workbook.get_active_sheet();
auto comment = worksheet.get_cell("A1").get_comment();
comment = xlnt::comment("This is the comment text", "Comment Author");
std::cout << comment.get_text() << std::endl;
std::cout << comment.get_author() << std::endl;
You cannot assign the same Comment object to two different cells. Doing so
raises an xlnt::attribute_error.
.. code-block:: cpp
xlnt::workbook workbook;
auto worksheet = workbook.get_active_sheet();
xlnt::comment comment("Text", "Author");
worksheet.get_cell("A1").set_comment(comment);
worksheet.get_cell("B1").set_comment(comment);
// prints: terminate called after throwing an instance of 'xlnt::attribute_error'
Loading and saving comments
----------------------------
Comments present in a workbook when loaded are stored in the comment
attribute of their respective cells automatically. Comments remaining in a workbook when it is saved are automatically saved to
the workbook file.

View File

@ -1,300 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# xlnt documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 26 10:31:07 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
from subprocess import call
call('doxygen Doxyfile', shell=True)
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'breathe'
]
# Breathe extension variables
breathe_projects = { "xlnt" : "doxyxml/" }
breathe_default_project = "xlnt"
breathe_doxygen_config_options = {'EXCLUDE_SYMBOLS': 'XLNT_API'}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'xlnt'
copyright = '2015, Thomas Fussell'
author = 'Thomas Fussell'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.9'
# The full version, including alpha/beta/rc tags.
release = '0.9'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'xlntdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'xlnt.tex', 'xlnt Documentation',
'Thomas Fussell', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'xlnt', 'xlnt Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'xlnt', 'xlnt Documentation',
author, 'xlnt', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

46
docs/config.rb Normal file
View File

@ -0,0 +1,46 @@
# Markdown
set :markdown_engine, :redcarpet
set :markdown,
fenced_code_blocks: true,
smartypants: true,
disable_indented_code_blocks: true,
prettify: true,
tables: true,
with_toc_data: true,
no_intra_emphasis: true
# Assets
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
# Activate the syntax highlighter
activate :syntax
activate :sprockets
activate :autoprefixer do |config|
config.browsers = ['last 2 version', 'Firefox ESR']
config.cascade = false
config.inline = true
end
# Github pages require relative links
activate :relative_assets
set :relative_links, true
# Build Configuration
configure :build do
# If you're having trouble with Middleman hanging, commenting
# out the following two lines has been known to help
activate :minify_css
activate :minify_javascript
# activate :relative_assets
# activate :asset_hash
# activate :gzip
end
# Deploy Configuration
# If you want Middleman to listen on a different port, you can set that below
set :port, 4567

View File

@ -1,204 +0,0 @@
Simple usage
============
Write a workbook
----------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
std::string dest_filename = "empty_book.xlsx";
auto ws1 = wb.get_active_sheet();
ws1.set_title("range names");
for(xlnt::row_t row = 1; row < 40; row++)
{
std::vector<int> to_append(600, 0);
std::iota(std::begin(to_append), std::end(to_append), 0);
ws1.append(to_append);
}
auto ws2 = wb.create_sheet("Pi");
ws2.get_cell("F5").set_value(3.14);
for(xlnt::row_t row = 10; row < 20; row++)
{
for(xlnt::column_t column = 27; column < 54; column++)
{
ws3.get_cell(column, row).set_value(column.column_string());
}
}
std::cout << ws3.get_cell("AA10") << std::endl;
wb.save(dest_filename);
return 0;
}
Read an existing workbook
-------------------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
wb.load("empty_book.xlsx");
auto sheet_ranges = wb.get_range("range names");
std::cout << sheet_ranges["D18"] << std::endl;
// prints: 3
return 0;
}
.. note ::
There are several optional parameters that can be used in xlnt::workbook::load (in order):
- `guess_types` will enable or disable (default) type inference when
reading cells.
- `data_only` controls whether cells with formulae have either the
formula (default) or the value stored the last time Excel read the sheet.
- `keep_vba` controls whether any Visual Basic elements are preserved or
not (default). If they are preserved they are still not editable.
.. warning ::
xlnt does currently not read all possible items in an Excel file so
images and charts will be lost from existing files if they are opened and
saved with the same name.
Using number formats
--------------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
wb.guess_types(true);
auto ws = wb.get_active_sheet();
ws.get_cell("A1").set_value(xlnt::datetime(2010, 7, 21));
std::cout << ws.get_cell("A1").get_number_format().get_format_string() << std::endl
// prints: yyyy-mm-dd h:mm:ss
// set percentage using a string followed by the percent sign
ws.get_cell("B1").set_value("3.14%");
std::cout << cell.get_value<long double>() << std::endl;
// prints: 0.031400000000000004
std::cout << cell << std::endl;
// prints: 3.14%
std::cout << cell.get_number_format().get_format_string() << std::endl;
// prints: 0%
return 0;
}
Using formulae
--------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
auto ws = wb.get_active_sheet();
ws.get_cell("A1").set_formula("=SUM(1, 1)");
wb.save("formula.xlsx");
}
.. warning::
NB you must use the English name for a function and function arguments *must* be separated by commas and not other punctuation such as semi-colons.
xlsx never evaluates formula but it is possible to check the name of a formula:
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
bool found = xlnt::formulae::exists("HEX2DEC");
std::cout << (found ? "True" : "False") << std::endl;
// prints: True
return 0;
}
If you're trying to use a formula that isn't known this could be because you're using a formula that was not included in the initial specification. Such formulae must be prefixed with `xlfn.` to work.
Merge / Unmerge cells
---------------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
auto ws = wb.get_active_sheet();
ws.merge_cells("A1:B1");
ws.unmerge_cells("A1:B1");
// or
ws.merge_cells(1, 2, 4, 2)
ws.unmerge_cells(1, 2, 4, 2);
return 0;
}
Inserting an image
-------------------
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
auto ws = wb.get_active_sheet();
ws.get_cell("A1").set_value("You should see three logos below");
// create an image
auto img = xlnt::image("logo.png");
// add to worksheet and anchor next to cells
ws.add_image(img, "A1");
wb.save("logo.xlsx");
return 0;
}
Fold columns (outline)
----------------------
.. code-block:: cpp
int main()
{
xlnt::workbook wb;
auto ws = wb.create_sheet();
bool hidden = true;
ws.group_columns("A", "D", hidden);
wb.save("group.xlsx");
return 0;
}

203
docs/deploy.sh Executable file
View File

@ -0,0 +1,203 @@
#!/usr/bin/env bash
set -o errexit #abort if any command fails
me=$(basename "$0")
help_message="\
Usage: $me [-c FILE] [<options>]
Deploy generated files to a git branch.
Options:
-h, --help Show this help information.
-v, --verbose Increase verbosity. Useful for debugging.
-e, --allow-empty Allow deployment of an empty directory.
-m, --message MESSAGE Specify the message used when committing on the
deploy branch.
-n, --no-hash Don't append the source commit's hash to the deploy
commit's message.
"
bundle exec middleman build --clean
parse_args() {
# Set args from a local environment file.
if [ -e ".env" ]; then
source .env
fi
# Parse arg flags
# If something is exposed as an environment variable, set/overwrite it
# here. Otherwise, set/overwrite the internal variable instead.
while : ; do
if [[ $1 = "-h" || $1 = "--help" ]]; then
echo "$help_message"
return 0
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
verbose=true
shift
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
allow_empty=true
shift
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
commit_message=$2
shift 2
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
GIT_DEPLOY_APPEND_HASH=false
shift
else
break
fi
done
# Set internal option vars from the environment and arg flags. All internal
# vars should be declared here, with sane defaults if applicable.
# Source directory & target branch.
deploy_directory=build
deploy_branch=gh-pages
#if no user identity is already set in the current git environment, use this:
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
default_email=${GIT_DEPLOY_EMAIL:-}
#repository to deploy to. must be readable and writable.
repo=origin
#append commit hash to the end of message by default
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
}
main() {
parse_args "$@"
enable_expanded_output
if ! git diff --exit-code --quiet --cached; then
echo Aborting due to uncommitted changes in the index >&2
return 1
fi
commit_title=`git log -n 1 --format="%s" HEAD`
commit_hash=` git log -n 1 --format="%H" HEAD`
#default commit message uses last title if a custom one is not supplied
if [[ -z $commit_message ]]; then
commit_message="publish: $commit_title"
fi
#append hash to commit message unless no hash flag was found
if [ $append_hash = true ]; then
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
fi
previous_branch=`git rev-parse --abbrev-ref HEAD`
if [ ! -d "$deploy_directory" ]; then
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
return 1
fi
# must use short form of flag in ls for compatibility with OS X and BSD
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
return 1
fi
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
# deploy_branch exists in $repo; make sure we have the latest version
disable_expanded_output
git fetch --force $repo $deploy_branch:$deploy_branch
enable_expanded_output
fi
# check if deploy_branch exists locally
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
then incremental_deploy
else initial_deploy
fi
restore_head
}
initial_deploy() {
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
git --work-tree "$deploy_directory" add --all
commit+push
}
incremental_deploy() {
#make deploy_branch the current branch
git symbolic-ref HEAD refs/heads/$deploy_branch
#put the previously committed contents of deploy_branch into the index
git --work-tree "$deploy_directory" reset --mixed --quiet
git --work-tree "$deploy_directory" add --all
set +o errexit
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
set -o errexit
case $diff in
0) echo No changes to files in $deploy_directory. Skipping commit.;;
1) commit+push;;
*)
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2
return $diff
;;
esac
}
commit+push() {
set_user_id
git --work-tree "$deploy_directory" commit -m "$commit_message"
disable_expanded_output
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
git push --quiet $repo $deploy_branch
enable_expanded_output
}
#echo expanded commands as they are executed (for debugging)
enable_expanded_output() {
if [ $verbose ]; then
set -o xtrace
set +o verbose
fi
}
#this is used to avoid outputting the repo URL, which may contain a secret token
disable_expanded_output() {
if [ $verbose ]; then
set +o xtrace
set -o verbose
fi
}
set_user_id() {
if [[ -z `git config user.name` ]]; then
git config user.name "$default_username"
fi
if [[ -z `git config user.email` ]]; then
git config user.email "$default_email"
fi
}
restore_head() {
if [[ $previous_branch = "HEAD" ]]; then
#we weren't on any branch before, so just set HEAD back to the commit it was on
git update-ref --no-deref HEAD $commit_hash $deploy_branch
else
git symbolic-ref HEAD refs/heads/$previous_branch
fi
git reset --mixed
}
filter() {
sed -e "s|$repo|\$repo|g"
}
sanitize() {
"$@" 2> >(filter 1>&2) | filter
}
[[ $1 = --source-only ]] || main "$@"

View File

@ -1,50 +0,0 @@
Development
===========
What is suppoprted
------------------
Supporting different platforms
------------------------------
Coding style
------------
Testing
-------
Coverage
++++++++
Organisation
++++++++++++
Checking XML
++++++++++++
Schema validation
+++++++++++++++++
Microsoft Tools
+++++++++++++++
Contributing
------------
Contributions in the form of pull requests are always welcome. Don't forget
to add yourself to the list of authors!
Branch naming convention
------------------------
Pull Requests
-------------
Documentation
+++++++++++++
Benchmarking
------------
Memory Use
++++++++++

148
docs/font-selection.json Executable file
View File

@ -0,0 +1,148 @@
{
"IcoMoonType": "selection",
"icons": [
{
"icon": {
"paths": [
"M438.857 73.143q119.429 0 220.286 58.857t159.714 159.714 58.857 220.286-58.857 220.286-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857zM512 785.714v-108.571q0-8-5.143-13.429t-12.571-5.429h-109.714q-7.429 0-13.143 5.714t-5.714 13.143v108.571q0 7.429 5.714 13.143t13.143 5.714h109.714q7.429 0 12.571-5.429t5.143-13.429zM510.857 589.143l10.286-354.857q0-6.857-5.714-10.286-5.714-4.571-13.714-4.571h-125.714q-8 0-13.714 4.571-5.714 3.429-5.714 10.286l9.714 354.857q0 5.714 5.714 10t13.714 4.286h105.714q8 0 13.429-4.286t6-10z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"exclamation-circle"
],
"defaultCode": 61546,
"grid": 14
},
"attrs": [],
"properties": {
"id": 100,
"order": 4,
"prevSize": 28,
"code": 58880,
"name": "exclamation-sign",
"ligatures": ""
},
"setIdx": 0,
"iconIdx": 0
},
{
"icon": {
"paths": [
"M585.143 786.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-54.857v-292.571q0-8-5.143-13.143t-13.143-5.143h-182.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h54.857v182.857h-54.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h256q8 0 13.143-5.143t5.143-13.143zM512 274.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-109.714q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h109.714q8 0 13.143-5.143t5.143-13.143zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"info-circle"
],
"defaultCode": 61530,
"grid": 14
},
"attrs": [],
"properties": {
"id": 85,
"order": 3,
"name": "info-sign",
"prevSize": 28,
"code": 58882
},
"setIdx": 0,
"iconIdx": 2
},
{
"icon": {
"paths": [
"M733.714 419.429q0-16-10.286-26.286l-52-51.429q-10.857-10.857-25.714-10.857t-25.714 10.857l-233.143 232.571-129.143-129.143q-10.857-10.857-25.714-10.857t-25.714 10.857l-52 51.429q-10.286 10.286-10.286 26.286 0 15.429 10.286 25.714l206.857 206.857q10.857 10.857 25.714 10.857 15.429 0 26.286-10.857l310.286-310.286q10.286-10.286 10.286-25.714zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"check-circle"
],
"defaultCode": 61528,
"grid": 14
},
"attrs": [],
"properties": {
"id": 83,
"order": 9,
"prevSize": 28,
"code": 58886,
"name": "ok-sign"
},
"setIdx": 0,
"iconIdx": 6
},
{
"icon": {
"paths": [
"M658.286 475.429q0-105.714-75.143-180.857t-180.857-75.143-180.857 75.143-75.143 180.857 75.143 180.857 180.857 75.143 180.857-75.143 75.143-180.857zM950.857 950.857q0 29.714-21.714 51.429t-51.429 21.714q-30.857 0-51.429-21.714l-196-195.429q-102.286 70.857-228 70.857-81.714 0-156.286-31.714t-128.571-85.714-85.714-128.571-31.714-156.286 31.714-156.286 85.714-128.571 128.571-85.714 156.286-31.714 156.286 31.714 128.571 85.714 85.714 128.571 31.714 156.286q0 125.714-70.857 228l196 196q21.143 21.143 21.143 51.429z"
],
"width": 951,
"attrs": [],
"isMulticolor": false,
"tags": [
"search"
],
"defaultCode": 61442,
"grid": 14
},
"attrs": [],
"properties": {
"id": 2,
"order": 1,
"prevSize": 28,
"code": 58887,
"name": "icon-search"
},
"setIdx": 0,
"iconIdx": 7
}
],
"height": 1024,
"metadata": {
"name": "slate",
"license": "SIL OFL 1.1"
},
"preferences": {
"showGlyphs": true,
"showQuickUse": true,
"showQuickUse2": true,
"showSVGs": true,
"fontPref": {
"prefix": "icon-",
"metadata": {
"fontFamily": "slate",
"majorVersion": 1,
"minorVersion": 0,
"description": "Based on FontAwesome",
"license": "SIL OFL 1.1"
},
"metrics": {
"emSize": 1024,
"baseline": 6.25,
"whitespace": 50
},
"resetPoint": 58880,
"showSelector": false,
"selector": "class",
"classSelector": ".icon",
"showMetrics": false,
"showMetadata": true,
"showVersion": true,
"ie7": false
},
"imagePref": {
"prefix": "icon-",
"png": true,
"useClassSelector": true,
"color": 4473924,
"bgColor": 16777215
},
"historySize": 100,
"showCodes": true,
"gridSize": 16,
"showLiga": false
}
}

View File

@ -1,4 +0,0 @@
Conditional Formatting
======================
Not supported yet.

View File

@ -1,106 +0,0 @@
Parsing Formulas
================
`xlnt` supports limited parsing of formulas embedded in cells. The
`xlnt/formula` module contains a `tokenizer` class to break
formulas into their consitutuent tokens. Usage is as follows:
.. code-block:: cpp
#include <xlnt/xlnt.hpp>
int main()
{
std::string formula = R"(=IF($A$1,"then True",MAX(DEFAULT_VAL,'Sheet 2'!B1)))";
xlnt::tokenizer tok(formula);
tok.parse();
for(auto &t : tok.get_items())
{
std::cout << t.get_value() << "\t" << t.get_type() << "\t" << t.get_subtype() << std::endl;
}
// prints:
//
// IF( FUNC OPEN
// $A$1 OPERAND RANGE
// , SEP ARG
// "then True" OPERAND TEXT
// , SEP ARG
// MAX( FUNC OPEN
// DEFAULT_VAL OPERAND RANGE
// , SEP ARG
// 'Sheet 2'!B1 OPERAND RANGE
// ) FUNC CLOSE
// ) FUNC CLOSE
return 0;
}
As shown above, tokens have three attributes of interest:
* ``.value``: The substring of the formula that produced this token
* ``.type``: The type of token this represents. Can be one of
- ``token::literal``: If the cell does not contain a formula, its
value is represented by a single ``LITERAL`` token.
- ``token::operand``: A generic term for any value in the Excel
formula. (See ``.subtype`` below for more details).
- ``token::func``: Function calls are broken up into tokens for the
opener (e.g., ``SUM(``), followed by the arguments, followed by
the closer (i.e., ``)``). The function name and opening
parenthesis together form one ``FUNC`` token, and the matching
parenthesis forms another ``FUNC`` token.
- ``token::array``: Array literals (enclosed between curly braces)
get two ``ARRAY`` tokens each, one for the opening ``{`` and one
for the closing ``}``.
- ``token::paren``: When used for grouping subexpressions (and not to
denote function calls), parentheses are tokenized as ``paren``
tokens (one per character).
- ``token::sep``: These tokens are created from either commas (``,``)
or semicolons (``;``). Commas create ``sep`` tokens when they are
used to separate function arguments (e.g., ``SUM(a,b)``) or when
they are used to separate array elements (e.g., ``{a,b}``). (They
have another use as an infix operator for joining
ranges). Semicolons are always used to separate rows in an array
literal, so always create ``sep`` tokens.
- ``token::op_pre``: Designates a prefix unary operator. Its value is
always ``+`` or ``-``
- ``token::op_in``: Designates an infix binary operator. Possible
values are ``>=``, ``<=``, ``<>``, ``=``, ``>``, ``<``, ``*``,
``/``, ``+``, ``-``, ``^``, or ``&``.
- ``token::op_post``: Designates a postfix unary operator. Its value
is always ``%``.
- ``token::wspace``: Created for any whitespace encountered. Its
value is always a single space, regardless of how much whitespace
is found.
* ``.subtype``: Some of the token types above use the subtype to
provide additional information about the token. Possible subtypes
are:
+ ``token::text``, ``token::number``, ``token::logical``,
``token::error``, ``token::range``: these subtypes describe the
various forms of ``operand`` found in formulae. ``logical`` is
either ``true`` or ``false``, ``range`` is either a named range or
a direct reference to another range. ``text``, ``number``, and
``error`` all refer to literal values in the formula
+ ``token::open`` and ``token::close``: these two subtypes are used by
``paren``, ``func``, and ``array``, to describe whether the token
is opening a new subexpression or closing it.
+ ``token::arg`` and ``token::row``: are used by the ``sep`` tokens,
to distinguish between the comma and semicolon. Commas produce
tokens of subtype ``arg`` whereas semicolons produce tokens of
subtype ``row``

100
docs/generate-md.js Normal file
View File

@ -0,0 +1,100 @@
var xpath = require('xpath');
var dom = require('xmldom').DOMParser;
var fs = require('fs');
var _ = require('underscore');
var async = require('async');
function generate(directory, primary_callback) {
var modules = [];
return fs.readFile(directory + 'index.xml', 'utf8', (err, xml) => {
if (err) throw err;
var doc = new dom().parseFromString(xml);
var nodes = xpath.select('/doxygenindex/compound[@kind="dir"]', doc);
for (var i = 0; i < nodes.length; i++) {
var refid = nodes[i].getAttribute('refid');
var name = nodes[i].firstChild.firstChild.toString();
modules.push({name: name, refid: refid});
}
const root_module = _.find(modules, (module) => {
return _.last(module.name.split('/')) == 'xlnt';
});
const root_name = root_module.name;
modules = _.filter(modules, (module) => {
return module.name.indexOf(root_name) >= 0 && module.name !== root_name;
});
return async.mapSeries(modules, (module, module_callback) => {
return fs.readFile(directory + module.refid + '.xml', 'utf8', (err, xml) => {
if (err) throw err;
var doc = new dom().parseFromString(xml);
var nodes = xpath.select('/doxygen/compounddef/innerfile', doc);
module.source_files = [];
for (var i = 0; i < nodes.length; i++) {
var refid = nodes[i].getAttribute('refid');
var name = nodes[i].firstChild.toString();
module.source_files.push({name: name, refid: refid});
}
return async.map(module.source_files, (source_file, source_file_callback) => {
return fs.readFile(directory + source_file.refid + '.xml', 'utf8', (err, xml) => {
if (err) throw err;
var doc = new dom().parseFromString(xml);
var nodes = xpath.select('/doxygen/compounddef/innerclass', doc);
module.class_files = [];
for (var i = 0; i < nodes.length; i++) {
var refid = nodes[i].getAttribute('refid');
var name = nodes[i].firstChild.toString();
module.class_files.push({name: name, refid: refid});
}
return async.map(module.class_files, (class_file, class_file_callback) => {
return fs.readFile(directory + class_file.refid + '.xml', 'utf8', (err, xml) => {
if (err) throw err;
var doc = new dom().parseFromString(xml);
var nodes = xpath.select('/doxygen/compounddef/sectiondef/memberdef[@prot="public"]', doc);
var members = [];
for (var i = 0; i < nodes.length; i++) {
var member_data = {id: nodes[i].getAttribute('id')};
var child = nodes[i].firstChild;
while (child != nodes[i].lastChild) {
if (child.textContent.trim()) {
member_data[child.nodeName] = child.textContent.trim();
}
child = child.nextSibling;
}
members.push(member_data);
}
class_file.members = members;
return class_file_callback(null, class_file);
});
}, (err, data) => {
return source_file_callback(null, _.flatten(data, true));
});
});
}, (err, data) => {
module.classes = _.flatten(data, true);
return module_callback(null, module);
});
});
}, (err, data) => {
return primary_callback(null, _.flatten(data, true));
});
});
}
generate('doxyxml/', function(err, data) {
console.log('# API Reference');
for (var i = 0; i < data.length; i++) {
var module = data[i];
var module_name = _.last(module.name.split('/'));
console.log('##', module_name.charAt(0).toUpperCase() + module_name.slice(1), 'Module');
for (var j = 0; j < module.classes.length; j++) {
var class_ = module.classes[j];
console.log('###', _.last(class_.name.split('::')));
for (var k = 0; k < class_.members.length; k++) {
var member = class_.members[k];
console.log('####', '```' + member.definition + '```');
if (member.briefdescription) {
console.log(member.briefdescription);
}
}
}
}
});

View File

@ -1,232 +0,0 @@
:mod:`xlnt` - user-friendly xlsx library for C++14
===========================================================================
.. module:: xlnt
.. moduleauthor:: Thomas Fussell
:Author: Thomas Fussell
:Source code: https://github.com/tfussell/xlnt
:Issues: https://github.com/tfussell/xlnt/issues
:Generated: |today|
:License: MIT
:Version: |release|
Introduction
------------
xlnt is a C++14 library for reading, writing, and modifying XLSX files as described in [ECMA 376](http://www.ecma-international.org/publications/standards/Ecma-376.htm). The API is based on [openpyxl](https://bitbucket.org/openpyxl/openpyxl), a Python library to read/write Excel 2007 xlsx/xlsm files, and ultimately on [PHPExcel](https://github.com/PHPOffice/PHPExcel), pure PHP library for reading and writing spreadsheet files upon which openpyxl was based. This project is still very much a work in progress, but the core development work is complete.
Summary of Features
+++++++++++++++++++
+---------------------------------------------------------------------+------+------+-------+
| Feature | Read | Edit | Write |
+=====================================================================+======+======+=======+
| Excel-style Workbook | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| LibreOffice-style Workbook | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Numbers-style Workbook | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Encrypted Workbook (Excel 2007-2010) | ✓ | ✓ | |
+---------------------------------------------------------------------+------+------+-------+
| Encrypted Workbook (Excel 2013-2016) | ✓ | ✓ | |
+---------------------------------------------------------------------+------+------+-------+
| Excel Binary Workbook (.xlsb) | | | |
+---------------------------------------------------------------------+------+------+-------+
| Excel Macro-Enabled Workbook (.xlsm) | | | |
+---------------------------------------------------------------------+------+------+-------+
| Excel Macro-Enabled Template (.xltm) | | | |
+---------------------------------------------------------------------+------+------+-------+
| Document Properties | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Numeric Cell Values | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Inline String Cell Values | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Shared String Cell Values | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Shared String Text Run Formatting (e.g. varied fonts within a cell) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Hyperlink Cell Values | | | |
+---------------------------------------------------------------------+------+------+-------+
| Formula Cell Values | | | |
+---------------------------------------------------------------------+------+------+-------+
| Formula Evaluation | | | |
+---------------------------------------------------------------------+------+------+-------+
| Page Margins | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Page Setup | | | |
+---------------------------------------------------------------------+------+------+-------+
| Print Area | | | |
+---------------------------------------------------------------------+------+------+-------+
| Comments | ✓ | ✓ | |
+---------------------------------------------------------------------+------+------+-------+
| Header and Footer | | | |
+---------------------------------------------------------------------+------+------+-------+
| Custom Views | | | |
+---------------------------------------------------------------------+------+------+-------+
| Charts | | | |
+---------------------------------------------------------------------+------+------+-------+
| Chartsheets | | | |
+---------------------------------------------------------------------+------+------+-------+
| Dialogsheets | | | |
+---------------------------------------------------------------------+------+------+-------+
| Themes | ✓ | | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Cell Styles | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Cell Formats | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Alignment (e.g. right align) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Border (e.g. red cell outline) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Fill (e.g. green cell background) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Font (e.g. blue cell text) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Number Format (e.g. show 2 decimals) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Formatting->Protection (e.g. hide formulas) | ✓ | ✓ | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Column Styles | | | |
+---------------------------------------------------------------------+------+------+-------+
| Row Styles | | | |
+---------------------------------------------------------------------+------+------+-------+
| Sheet Styles | | | |
+---------------------------------------------------------------------+------+------+-------+
| Conditional Formatting | | | |
+---------------------------------------------------------------------+------+------+-------+
| Tables | | | |
+---------------------------------------------------------------------+------+------+-------+
| Table Formatting | | | |
+---------------------------------------------------------------------+------+------+-------+
| Pivot Tables | | | |
+---------------------------------------------------------------------+------+------+-------+
| XLSX Thumbnail | ✓ | | ✓ |
+---------------------------------------------------------------------+------+------+-------+
| Custom OOXML Properties | | | |
+---------------------------------------------------------------------+------+------+-------+
| Custom OOXML Parts | | | |
+---------------------------------------------------------------------+------+------+-------+
| Drawing | | | |
+---------------------------------------------------------------------+------+------+-------+
| Text Box | | | |
+---------------------------------------------------------------------+------+------+-------+
| WordArt | | | |
+---------------------------------------------------------------------+------+------+-------+
| Embedded Content (e.g. images) | | | |
+---------------------------------------------------------------------+------+------+-------+
| Excel VBA | | | |
+---------------------------------------------------------------------+------+------+-------+
Sample code:
++++++++++++
.. literalinclude:: ../samples/sample.cpp
How to Contribute Code
----------------------
See `Information For Developers`_
Installation
------------
Getting the source
------------------
Usage examples
--------------
Tutorial
++++++++
.. toctree::
tutorial
Cookbook
++++++++
.. toctree::
cookbook
Charts
++++++
.. toctree::
charts/introduction
Comments
++++++++
.. toctree::
comments
Working with styles
+++++++++++++++++++
.. toctree::
styles
Conditional Formatting
++++++++++++++++++++++
.. toctree::
formatting
Data Validation
+++++++++++++++
.. toctree::
validation
Parsing Formulas
++++++++++++++++
.. toctree::
formula
Information for Developers
--------------------------
.. toctree::
development
windows-development
API Documentation
------------------
.. toctree::
:maxdepth: 2
api/xlnt
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Release Notes
=============
.. toctree::
:maxdepth: 1
changes

View File

@ -1,263 +0,0 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\xlnt.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\xlnt.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

View File

@ -1 +0,0 @@
breathe

BIN
docs/source/fonts/slate.eot Executable file

Binary file not shown.

14
docs/source/fonts/slate.svg Executable file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="slate" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" d="" horiz-adv-x="512" />
<glyph unicode="&#xe600;" d="M438.857 877.714q119.429 0 220.286-58.857t159.714-159.714 58.857-220.286-58.857-220.286-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857zM512 165.143v108.571q0 8-5.143 13.429t-12.571 5.429h-109.714q-7.429 0-13.143-5.714t-5.714-13.143v-108.571q0-7.429 5.714-13.143t13.143-5.714h109.714q7.429 0 12.571 5.429t5.143 13.429zM510.857 361.714l10.286 354.857q0 6.857-5.714 10.286-5.714 4.571-13.714 4.571h-125.714q-8 0-13.714-4.571-5.714-3.429-5.714-10.286l9.714-354.857q0-5.714 5.714-10t13.714-4.286h105.714q8 0 13.429 4.286t6 10z" />
<glyph unicode="&#xe602;" d="M585.143 164.571v91.429q0 8-5.143 13.143t-13.143 5.143h-54.857v292.571q0 8-5.143 13.143t-13.143 5.143h-182.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h54.857v-182.857h-54.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h256q8 0 13.143 5.143t5.143 13.143zM512 676.571v91.429q0 8-5.143 13.143t-13.143 5.143h-109.714q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="&#xe606;" d="M733.714 531.428q0 16-10.286 26.286l-52 51.429q-10.857 10.857-25.714 10.857t-25.714-10.857l-233.143-232.571-129.143 129.143q-10.857 10.857-25.714 10.857t-25.714-10.857l-52-51.429q-10.286-10.286-10.286-26.286 0-15.429 10.286-25.714l206.857-206.857q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l310.286 310.286q10.286 10.286 10.286 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="&#xe607;" d="M658.286 475.428q0 105.714-75.143 180.857t-180.857 75.143-180.857-75.143-75.143-180.857 75.143-180.857 180.857-75.143 180.857 75.143 75.143 180.857zM950.857 0q0-29.714-21.714-51.429t-51.429-21.714q-30.857 0-51.429 21.714l-196 195.429q-102.286-70.857-228-70.857-81.714 0-156.286 31.714t-128.571 85.714-85.714 128.571-31.714 156.286 31.714 156.286 85.714 128.571 128.571 85.714 156.286 31.714 156.286-31.714 128.571-85.714 85.714-128.571 31.714-156.286q0-125.714-70.857-228l196-196q21.143-21.143 21.143-51.429z" horiz-adv-x="951" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
docs/source/fonts/slate.ttf Executable file

Binary file not shown.

BIN
docs/source/fonts/slate.woff Executable file

Binary file not shown.

BIN
docs/source/fonts/slate.woff2 Executable file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
docs/source/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# Contributing to xlnt
xlnt welcomes contributions from everyone regardless of skill level (provided you can write C++ or documentation).
## Getting Started
Look through the list of issues to find something interesting to work on. Help is appreciated with any issues, but important timely issues are labeled as "help wanted". Issues labeled "docs" might be good for those who want to contribute without having to know too much C++. You might also find something that the code is missing without an associated issue. That's fine to work on to, but it might be best to make an issue first in case someone else is working on it.
## Contributions
Contributions to xlnt should be made in the form of pull requests on GitHub. Each pull request will be reviewed and either merged into the current development branch or given feedback for changes that would be required to do so.
All code in this repository is under the MIT License. You should agree to these terms before submitting any code to xlnt.
## Pull Request Checklist
- Branch from the head of the current development branch. Until version 1.0 is released, this the master branch.
- Commits should be as small as possible, while ensuring that each commit is correct independently (i.e. each commit should compile and pass all tests). Commits that don't follow the coding style indicated in .clang-format (e.g. indentation) are less likely to be accepted until they are fixed.
- If your pull request is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
- Add tests relevant to the fixed defect or new feature. It's best to do this before making any changes, make sure that the tests fail, then make changes ensuring that it ultimately passes the tests (i.e. TDD). xlnt uses cxxtest for testing. Tests are contained in a tests directory inside each module (e.g. source/workbook/tests/test_workbook.hpp) in the form of a header file. Each test is a separate function with a name that starts like "test_". See http://cxxtest.com/guide.html for information about CxxTest or take a look at existing tests.
## Conduct
Just try to be nice--we're all volunteers here.
## Communication
Add a comment to an existing issue on GitHub, open a new issue for defects or feature requests, or contact @tfussell if you want.

View File

@ -0,0 +1,37 @@
# Formatting
## Format vs. Style
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
auto cell = wb.active_sheet().cell("A1");
return 0;
}
```
In the context of xlnt, format and style have specific distinct meanings. A style in xlnt corresponds to a named style created in the "Cell styles" dropdown in Excel. It must have a name and optionally any of: alignment, border, fill, font, number format, protection. A format in xlnt corresponds to the alignment, border, fill, font, number format, and protection settings applied to a cell via right-click->"Format Cells". A cell can have both a format and a style. The style properties will generally override the format properties.
## Number Formatting
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
auto cell = wb.active_sheet().cell("A1");
cell.number_format(xlnt::number_format::percentage());
cell.value(0.513);
std::cout << cell.to_string() << std::endl;
return 0;
}
```
An xlnt::number_format is the format code used when displaying a value in a cell. For example, a number_format of "0.00" implies that the number 13.726 should be displayed as "13.73". Many number formats are built-in to Excel and can be access with xlnt::number_format static constructors. Other custom number formats can be created by passing a string to the [xlnt::number_format constructor](#cell-const-cell-amp).

View File

@ -0,0 +1,56 @@
# Getting Started
## Getting xlnt
### Binaries
### Homebrew
### Arch
### vcpkg
## Compiling from Source
xlnt uses continous integration (thanks [Travis CI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/)!) 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](https://cmake.org/) v3.1+. A full list of cmake generators can be found [here](https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html). A basic build would look like (starting in the root xlnt directory):
```bash
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:
```bash
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*
```bash
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](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules) for convenience except for pole and partio's zip component which have been modified and reside in xlnt/source/detail:
- [zlib v1.2.8](http://zlib.net/) (zlib License)
- [libstudxml v1.1.0](http://www.codesynthesis.com/projects/libstudxml/) (MIT license)
- [utfcpp v2.3.4](http://utfcpp.sourceforge.net/) (Boost Software License, Version 1.0)
- [Crypto++ v5.6.5](https://www.cryptopp.com/) (Boost Software License, Version 1.0)
- [pole v0.5](https://github.com/catlan/pole) (BSD 2-Clause License)
- [partio v1.1.0](https://github.com/wdas/partio) (BSD 3-Clause License with specific non-attribution clause)
Additionally, the xlnt test suite (bin/xlnt.test) requires an extra testing library. This test executable is separate from the main xlnt library assembly so the terms of this library's license should not apply to users of solely the xlnt library:
- [cxxtest v4.4](http://cxxtest.com/) (LGPLv3 License)
Initialize the submodules from the HEAD of their respective Git repositories with this command called from the xlnt root directory:
```bash
git submodule update --init --remote
```
### Static vs. Dynamic

View File

@ -0,0 +1,79 @@
# Introduction
```c++
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
xlnt::worksheet ws = wb.active_sheet();
ws.cell("A1").value(5);
ws.cell("B2").value("string data");
ws.cell("C3").formula("=RAND()");
ws.merge_cells("C3:C4");
ws.freeze_panes("B2");
wb.save("xlnt.xlsx");
return 0;
}
```
xlnt is a C++14 library for reading, writing, and modifying XLSX files as described in [ECMA 376](http://www.ecma-international.org/publications/standards/Ecma-376.htm). The API is based on [openpyxl](https://bitbucket.org/openpyxl/openpyxl), a Python library to read/write Excel 2007 xlsx/xlsm files, and ultimately on [PHPExcel](https://github.com/PHPOffice/PHPExcel), pure PHP library for reading and writing spreadsheet files upon which openpyxl was based. This project is still very much a work in progress, but the core development work is complete.
## Features
| Feature | Read | Edit | Write |
|---------------------------------------------------------------------|------|------|-------|
| Excel-style Workbook | ✓ | ✓ | ✓ |
| LibreOffice-style Workbook | ✓ | ✓ | ✓ |
| Numbers-style Workbook | ✓ | ✓ | ✓ |
| Encrypted Workbook (Excel 2007-2010) | ✓ | ✓ | |
| Encrypted Workbook (Excel 2013-2016) | ✓ | ✓ | |
| Excel Binary Workbook (.xlsb) | | | |
| Excel Macro-Enabled Workbook (.xlsm) | | | |
| Excel Macro-Enabled Template (.xltm) | | | |
| Document Properties | ✓ | ✓ | ✓ |
| Numeric Cell Values | ✓ | ✓ | ✓ |
| Inline String Cell Values | ✓ | ✓ | ✓ |
| Shared String Cell Values | ✓ | ✓ | ✓ |
| Shared String Text Run Formatting (e.g. varied fonts within a cell) | ✓ | ✓ | ✓ |
| Hyperlink Cell Values | | | |
| Formula Cell Values | | | |
| Formula Evaluation | | | |
| Page Margins | ✓ | ✓ | ✓ |
| Page Setup | | | |
| Print Area | | | |
| Comments | ✓ | ✓ | |
| Header and Footer | | | |
| Custom Views | | | |
| Charts | | | |
| Chartsheets | | | |
| Dialogsheets | | | |
| Themes | ✓ | | ✓ |
| Cell Styles | ✓ | ✓ | ✓ |
| Cell Formats | ✓ | ✓ | ✓ |
| Formatting->Alignment (e.g. right align) | ✓ | ✓ | ✓ |
| Formatting->Border (e.g. red cell outline) | ✓ | ✓ | ✓ |
| Formatting->Fill (e.g. green cell background) | ✓ | ✓ | ✓ |
| Formatting->Font (e.g. blue cell text) | ✓ | ✓ | ✓ |
| Formatting->Number Format (e.g. show 2 decimals) | ✓ | ✓ | ✓ |
| Formatting->Protection (e.g. hide formulas) | ✓ | ✓ | ✓ |
| Column Styles | | | |
| Row Styles | | | |
| Sheet Styles | | | |
| Conditional Formatting | | | |
| Tables | | | |
| Table Formatting | | | |
| Pivot Tables | | | |
| XLSX Thumbnail | ✓ | | ✓ |
| Custom OOXML Properties | | | |
| Custom OOXML Parts | | | |
| Drawing | | | |
| Text Box | | | |
| WordArt | | | |
| Embedded Content (e.g. images) | | | |
| Excel VBA | | | |
## Performance
Creates a new workbook and writes 1 million cells to a file in X seconds using a fully optimized build on Windows 10 with MSVC 2015.

View File

@ -0,0 +1,361 @@
# License
## [xlnt](https://github.com/tfussell/xlnt)
>[MIT License](https://github.com/tfussell/xlnt/blob/master/LICENSE.md)
```
Copyright (c) 2014-2017 Thomas Fussell
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
## [POLE](http://www.dimin.net/software/pole/)
>[BSD 2-Clause License](https://bitbucket.org/dimin/pole/src/c15e513bdce4c3a52b3dbc925d4d2bb520dc71d8/pole/LICENSE)
```
POLE - Portable C++ library to access OLE Storage
Copyright (C) 2002-2007 Ariya Hidayat (ariya@kde.org). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
## [Crypto++](https://www.cryptopp.com/)
>[Boost Software License - Version 1.0](https://www.cryptopp.com/License.txt)
```
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
```
## [libstudxml](http://www.codesynthesis.com/projects/libstudxml/)
>[MIT License](http://www.codesynthesis.com/licenses/mit.txt)
```
Summary: Everything is licensed under the MIT License (text below).
Code found in the xml/details/expat/ directory is distributed under
the MIT License (see the xml/details/expat/LICENSE file for copyright
information).
Code found in the xml/details/genx/ directory is distributed under
the MIT License (see the xml/details/genx/LICENSE file for copyright
information).
The rest is Copyright (c) 2013-2014 Code Synthesis Tools CC and is
distributed under the MIT License:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
## [zlib](http://www.zlib.net/)
>[zlib License](http://www.zlib.net/zlib_license.html)
```
(C) 1995-2013 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
```
## [CxxTest](http://cxxtest.com/)
>[LGPL License](https://github.com/CxxTest/cxxtest/blob/master/COPYING)
```
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
```
## [PartIO](https://www.disneyanimation.com/technology/partio.html)
>[BSD 3-Clause License (with specific non-attribution clause)](https://github.com/wdas/partio/blob/master/src/lib/io/ZIP.h)
```
Copyright 2010 Disney Enterprises, Inc. All rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
Studios" or the names of its contributors may NOT be used to
endorse or promote products derived from this software without
specific prior written permission from Walt Disney Pictures.
Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
```

View File

@ -0,0 +1,31 @@
# Memory Model
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
void set_cell(xlnt::cell cell, int value)
{
cell.value(value);
}
xlnt::workbook create_wb()
{
xlnt::workbook wb;
auto ws = wb.active_sheet();
set_cell(wb.cell("A1"), 2);
return wb;
}
int main()
{
auto wb = create_wb();
std::cout << wb.value<int>() << std::endl;
return 0;
}
```
xlnt uses the pimpl idiom for most of its core data structures. This primary reason for choosing this technique was simplifying usage of the library. Instead of using pointers or references, classes can be passed around by value. Internally they hold a pointer to memory which is within the primary workbook implementation struct. Methods called on the wrapper object dereference the opaque pointer and manipulate its data directly.
For the user, this means that workbooks, worksheets, cells, formats, and styles can be passed and stored by value.

View File

@ -0,0 +1,54 @@
# Properties
```c++
xlnt::workbook wb;
wb.core_property(xlnt::core_property::category, "hors categorie");
wb.core_property(xlnt::core_property::content_status, "good");
wb.core_property(xlnt::core_property::created, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::creator, "me");
wb.core_property(xlnt::core_property::description, "description");
wb.core_property(xlnt::core_property::identifier, "id");
wb.core_property(xlnt::core_property::keywords, { "wow", "such" });
wb.core_property(xlnt::core_property::language, "Esperanto");
wb.core_property(xlnt::core_property::last_modified_by, "someone");
wb.core_property(xlnt::core_property::last_printed, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::modified, xlnt::datetime(2017, 1, 15));
wb.core_property(xlnt::core_property::revision, "3");
wb.core_property(xlnt::core_property::subject, "subject");
wb.core_property(xlnt::core_property::title, "title");
wb.core_property(xlnt::core_property::version, "1.0");
wb.extended_property(xlnt::extended_property::application, "xlnt");
wb.extended_property(xlnt::extended_property::app_version, "0.9.3");
wb.extended_property(xlnt::extended_property::characters, 123);
wb.extended_property(xlnt::extended_property::characters_with_spaces, 124);
wb.extended_property(xlnt::extended_property::company, "Incorporated Inc.");
wb.extended_property(xlnt::extended_property::dig_sig, "?");
wb.extended_property(xlnt::extended_property::doc_security, 0);
wb.extended_property(xlnt::extended_property::heading_pairs, true);
wb.extended_property(xlnt::extended_property::hidden_slides, false);
wb.extended_property(xlnt::extended_property::h_links, 0);
wb.extended_property(xlnt::extended_property::hyperlink_base, 0);
wb.extended_property(xlnt::extended_property::hyperlinks_changed, true);
wb.extended_property(xlnt::extended_property::lines, 42);
wb.extended_property(xlnt::extended_property::links_up_to_date, false);
wb.extended_property(xlnt::extended_property::manager, "johnny");
wb.extended_property(xlnt::extended_property::m_m_clips, "?");
wb.extended_property(xlnt::extended_property::notes, "note");
wb.extended_property(xlnt::extended_property::pages, 19);
wb.extended_property(xlnt::extended_property::paragraphs, 18);
wb.extended_property(xlnt::extended_property::presentation_format, "format");
wb.extended_property(xlnt::extended_property::scale_crop, true);
wb.extended_property(xlnt::extended_property::shared_doc, false);
wb.extended_property(xlnt::extended_property::slides, 17);
wb.extended_property(xlnt::extended_property::template_, "template!");
wb.extended_property(xlnt::extended_property::titles_of_parts, { "title" });
wb.extended_property(xlnt::extended_property::total_time, 16);
wb.extended_property(xlnt::extended_property::words, 101);
wb.custom_property("test", { 1, 2, 3 });
wb.custom_property("Editor", "John Smith");
wb.save("lots_of_properties.xlsx");
```

17
docs/source/index.html.md Normal file
View File

@ -0,0 +1,17 @@
---
title: API Reference
toc_footers:
- <a href='https://github.com/tfussell/xlnt'><img src='images/github.png' id='github-icon'/>GitHub Repo</a>
includes:
- introduction
- getting_started
- memory_model
- formatting
- properties
- api_reference
- license
search: true
---

View File

@ -0,0 +1,4 @@
//= require ./lib/_energize
//= require ./app/_lang
//= require ./app/_search
//= require ./app/_toc

View File

@ -0,0 +1,3 @@
//= require ./lib/_energize
//= require ./app/_lang
//= require ./app/_toc

View File

@ -0,0 +1,166 @@
//= require ../lib/_jquery
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
(function (global) {
'use strict';
var languages = [];
global.setupLanguages = setupLanguages;
global.activateLanguage = activateLanguage;
function activateLanguage(language) {
if (!language) return;
if (language === "") return;
$(".lang-selector a").removeClass('active');
$(".lang-selector a[data-language-name='" + language + "']").addClass('active');
for (var i=0; i < languages.length; i++) {
$(".highlight." + languages[i]).hide();
$(".lang-specific." + languages[i]).hide();
}
$(".highlight." + language).show();
$(".lang-specific." + language).show();
global.toc.calculateHeights();
// scroll to the new location of the position
if ($(window.location.hash).get(0)) {
$(window.location.hash).get(0).scrollIntoView(true);
}
}
// parseURL and stringifyURL are from https://github.com/sindresorhus/query-string
// MIT licensed
// https://github.com/sindresorhus/query-string/blob/7bee64c16f2da1a326579e96977b9227bf6da9e6/license
function parseURL(str) {
if (typeof str !== 'string') {
return {};
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return {};
}
return str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
var key = parts[0];
var val = parts[1];
key = decodeURIComponent(key);
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
};
function stringifyURL(obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (Array.isArray(val)) {
return val.sort().map(function (val2) {
return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
}).join('&');
}
return encodeURIComponent(key) + '=' + encodeURIComponent(val);
}).join('&') : '';
};
// gets the language set in the query string
function getLanguageFromQueryString() {
if (location.search.length >= 1) {
var language = parseURL(location.search).language
if (language) {
return language;
} else if (jQuery.inArray(location.search.substr(1), languages) != -1) {
return location.search.substr(1);
}
}
return false;
}
// returns a new query string with the new language in it
function generateNewQueryString(language) {
var url = parseURL(location.search);
if (url.language) {
url.language = language;
return stringifyURL(url);
}
return language;
}
// if a button is clicked, add the state to the history
function pushURL(language) {
if (!history) { return; }
var hash = window.location.hash;
if (hash) {
hash = hash.replace(/^#+/, '');
}
history.pushState({}, '', '?' + generateNewQueryString(language) + '#' + hash);
// save language as next default
localStorage.setItem("language", language);
}
function setupLanguages(l) {
var defaultLanguage = localStorage.getItem("language");
languages = l;
var presetLanguage = getLanguageFromQueryString();
if (presetLanguage) {
// the language is in the URL, so use that language!
activateLanguage(presetLanguage);
localStorage.setItem("language", presetLanguage);
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
// the language was the last selected one saved in localstorage, so use that language!
activateLanguage(defaultLanguage);
} else {
// no language selected, so use the default
activateLanguage(languages[0]);
}
}
// if we click on a language tab, activate that language
$(function() {
$(".lang-selector a").on("click", function() {
var language = $(this).data("language-name");
pushURL(language);
activateLanguage(language);
return false;
});
window.onpopstate = function() {
activateLanguage(getLanguageFromQueryString());
};
});
})(window);

View File

@ -0,0 +1,75 @@
//= require ../lib/_lunr
//= require ../lib/_jquery
//= require ../lib/_jquery.highlight
(function () {
'use strict';
var content, searchResults;
var highlightOpts = { element: 'span', className: 'search-highlight' };
var index = new lunr.Index();
index.ref('id');
index.field('title', { boost: 10 });
index.field('body');
index.pipeline.add(lunr.trimmer, lunr.stopWordFilter);
$(populate);
$(bind);
function populate() {
$('h1, h2, h3').each(function() {
var title = $(this);
var body = title.nextUntil('h1, h2, h3');
index.add({
id: title.prop('id'),
title: title.text(),
body: body.text()
});
});
}
function bind() {
content = $('.content');
searchResults = $('.search-results');
$('#input-search').on('keyup', search);
}
function search(event) {
unhighlight();
searchResults.addClass('visible');
// ESC clears the field
if (event.keyCode === 27) this.value = '';
if (this.value) {
var results = index.search(this.value).filter(function(r) {
return r.score > 0.0001;
});
if (results.length) {
searchResults.empty();
$.each(results, function (index, result) {
var elem = document.getElementById(result.ref);
searchResults.append("<li><a href='#" + result.ref + "'>" + $(elem).text() + "</a></li>");
});
highlight.call(this);
} else {
searchResults.html('<li></li>');
$('.search-results li').text('No Results Found for "' + this.value + '"');
}
} else {
unhighlight();
searchResults.removeClass('visible');
}
}
function highlight() {
if (this.value) content.highlight(this.value, highlightOpts);
}
function unhighlight() {
content.unhighlight(highlightOpts);
}
})();

View File

@ -0,0 +1,57 @@
//= require ../lib/_jquery
//= require ../lib/_jquery_ui
//= require ../lib/_jquery.tocify
//= require ../lib/_imagesloaded.min
(function (global) {
'use strict';
var closeToc = function() {
$(".tocify-wrapper").removeClass('open');
$("#nav-button").removeClass('open');
};
var makeToc = function() {
global.toc = $("#toc").tocify({
selectors: 'h1, h2, h3, h4',
extendPage: false,
theme: 'none',
smoothScroll: false,
showEffectSpeed: 0,
hideEffectSpeed: 180,
ignoreSelector: '.toc-ignore',
highlightOffset: 60,
scrollTo: -1,
scrollHistory: true,
hashGenerator: function (text, element) {
return element.prop('id');
}
}).data('toc-tocify');
$("#nav-button").click(function() {
$(".tocify-wrapper").toggleClass('open');
$("#nav-button").toggleClass('open');
return false;
});
$(".page-wrapper").click(closeToc);
$(".tocify-item").click(closeToc);
};
// Hack to make already open sections to start opened,
// instead of displaying an ugly animation
function animate() {
setTimeout(function() {
toc.setOption('showEffectSpeed', 180);
}, 50);
}
$(function() {
makeToc();
animate();
setupLanguages($('body').data('languages'));
$('.content').imagesLoaded( function() {
global.toc.calculateHeights();
});
});
})(window);

View File

@ -0,0 +1,96 @@
<%#
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
%>
<% language_tabs = current_page.data.language_tabs || [] %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><%= current_page.data.title || "API Documentation" %></title>
<style>
<%= Rouge::Themes::Base16::Monokai.render(:scope => '.highlight') %>
</style>
<%= stylesheet_link_tag :screen, media: :screen %>
<%= stylesheet_link_tag :print, media: :print %>
<% if current_page.data.search %>
<%= javascript_include_tag "all" %>
<% else %>
<%= javascript_include_tag "all_nosearch" %>
<% end %>
</head>
<body class="<%= page_classes %>" data-languages="<%=h language_tabs.map{ |lang| lang.is_a?(Hash) ? lang.keys.first : lang }.to_json %>">
<a href="#" id="nav-button">
<span>
NAV
<%= image_tag('navbar.png') %>
</span>
</a>
<div class="tocify-wrapper">
<%= image_tag "logo.png" %>
<% if language_tabs.any? %>
<div class="lang-selector">
<% language_tabs.each do |lang| %>
<% if lang.is_a? Hash %>
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
<% else %>
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
<% end %>
<% end %>
</div>
<% end %>
<% if current_page.data.search %>
<div class="search">
<input type="text" class="search" id="input-search" placeholder="Search">
</div>
<ul class="search-results"></ul>
<% end %>
<div id="toc">
</div>
<% if current_page.data.toc_footers %>
<ul class="toc-footer">
<% current_page.data.toc_footers.each do |footer| %>
<li><%= footer %></li>
<% end %>
</ul>
<% end %>
</div>
<div class="page-wrapper">
<div class="dark-box"></div>
<div class="content">
<%= yield %>
<% current_page.data.includes && current_page.data.includes.each do |include| %>
<%= partial "includes/#{include}" %>
<% end %>
</div>
<div class="dark-box">
<% if language_tabs.any? %>
<div class="lang-selector">
<% language_tabs.each do |lang| %>
<% if lang.is_a? Hash %>
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
<% else %>
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
@font-face {
font-family: 'slate';
src:font-url('slate.eot?-syv14m');
src:font-url('slate.eot?#iefix-syv14m') format('embedded-opentype'),
font-url('slate.woff2?-syv14m') format('woff2'),
font-url('slate.woff?-syv14m') format('woff'),
font-url('slate.ttf?-syv14m') format('truetype'),
font-url('slate.svg?-syv14m#slate') format('svg');
font-weight: normal;
font-style: normal;
}
%icon {
font-family: 'slate';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
}
%icon-exclamation-sign {
@extend %icon;
content: "\e600";
}
%icon-info-sign {
@extend %icon;
content: "\e602";
}
%icon-ok-sign {
@extend %icon;
content: "\e606";
}
%icon-search {
@extend %icon;
content: "\e607";
}

View File

@ -0,0 +1,427 @@
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

View File

@ -0,0 +1,105 @@
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
////////////////////////////////////////////////////////////////////////////////
// CUSTOMIZE SLATE
////////////////////////////////////////////////////////////////////////////////
// Use these settings to help adjust the appearance of Slate
// BACKGROUND COLORS
////////////////////
$nav-bg: #393939 !default;
$examples-bg: #393939 !default;
$code-bg: #292929 !default;
$code-annotation-bg: #1c1c1c !default;
$nav-subitem-bg: #262626 !default;
$nav-active-bg: #2467af !default;
$lang-select-border: #000 !default;
$lang-select-bg: #222 !default;
$lang-select-active-bg: $examples-bg !default; // feel free to change this to blue or something
$lang-select-pressed-bg: #111 !default; // color of language tab bg when mouse is pressed
$main-bg: #eaf2f6 !default;
$aside-notice-bg: #8fbcd4 !default;
$aside-warning-bg: #c97a7e !default;
$aside-success-bg: #6ac174 !default;
$search-notice-bg: #c97a7e !default;
// TEXT COLORS
////////////////////
$main-text: #333 !default; // main content text color
$nav-text: #fff !default;
$nav-active-text: #fff !default;
$lang-select-text: #fff !default; // color of unselected language tab text
$lang-select-active-text: #fff !default; // color of selected language tab text
$lang-select-pressed-text: #fff !default; // color of language tab text when mouse is pressed
// SIZES
////////////////////
$nav-width: 230px !default; // width of the navbar
$examples-width: 50% !default; // portion of the screen taken up by code examples
$logo-margin: 20px !default; // margin between nav items and logo, ignored if search is active
$main-padding: 28px !default; // padding to left and right of content & examples
$nav-padding: 15px !default; // padding to left and right of navbar
$nav-v-padding: 10px !default; // padding used vertically around search boxes and results
$nav-indent: 10px !default; // extra padding for ToC subitems
$code-annotation-padding: 13px !default; // padding inside code annotations
$h1-margin-bottom: 21px !default; // padding under the largest header tags
$tablet-width: 930px !default; // min width before reverting to tablet size
$phone-width: $tablet-width - $nav-width !default; // min width before reverting to mobile size
// FONTS
////////////////////
%default-font {
font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei","微软雅黑", STXihei, "华文细黑", sans-serif;
font-size: 13px;
}
%header-font {
@extend %default-font;
font-weight: bold;
}
%code-font {
font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif;
font-size: 12px;
line-height: 1.5;
}
// OTHER
////////////////////
$nav-active-shadow: #000 !default;
$nav-footer-border-color: #666 !default;
$nav-embossed-border-top: #000 !default;
$nav-embossed-border-bottom: #939393 !default;
$main-embossed-text-shadow: 0px 1px 0px #fff !default;
$search-box-border-color: #666 !default;
////////////////////////////////////////////////////////////////////////////////
// INTERNAL
////////////////////////////////////////////////////////////////////////////////
// These settings are probably best left alone.
%break-words {
word-break: break-all;
hyphens: auto;
}

View File

@ -0,0 +1,147 @@
@charset "utf-8";
@import 'normalize';
@import 'variables';
@import 'icon-font';
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
$print-color: #999;
$print-color-light: #ccc;
$print-font-size: 12px;
body {
@extend %default-font;
}
.tocify, .toc-footer, .lang-selector, .search, #nav-button {
display: none;
}
.tocify-wrapper>img {
margin: 0 auto;
display: block;
}
.content {
font-size: 12px;
pre, code {
@extend %code-font;
@extend %break-words;
border: 1px solid $print-color;
border-radius: 5px;
font-size: 0.8em;
}
pre {
code {
border: 0;
}
}
pre {
padding: 1.3em;
}
code {
padding: 0.2em;
}
table {
border: 1px solid $print-color;
tr {
border-bottom: 1px solid $print-color;
}
td,th {
padding: 0.7em;
}
}
p {
line-height: 1.5;
}
a {
text-decoration: none;
color: #000;
}
h1 {
@extend %header-font;
font-size: 2.5em;
padding-top: 0.5em;
padding-bottom: 0.5em;
margin-top: 1em;
margin-bottom: $h1-margin-bottom;
border: 2px solid $print-color-light;
border-width: 2px 0;
text-align: center;
}
h2 {
@extend %header-font;
font-size: 1.8em;
margin-top: 2em;
border-top: 2px solid $print-color-light;
padding-top: 0.8em;
}
h1+h2, h1+div+h2 {
border-top: none;
padding-top: 0;
margin-top: 0;
}
h3, h4 {
@extend %header-font;
font-size: 0.8em;
margin-top: 1.5em;
margin-bottom: 0.8em;
text-transform: uppercase;
}
h5, h6 {
text-transform: uppercase;
}
aside {
padding: 1em;
border: 1px solid $print-color-light;
border-radius: 5px;
margin-top: 1.5em;
margin-bottom: 1.5em;
line-height: 1.6;
}
aside:before {
vertical-align: middle;
padding-right: 0.5em;
font-size: 14px;
}
aside.notice:before {
@extend %icon-info-sign;
}
aside.warning:before {
@extend %icon-exclamation-sign;
}
aside.success:before {
@extend %icon-ok-sign;
}
}

View File

@ -0,0 +1,634 @@
@charset "utf-8";
@import 'normalize';
@import 'variables';
@import 'icon-font';
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
////////////////////////////////////////////////////////////////////////////////
// GENERAL STUFF
////////////////////////////////////////////////////////////////////////////////
html, body {
color: $main-text;
padding: 0;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@extend %default-font;
background-color: $main-bg;
height: 100%;
-webkit-text-size-adjust: none; /* Never autoresize text */
}
////////////////////////////////////////////////////////////////////////////////
// TABLE OF CONTENTS
////////////////////////////////////////////////////////////////////////////////
#toc > ul > li > a > span {
float: right;
background-color: #2484FF;
border-radius: 40px;
width: 20px;
}
@mixin embossed-bg {
background:
linear-gradient(to bottom, rgba(#000, 0.2), rgba(#000, 0) 8px),
linear-gradient(to top, rgba(#000, 0.2), rgba(#000, 0) 8px),
linear-gradient(to bottom, rgba($nav-embossed-border-top, 1), rgba($nav-embossed-border-top, 0) 1.5px),
linear-gradient(to top, rgba($nav-embossed-border-bottom, 1), rgba($nav-embossed-border-bottom, 0) 1.5px),
$nav-subitem-bg;
}
.tocify-wrapper {
transition: left 0.3s ease-in-out;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
z-index: 30;
top: 0;
left: 0;
bottom: 0;
width: $nav-width;
background-color: $nav-bg;
font-size: 13px;
font-weight: bold;
// language selector for mobile devices
.lang-selector {
display: none;
a {
padding-top: 0.5em;
padding-bottom: 0.5em;
}
}
// This is the logo at the top of the ToC
&>img {
display: block;
max-width: 100%;
}
&>.search {
position: relative;
input {
background: $nav-bg;
border-width: 0 0 1px 0;
border-color: $search-box-border-color;
padding: 6px 0 6px 20px;
box-sizing: border-box;
margin: $nav-v-padding $nav-padding;
width: $nav-width - 30;
outline: none;
color: $nav-text;
border-radius: 0; /* ios has a default border radius */
}
&:before {
position: absolute;
top: 17px;
left: $nav-padding;
color: $nav-text;
@extend %icon-search;
}
}
img+.tocify, .lang-selector+.tocify {
margin-top: $logo-margin;
}
.search-results {
margin-top: 0;
box-sizing: border-box;
height: 0;
overflow-y: auto;
overflow-x: hidden;
transition-property: height, margin;
transition-duration: 180ms;
transition-timing-function: ease-in-out;
&.visible {
height: 30%;
margin-bottom: 1em;
}
@include embossed-bg;
li {
margin: 1em $nav-padding;
line-height: 1;
}
a {
color: $nav-text;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
.tocify-item>a, .toc-footer li {
padding: 0 $nav-padding 0 $nav-padding;
display: block;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
// The Table of Contents is composed of multiple nested
// unordered lists. These styles remove the default
// styling of an unordered list because it is ugly.
ul, li {
list-style: none;
margin: 0;
padding: 0;
line-height: 28px;
}
li {
color: $nav-text;
transition-property: background;
transition-timing-function: linear;
transition-duration: 230ms;
}
// This is the currently selected ToC entry
.tocify-focus {
box-shadow: 0px 1px 0px $nav-active-shadow;
background-color: $nav-active-bg;
color: $nav-active-text;
}
// Subheaders are the submenus that slide open
// in the table of contents.
.tocify-subheader {
display: none; // tocify will override this when needed
background-color: $nav-subitem-bg;
font-weight: 500;
.tocify-item>a {
padding-left: $nav-padding + $nav-indent;
font-size: 12px;
}
// for embossed look:
@include embossed-bg;
&>li:last-child {
box-shadow: none; // otherwise it'll overflow out of the subheader
}
}
.toc-footer {
padding: 1em 0;
margin-top: 1em;
border-top: 1px dashed $nav-footer-border-color;
li,a {
color: $nav-text;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
li {
font-size: 0.8em;
line-height: 1.7;
text-decoration: none;
}
}
}
// button to show navigation on mobile devices
#nav-button {
span {
display: block;
$side-pad: $main-padding / 2 - 8px;
padding: $side-pad $side-pad $side-pad;
background-color: rgba($main-bg, 0.7);
transform-origin: 0 0;
transform: rotate(-90deg) translate(-100%, 0);
border-radius: 0 0 0 5px;
}
padding: 0 1.5em 5em 0; // increase touch size area
display: none;
position: fixed;
top: 0;
left: 0;
z-index: 100;
color: #000;
text-decoration: none;
font-weight: bold;
opacity: 0.7;
line-height: 16px;
img {
height: 16px;
vertical-align: bottom;
}
transition: left 0.3s ease-in-out;
&:hover { opacity: 1; }
&.open {left: $nav-width}
}
////////////////////////////////////////////////////////////////////////////////
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
////////////////////////////////////////////////////////////////////////////////
.page-wrapper {
margin-left: $nav-width;
position: relative;
z-index: 10;
background-color: $main-bg;
min-height: 100%;
padding-bottom: 1px; // prevent margin overflow
// The dark box is what gives the code samples their dark background.
// It sits essentially under the actual content block, which has a
// transparent background.
// I know, it's hackish, but it's the simplist way to make the left
// half of the content always this background color.
.dark-box {
width: $examples-width;
background-color: $examples-bg;
position: absolute;
right: 0;
top: 0;
bottom: 0;
}
.lang-selector {
position: fixed;
z-index: 50;
border-bottom: 5px solid $lang-select-active-bg;
}
}
.lang-selector {
background-color: $lang-select-bg;
width: 100%;
font-weight: bold;
a {
display: block;
float:left;
color: $lang-select-text;
text-decoration: none;
padding: 0 10px;
line-height: 30px;
outline: 0;
&:active, &:focus {
background-color: $lang-select-pressed-bg;
color: $lang-select-pressed-text;
}
&.active {
background-color: $lang-select-active-bg;
color: $lang-select-active-text;
}
}
&:after {
content: '';
clear: both;
display: block;
}
}
////////////////////////////////////////////////////////////////////////////////
// CONTENT STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff with the light background in the left half of the page
.content {
// to place content above the dark box
position: relative;
z-index: 30;
&:after {
content: '';
display: block;
clear: both;
}
&>h1, &>h2, &>h3, &>h4, &>h5, &>h6, &>p, &>table, &>ul, &>ol, &>aside, &>dl {
margin-right: $examples-width;
padding: 0 $main-padding;
box-sizing: border-box;
display: block;
text-shadow: $main-embossed-text-shadow;
@extend %left-col;
}
&>ul, &>ol {
padding-left: $main-padding + 15px;
}
// the div is the tocify hidden div for placeholding stuff
&>h1, &>h2, &>div {
clear:both;
}
h1 {
@extend %header-font;
font-size: 30px;
padding-top: 0.5em;
padding-bottom: 0.5em;
border-bottom: 1px solid #ccc;
margin-bottom: $h1-margin-bottom;
margin-top: 2em;
border-top: 1px solid #ddd;
background-image: linear-gradient(to bottom, #fff, #f9f9f9);
}
h1:first-child, div:first-child + h1 {
border-top-width: 0;
margin-top: 0;
}
h2 {
@extend %header-font;
font-size: 20px;
margin-top: 4em;
margin-bottom: 0;
border-top: 1px solid #ccc;
padding-top: 1.2em;
padding-bottom: 1.2em;
background-image: linear-gradient(to bottom, rgba(#fff, 0.4), rgba(#fff, 0));
}
// h2s right after h1s should bump right up
// against the h1s.
h1 + h2, h1 + div + h2 {
margin-top: $h1-margin-bottom * -1;
border-top: none;
}
h3, h4, h5, h6 {
@extend %header-font;
font-size: 15px;
margin-top: 2.5em;
margin-bottom: 0.8em;
}
h4, h5, h6 {
font-size: 10px;
}
hr {
margin: 2em 0;
border-top: 2px solid $examples-bg;
border-bottom: 2px solid $main-bg;
}
table {
margin-bottom: 1em;
overflow: auto;
th,td {
text-align: left;
vertical-align: top;
line-height: 1.6;
}
th {
padding: 5px 10px;
border-bottom: 1px solid #ccc;
vertical-align: bottom;
}
td {
padding: 10px;
}
tr:last-child {
border-bottom: 1px solid #ccc;
}
tr:nth-child(odd)>td {
background-color: lighten($main-bg,4.2%);
}
tr:nth-child(even)>td {
background-color: lighten($main-bg,2.4%);
}
}
dt {
font-weight: bold;
}
dd {
margin-left: 15px;
}
p, li, dt, dd {
line-height: 1.6;
margin-top: 0;
}
img {
max-width: 100%;
}
code {
background-color: rgba(0,0,0,0.05);
padding: 3px;
border-radius: 3px;
@extend %break-words;
@extend %code-font;
}
pre>code {
background-color: transparent;
padding: 0;
}
aside {
padding-top: 1em;
padding-bottom: 1em;
text-shadow: 0 1px 0 lighten($aside-notice-bg, 15%);
margin-top: 1.5em;
margin-bottom: 1.5em;
background: $aside-notice-bg;
line-height: 1.6;
&.warning {
background-color: $aside-warning-bg;
text-shadow: 0 1px 0 lighten($aside-warning-bg, 15%);
}
&.success {
background-color: $aside-success-bg;
text-shadow: 0 1px 0 lighten($aside-success-bg, 15%);
}
}
aside:before {
vertical-align: middle;
padding-right: 0.5em;
font-size: 14px;
}
aside.notice:before {
@extend %icon-info-sign;
}
aside.warning:before {
@extend %icon-exclamation-sign;
}
aside.success:before {
@extend %icon-ok-sign;
}
.search-highlight {
padding: 2px;
margin: -2px;
border-radius: 4px;
border: 1px solid #F7E633;
text-shadow: 1px 1px 0 #666;
background: linear-gradient(to top left, #F7E633 0%, #F1D32F 100%);
}
}
////////////////////////////////////////////////////////////////////////////////
// CODE SAMPLE STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff that appears in the right half of the page
.content {
pre, blockquote {
background-color: $code-bg;
color: #fff;
padding: 2em $main-padding;
margin: 0;
width: $examples-width;
float:right;
clear:right;
box-sizing: border-box;
text-shadow: 0px 1px 2px rgba(0,0,0,0.4);
@extend %right-col;
&>p { margin: 0; }
a {
color: #fff;
text-decoration: none;
border-bottom: dashed 1px #ccc;
}
}
pre {
@extend %code-font;
}
blockquote {
&>p {
background-color: $code-annotation-bg;
border-radius: 5px;
padding: $code-annotation-padding;
color: #ccc;
border-top: 1px solid #000;
border-bottom: 1px solid #404040;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// RESPONSIVE DESIGN
////////////////////////////////////////////////////////////////////////////////
// These are the styles for phones and tablets
// There are also a couple styles disperesed
@media (max-width: $tablet-width) {
.tocify-wrapper {
left: -$nav-width;
&.open {
left: 0;
}
}
.page-wrapper {
margin-left: 0;
}
#nav-button {
display: block;
}
.tocify-wrapper .tocify-item > a {
padding-top: 0.3em;
padding-bottom: 0.3em;
}
}
@media (max-width: $phone-width) {
.dark-box {
display: none;
}
%left-col {
margin-right: 0;
}
.tocify-wrapper .lang-selector {
display: block;
}
.page-wrapper .lang-selector {
display: none;
}
%right-col {
width: auto;
float: none;
}
%right-col + %left-col {
margin-top: $main-padding;
}
}
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs {
color: #909090;
}
.highlight, .highlight .w {
background-color: $code-bg;
}
#github-icon {
width: 12px;
padding-top: 0px;
margin-right: 10px;
vertical-align: middle;
}

View File

@ -1,17 +0,0 @@
Working with styles
===================
Introduction
------------
Styles are used to change the look of your data while displayed on screen.
They are also used to determine the number format being used for a given cell
or range of cells.
Styles can be applied to the following aspects:
* font to set font size, color, underlining, etc.
* fill to set a pattern or color gradient
* border to set borders on a cell
* cell alignment
* protection

View File

@ -1,5 +0,0 @@
Manipulating a workbook in memory
=================================
Create a workbook
-----------------

View File

@ -1,2 +0,0 @@
Validating cells
================

View File

@ -1,2 +0,0 @@
Testing on Windows
==================

View File

@ -1,72 +0,0 @@
// Copyright (c) 2014-2017 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <xlnt/xlnt_config.hpp>
namespace xlnt {
/// <summary>
///
/// </summary>
class XLNT_API utf8string
{
public:
/// <summary>
///
/// </summary>
static utf8string from_utf8(const std::string &s);
/// <summary>
///
/// </summary>
static utf8string from_latin1(const std::string &s);
/// <summary>
///
/// </summary>
static utf8string from_utf16(const std::vector<std::uint16_t> &s);
/// <summary>
///
/// </summary>
static utf8string from_utf32(const std::vector<std::uint32_t> &s);
/// <summary>
///
/// </summary>
bool is_valid() const;
private:
/// <summary>
///
/// </summary>
std::vector<std::uint8_t> bytes_;
};
} // namespace xlnt

View File

@ -1,56 +1,25 @@
cmake_minimum_required(VERSION 3.1)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common.cmake)
project(${LIBRARY_NAME} VERSION ${LIBRARY_VERSION} LANGUAGES CXX C)
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party ${CMAKE_CURRENT_BINARY_DIR}/third-party)
if(APPLE)
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
endif()
project(xlnt VERSION 0.9.3)
set(PROJECT_VENDOR "Thomas Fussell")
set(PROJECT_CONTACT "thomas.fussell@gmail.com")
set(PROJECT_URL "https://github.com/tfussell/xlnt")
set(PROJECT_DESCRIPTION "cross-platform user-friendly xlsx library for C++14")
set(XLNT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include)
set(XLNT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed" CACHE PATH "default install path" FORCE)
if(APPLE)
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
endif()
if(NOT INC_DEST_DIR)
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT LIB_DEST_DIR)
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
set(XLNT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
if(NOT BIN_DEST_DIR)
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
endif()
set(XLNT_INCLUDE_DIR ${XLNT_ROOT_DIR}/include)
set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source)
set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party)
add_subdirectory(${THIRD_PARTY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party)
# Put all output files in the same directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin)
endforeach()
# Platform specific settings
if(COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
@ -70,18 +39,6 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_VERSION})
endif()
# Includes
include_directories(${XLNT_INCLUDE_DIR}
${XLNT_INCLUDE_DIR}/xlnt
${XLNT_SOURCE_DIR}
${XLNT_SOURCE_DIR}/detail
${THIRD_PARTY_DIR}/miniz
${THIRD_PARTY_DIR}/libstudxml
${THIRD_PARTY_DIR}/utfcpp/source
${THIRD_PARTY_DIR}/pole
${THIRD_PARTY_DIR}/zlib
${THIRD_PARTY_DIR}/cryptopp)
file(GLOB ROOT_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/*.hpp)
file(GLOB CELL_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/cell/*.hpp)
file(GLOB CELL_SOURCES ${XLNT_SOURCE_DIR}/cell/*.cpp)
@ -115,6 +72,23 @@ set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES}
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed"
CACHE PATH "default install path" FORCE)
endif()
if(NOT INC_DEST_DIR)
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
endif()
if(NOT LIB_DEST_DIR)
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
if(NOT BIN_DEST_DIR)
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
endif()
if(NOT STATIC)
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES})
target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1)
@ -123,26 +97,20 @@ if(NOT STATIC)
target_compile_definitions(xlnt PRIVATE XLNT_EXPORT=1 _CRT_SECURE_NO_WARNINGS=1)
endif()
install(TARGETS xlnt
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR})
set_target_properties(
xlnt
set_target_properties(xlnt
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
INSTALL_NAME_DIR "${LIB_DEST_DIR}")
if(FRAMEWORK)
add_custom_command(
TARGET xlnt
add_custom_command(TARGET xlnt
POST_BUILD
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
COMMAND cp -R ../include/xlnt/* "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
COMMAND cp "lib/lib${PROJECT_NAME}.${PROJECT_VERSION_FULL}.dylib" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.framework/Versions/${PROJECT_VERSION_FULL}/xlnt"
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.framework/Versions" && ln -s "${PROJECT_VERSION_FULL}" Current
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.framework" && ln -s Versions/Current/* ./
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
COMMAND cp -R ${XLNT_INCLUDE_DIR}/xlnt/* "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
COMMAND cp "lib/lib${PROJECT_NAME}.${PROJECT_VERSION_FULL}.dylib" "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/xlnt"
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions" && ln -s "${PROJECT_VERSION_FULL}" Current
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework" && ln -s Versions/Current/* ./
)
endif()
else()
@ -150,21 +118,17 @@ else()
target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1)
if(MSVC)
target_compile_definitions(xlnt PRIVATE _CRT_SECURE_NO_WARNINGS=1 NOMINMAX)
target_compile_definitions(xlnt PRIVATE _CRT_SECURE_NO_WARNINGS=1)
endif()
install(TARGETS xlnt
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR}
)
endif()
target_compile_definitions(${PROJECT_NAME}
PRIVATE LIBSTUDXML_STATIC_LIB=1
PRIVATE NO_OS_DEPENDENCE=1
PRIVATE CRYPTOPP_DISABLE_ASM=1)
target_link_libraries(${PROJECT_NAME} xlnt.third-party)
target_link_libraries(xlnt ${CRYPTOPP_LIBRARY} ${ZLIB_LIBRARY_RELEASE} libstudxml)
target_include_directories(xlnt
PUBLIC ${XLNT_INCLUDE_DIR}
PRIVATE ${XLNT_SOURCE_DIR}
PRIVATE ${ZLIB_INCLUDE_DIR}
PRIVATE ${CRYPTOPP_INCLUDE_DIR})
if(MSVC)
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\" /MP")
@ -184,35 +148,31 @@ source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(PKG_CONFIG_LIBDIR ${LIB_DEST_DIR})
set(PKG_CONFIG_INCLUDEDIR ${INC_DEST_DIR})
set(PKG_CONFIG_LIBS "-L\${libdir} -lxlnt")
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
if(NOT MSVC)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
install(
DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
DESTINATION include
PATTERN ".DS_Store" EXCLUDE)
install(TARGETS xlnt
LIBRARY DESTINATION ${LIB_DEST_DIR}
ARCHIVE DESTINATION ${LIB_DEST_DIR}
RUNTIME DESTINATION ${BIN_DEST_DIR})
if(NOT MSVC)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
configure_file("${XLNT_ROOT_DIR}/cmake/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc"
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
endif()
add_custom_target(
uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
install(DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
DESTINATION include
PATTERN ".DS_Store" EXCLUDE)
configure_file("${XLNT_ROOT_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

View File

@ -34,9 +34,9 @@
#pragma clang diagnostic ignored "-Wextra-semi"
#pragma clang diagnostic ignored "-Wexit-time-destructors"
#include <aes.h>
#include <base64.h>
#include <modes.h>
#include <sha.h>
#include <cryptopp/aes.h>
#include <cryptopp/base64.h>
#include <cryptopp/modes.h>
#include <cryptopp/sha.h>
#pragma clang diagnostic pop

View File

@ -53,6 +53,33 @@ bool is_integral(long double d)
return std::fabs(d - static_cast<long double>(static_cast<long long int>(d))) == 0.L;
}
std::vector<std::pair<std::string, std::string>> core_property_namespace(xlnt::core_property type)
{
using xlnt::core_property;
using xlnt::constants;
if (type == core_property::created
|| type == core_property::modified)
{
return {{constants::ns("dcterms"), "dcterms"},
{constants::ns("xsi"), "xsi"}};
}
else if (type == core_property::title
|| type == core_property::subject
|| type == core_property::creator
|| type == core_property::description)
{
return {{constants::ns("dc"), "dc"}};
}
else if (type == core_property::keywords)
{
return {{constants::ns("core-properties"), "cp"},
{constants::ns("vt"), "vt"}};
}
return {{constants::ns("core-properties"), "cp"}};
}
} // namespace
namespace xlnt {
@ -266,12 +293,13 @@ void xlsx_producer::write_property(const std::string &name, const variant &value
write_start_element(constants::ns("vt"), "variant");
}
switch (vector_element.value_type())
{
case variant::type::lpstr:
if (vector_element.value_type() == variant::type::lpstr)
{
write_element(constants::ns("vt"), "lpstr", vector_element.get<std::string>());
break;
case variant::type::i4:
}
else if (vector_element.value_type() == variant::type::i4)
{
write_element(constants::ns("vt"), "i4", vector_element.get<std::int32_t>());
break;
}
@ -298,30 +326,6 @@ void xlsx_producer::write_property(const std::string &name, const variant &value
}
}
std::vector<std::pair<std::string, std::string>> core_property_namespace(core_property type)
{
if (type == core_property::created
|| type == core_property::modified)
{
return {{constants::ns("dcterms"), "dcterms"},
{constants::ns("xsi"), "xsi"}};
}
else if (type == core_property::title
|| type == core_property::subject
|| type == core_property::creator
|| type == core_property::description)
{
return {{constants::ns("dc"), "dc"}};
}
else if (type == core_property::keywords)
{
return {{constants::ns("core-properties"), "cp"},
{constants::ns("vt"), "vt"}};
}
return {{constants::ns("core-properties"), "cp"}};
}
void xlsx_producer::write_core_properties(const relationship &/*rel*/)
{
write_start_element(constants::ns("core-properties"), "coreProperties");

View File

@ -1,36 +0,0 @@
#pragma once
#include <cxxtest/TestSuite.h>
#include <xlnt/utils/utf8string.hpp>
class test_utf8string : public CxxTest::TestSuite
{
public:
void test_utf8()
{
auto utf8_valid = xlnt::utf8string::from_utf8("abc");
auto utf8_invalid = xlnt::utf8string::from_utf8("\xc3\x28");
TS_ASSERT(utf8_valid.is_valid());
TS_ASSERT(!utf8_invalid.is_valid());
}
void test_latin1()
{
auto latin1_valid = xlnt::utf8string::from_latin1("abc");
TS_ASSERT(latin1_valid.is_valid());
}
void test_utf16()
{
auto utf16_valid = xlnt::utf8string::from_utf16({ 'a', 'b', 'c' });
TS_ASSERT(utf16_valid.is_valid());
}
void test_utf32()
{
auto utf32_valid = xlnt::utf8string::from_utf32({ 'a', 'b', 'c' });
TS_ASSERT(utf32_valid.is_valid());
}
};

View File

@ -1,72 +0,0 @@
// Copyright (c) 2014-2017 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wweak-vtables"
#include <utf8.h>
#pragma clang diagnostic pop
#include <xlnt/utils/utf8string.hpp>
namespace xlnt {
utf8string utf8string::from_utf8(const std::string &s)
{
utf8string result;
std::copy(s.begin(), s.end(), std::back_inserter(result.bytes_));
return result;
}
utf8string utf8string::from_latin1(const std::string &s)
{
utf8string result;
std::copy(s.begin(), s.end(), std::back_inserter(result.bytes_));
return result;
}
utf8string utf8string::from_utf16(const std::vector<std::uint16_t> &s)
{
utf8string result;
utf8::utf16to8(s.begin(), s.end(), std::back_inserter(result.bytes_));
return result;
}
utf8string utf8string::from_utf32(const std::vector<std::uint32_t> &s)
{
utf8string result;
utf8::utf32to8(s.begin(), s.end(), std::back_inserter(result.bytes_));
return result;
}
bool utf8string::is_valid() const
{
return utf8::is_valid(bytes_.begin(), bytes_.end());
}
} // namespace xlnt

View File

@ -165,4 +165,4 @@ variant::type variant::value_type() const
return type_;
}
}
} // namespace xlnt

View File

@ -13,31 +13,31 @@ public:
void test_decrypt_agile()
{
xlnt::workbook wb;
wb.load(path_helper::get_data_directory("11_encrypted_excel_2016.xlsx"), "secret");
wb.load(path_helper::data_directory("11_encrypted_excel_2016.xlsx"), "secret");
}
void test_decrypt_libre_office()
{
xlnt::workbook wb;
wb.load(path_helper::get_data_directory("12_encrypted_libre_office.xlsx"), "secret");
wb.load(path_helper::data_directory("12_encrypted_libre_office.xlsx"), "secret");
}
void test_decrypt_standard()
{
xlnt::workbook wb;
wb.load(path_helper::get_data_directory("13_encrypted_excel_2007.xlsx"), "password");
wb.load(path_helper::data_directory("13_encrypted_excel_2007.xlsx"), "password");
}
void test_decrypt_numbers()
{
xlnt::workbook wb;
wb.load(path_helper::get_data_directory("14_encrypted_numbers.xlsx"), "secret");
wb.load(path_helper::data_directory("14_encrypted_numbers.xlsx"), "secret");
}
void test_comments()
{
xlnt::workbook wb;
wb.load("data/15_basic_comments.xlsx");
wb.load(path_helper::data_directory("15_basic_comments.xlsx"));
auto sheet1 = wb[0];
TS_ASSERT_EQUALS(sheet1.cell("A1").value<std::string>(), "Sheet1!A1");
@ -54,12 +54,13 @@ public:
{
#ifdef _MSC_VER
xlnt::workbook wb;
static const std::string data_dir = STRING_LITERAL(XLNT_TEST_DATA_DIR);
wb.load(L"data\\16_unicode_Λ.xlsx");
TS_ASSERT_EQUALS(wb.active_sheet().cell("A1").value<std::string>(), "unicode!");
#endif
#ifndef __MINGW32__
xlnt::workbook wb2;
wb2.load(u8"data/16_unicode_Λ.xlsx");
wb2.load(U8STRING_LITERAL(XLNT_TEST_DATA_DIR) u8"/16_unicode_Λ.xlsx");
TS_ASSERT_EQUALS(wb2.active_sheet().cell("A1").value<std::string>(), "unicode!");
#endif
}
@ -67,7 +68,7 @@ public:
void test_read_hyperlink()
{
xlnt::workbook wb;
wb.load("data/17_with_hyperlink.xlsx");
wb.load(path_helper::data_directory("17_with_hyperlink.xlsx"));
TS_ASSERT(wb.active_sheet().cell("A1").has_hyperlink());
TS_ASSERT_EQUALS(wb.active_sheet().cell("A1").hyperlink(),
"https://fr.wikipedia.org/wiki/Ille-et-Vilaine");
@ -76,7 +77,7 @@ public:
void test_read_headers_and_footers()
{
xlnt::workbook wb;
wb.load("data/18_headers_and_footers.xlsx");
wb.load(path_helper::data_directory("18_headers_and_footers.xlsx"));
auto ws = wb.active_sheet();
TS_ASSERT_EQUALS(ws.cell("A1").value<std::string>(), "header");
@ -108,7 +109,7 @@ public:
void test_read_custom_properties()
{
xlnt::workbook wb;
wb.load("data/21_custom_properties.xlsx");
wb.load(path_helper::data_directory("21_custom_properties.xlsx"));
TS_ASSERT(wb.has_custom_property("Client"));
TS_ASSERT_EQUALS(wb.custom_property("Client").get<std::string>(), "me!");
}
@ -116,7 +117,7 @@ public:
void test_read_formulae()
{
xlnt::workbook wb;
wb.load("data/22_formulae.xlsx");
wb.load(path_helper::data_directory("22_formulae.xlsx"));
auto ws = wb.active_sheet();
TS_ASSERT_EQUALS(ws.cell("A1").value<int>(), 6);
TS_ASSERT(ws.cell("A1").has_formula());

View File

@ -32,7 +32,7 @@ public:
void test_produce_empty()
{
xlnt::workbook wb = xlnt::workbook::empty();
TS_ASSERT(workbook_matches_file(wb, path_helper::get_data_directory("9_default-excel.xlsx")));
TS_ASSERT(workbook_matches_file(wb, path_helper::data_directory("9_default-excel.xlsx")));
}
void test_produce_simple_excel()
@ -152,13 +152,13 @@ public:
sheet2.cell("A2").value("Sheet2!A2");
sheet2.cell("A2").comment("Sheet2 comment2", comment_font, "Microsoft Office User");
TS_ASSERT(workbook_matches_file(wb, xlnt::path("data/15_basic_comments.xlsx")));
TS_ASSERT(workbook_matches_file(wb, path_helper::data_directory("15_basic_comments.xlsx")));
}
void test_save_after_clear_all_formulae()
{
xlnt::workbook wb;
wb.load("data/22_formulae.xlsx");
wb.load(path_helper::data_directory("22_formulae.xlsx"));
auto ws = wb.active_sheet();
TS_ASSERT(ws.cell("A1").has_formula());
TS_ASSERT_EQUALS(ws.cell("A1").formula(), "A2*A3");

View File

@ -65,31 +65,31 @@ public:
void test_round_trip_empty_excel_rw()
{
auto path = path_helper::get_data_directory("9_default-excel.xlsx");
auto path = path_helper::data_directory("9_default-excel.xlsx");
TS_ASSERT(round_trip_matches_rw(path));
}
void test_round_trip_all_styles_rw()
{
auto path = path_helper::get_data_directory("10_all_styles.xlsx");
auto path = path_helper::data_directory("10_all_styles.xlsx");
TS_ASSERT(round_trip_matches_rw(path));
}
void test_round_trip_headers_footers()
{
auto path = path_helper::get_data_directory("18_headers_and_footers.xlsx");
auto path = path_helper::data_directory("18_headers_and_footers.xlsx");
TS_ASSERT(round_trip_matches_rw(path));
}
void test_round_trip_row_and_col_props()
{
auto path = path_helper::get_data_directory("19_row_and_col_properties.xlsx");
auto path = path_helper::data_directory("19_row_and_col_properties.xlsx");
TS_ASSERT(round_trip_matches_rw(path));
}
void test_round_trip_page_breaks()
{
auto path = path_helper::get_data_directory("20_page_breaks.xlsx");
auto path = path_helper::data_directory("20_page_breaks.xlsx");
TS_ASSERT(round_trip_matches_rw(path));
}
};

View File

@ -120,6 +120,165 @@ std::vector<typename T::key_type> keys(const T &container)
return result;
}
xlnt::path default_path(xlnt::relationship_type type, std::size_t index = 0)
{
using xlnt::path;
using xlnt::relationship_type;
switch (type)
{
case relationship_type::calculation_chain:
return path("/xl/calcChain.xml");
case relationship_type::chartsheet:
return path("/xl/sheets/.xml");
case relationship_type::comments:
return path("/xl/comments.xml");
case relationship_type::connections:
return path("/xl/connections.xml");
case relationship_type::core_properties:
return path("/docProps/core.xml");
case relationship_type::custom_properties:
return path("/docProps/custom.xml");
case relationship_type::custom_property:
return path("/xl/customProperty.xml");
case relationship_type::custom_xml_mappings:
return path("/xl/customXmlMappings.xml");
case relationship_type::dialogsheet:
return path("/xl/dialogsheets/sheet.xml");
case relationship_type::drawings:
return path("/xl/drawings/drawing.xml");
case relationship_type::extended_properties:
return path("/docProps/app.xml");
case relationship_type::external_workbook_references:
return path("/xl/external.xml");
case relationship_type::hyperlink:
return path("/xl/hyperlink.xml");
case relationship_type::image:
return path("?");
case relationship_type::office_document:
return path("/xl/workbook.xml");
case relationship_type::pivot_table:
return path("/xl/pivotTable.xml");
case relationship_type::pivot_table_cache_definition:
return path("?");
case relationship_type::pivot_table_cache_records:
return path("?");
case relationship_type::printer_settings:
return path("/xl/printerSettings.xml");
case relationship_type::query_table:
return path("/xl/queryTable.xml");
case relationship_type::revision_log:
return path("/xl/revisionLog.xml");
case relationship_type::shared_string_table:
return path("/xl/sharedStrings.xml");
case relationship_type::shared_workbook:
return path("/xl/sharedWorkbook.xml");
case relationship_type::shared_workbook_revision_headers:
return path("?");
case relationship_type::shared_workbook_user_data:
return path("?");
case relationship_type::single_cell_table_definitions:
return path("?");
case relationship_type::stylesheet:
return path("/xl/styles.xml");
case relationship_type::table_definition:
return path("/xl/tableDefinition.xml");
case relationship_type::theme:
return path("/xl/theme/theme1.xml");
case relationship_type::thumbnail:
return path("/docProps/thumbnail.jpg");
case relationship_type::unknown:
return path("/xl/unknown.xml");
case relationship_type::vml_drawing:
return path("/xl/vmlDrawing.xml");
case relationship_type::volatile_dependencies:
return path("/xl/volatileDependencies.xml");
case relationship_type::worksheet:
return path("/xl/worksheets/sheet" + std::to_string(index) + ".xml");
}
default_case(path("/xl/unknownPart.xml"));
}
std::string content_type(xlnt::relationship_type type)
{
using xlnt::relationship_type;
switch (type)
{
case relationship_type::calculation_chain:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml";
case relationship_type::chartsheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml";
case relationship_type::comments:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
case relationship_type::connections:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml";
case relationship_type::core_properties:
return "application/vnd.openxmlformats-package.core-properties+xml";
case relationship_type::custom_properties:
return "application/vnd.openxmlformats-officedocument.custom-properties+xml";
case relationship_type::custom_property:
return "";
case relationship_type::custom_xml_mappings:
return "application/xml";
case relationship_type::dialogsheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml";
case relationship_type::drawings:
return "application/vnd.openxmlformats-officedocument.drawing+xml";
case relationship_type::extended_properties:
return "application/vnd.openxmlformats-officedocument.extended-properties+xml";
case relationship_type::external_workbook_references:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
case relationship_type::hyperlink:
return "";
case relationship_type::image:
return "";
case relationship_type::office_document:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
case relationship_type::pivot_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
case relationship_type::pivot_table_cache_definition:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
case relationship_type::pivot_table_cache_records:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
case relationship_type::printer_settings:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings";
case relationship_type::query_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml";
case relationship_type::revision_log:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml";
case relationship_type::shared_string_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml";
case relationship_type::shared_workbook:
return "";
case relationship_type::shared_workbook_revision_headers:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml";
case relationship_type::shared_workbook_user_data:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml";
case relationship_type::single_cell_table_definitions:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml";
case relationship_type::stylesheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml";
case relationship_type::table_definition:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
case relationship_type::theme:
return "application/vnd.openxmlformats-officedocument.theme+xml";
case relationship_type::thumbnail:
return "image/jpeg";
case relationship_type::unknown:
return "";
case relationship_type::vml_drawing:
return "application/vnd.openxmlformats-officedocument.vmlDrawing";
case relationship_type::volatile_dependencies:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml";
case relationship_type::worksheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
}
default_case("application/xml");
}
} // namespace
namespace xlnt {
@ -309,160 +468,6 @@ workbook::workbook(detail::workbook_impl *impl)
}
}
path default_path(relationship_type type, std::size_t index = 0)
{
switch (type)
{
case relationship_type::calculation_chain:
return path("/xl/calcChain.xml");
case relationship_type::chartsheet:
return path("/xl/sheets/.xml");
case relationship_type::comments:
return path("/xl/comments.xml");
case relationship_type::connections:
return path("/xl/connections.xml");
case relationship_type::core_properties:
return path("/docProps/core.xml");
case relationship_type::custom_properties:
return path("/docProps/custom.xml");
case relationship_type::custom_property:
return path("/xl/customProperty.xml");
case relationship_type::custom_xml_mappings:
return path("/xl/customXmlMappings.xml");
case relationship_type::dialogsheet:
return path("/xl/dialogsheets/sheet.xml");
case relationship_type::drawings:
return path("/xl/drawings/drawing.xml");
case relationship_type::extended_properties:
return path("/docProps/app.xml");
case relationship_type::external_workbook_references:
return path("/xl/external.xml");
case relationship_type::hyperlink:
return path("/xl/hyperlink.xml");
case relationship_type::image:
return path("?");
case relationship_type::office_document:
return path("/xl/workbook.xml");
case relationship_type::pivot_table:
return path("/xl/pivotTable.xml");
case relationship_type::pivot_table_cache_definition:
return path("?");
case relationship_type::pivot_table_cache_records:
return path("?");
case relationship_type::printer_settings:
return path("/xl/printerSettings.xml");
case relationship_type::query_table:
return path("/xl/queryTable.xml");
case relationship_type::revision_log:
return path("/xl/revisionLog.xml");
case relationship_type::shared_string_table:
return path("/xl/sharedStrings.xml");
case relationship_type::shared_workbook:
return path("/xl/sharedWorkbook.xml");
case relationship_type::shared_workbook_revision_headers:
return path("?");
case relationship_type::shared_workbook_user_data:
return path("?");
case relationship_type::single_cell_table_definitions:
return path("?");
case relationship_type::stylesheet:
return path("/xl/styles.xml");
case relationship_type::table_definition:
return path("/xl/tableDefinition.xml");
case relationship_type::theme:
return path("/xl/theme/theme1.xml");
case relationship_type::thumbnail:
return path("/docProps/thumbnail.jpg");
case relationship_type::unknown:
return path("/xl/unknown.xml");
case relationship_type::vml_drawing:
return path("/xl/vmlDrawing.xml");
case relationship_type::volatile_dependencies:
return path("/xl/volatileDependencies.xml");
case relationship_type::worksheet:
return path("/xl/worksheets/sheet" + std::to_string(index) + ".xml");
}
default_case(path("/xl/unknownPart.xml"));
}
std::string content_type(relationship_type type)
{
switch (type)
{
case relationship_type::calculation_chain:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml";
case relationship_type::chartsheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml";
case relationship_type::comments:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
case relationship_type::connections:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml";
case relationship_type::core_properties:
return "application/vnd.openxmlformats-package.core-properties+xml";
case relationship_type::custom_properties:
return "application/vnd.openxmlformats-officedocument.custom-properties+xml";
case relationship_type::custom_property:
return "";
case relationship_type::custom_xml_mappings:
return "application/xml";
case relationship_type::dialogsheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml";
case relationship_type::drawings:
return "application/vnd.openxmlformats-officedocument.drawing+xml";
case relationship_type::extended_properties:
return "application/vnd.openxmlformats-officedocument.extended-properties+xml";
case relationship_type::external_workbook_references:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
case relationship_type::hyperlink:
return "";
case relationship_type::image:
return "";
case relationship_type::office_document:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
case relationship_type::pivot_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
case relationship_type::pivot_table_cache_definition:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
case relationship_type::pivot_table_cache_records:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
case relationship_type::printer_settings:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings";
case relationship_type::query_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml";
case relationship_type::revision_log:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml";
case relationship_type::shared_string_table:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml";
case relationship_type::shared_workbook:
return "";
case relationship_type::shared_workbook_revision_headers:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml";
case relationship_type::shared_workbook_user_data:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml";
case relationship_type::single_cell_table_definitions:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml";
case relationship_type::stylesheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml";
case relationship_type::table_definition:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
case relationship_type::theme:
return "application/vnd.openxmlformats-officedocument.theme+xml";
case relationship_type::thumbnail:
return "image/jpeg";
case relationship_type::unknown:
return "";
case relationship_type::vml_drawing:
return "application/vnd.openxmlformats-officedocument.vmlDrawing";
case relationship_type::volatile_dependencies:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml";
case relationship_type::worksheet:
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
}
default_case("application/xml");
}
void workbook::register_package_part(relationship_type type)
{
if (!manifest().has_relationship(path("/"), type))

View File

@ -1,35 +1,27 @@
cmake_minimum_required(VERSION 3.1)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common.cmake)
project(${LIBRARY_NAME}.test VERSION ${LIBRARY_VERSION} LANGUAGES CXX C)
project(xlnt.test)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT COMBINED_PROJECT)
add_subdirectory(${LIBRARY_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/source)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party ${CMAKE_CURRENT_BINARY_DIR}/third-party)
endif()
include_directories(${LIBRARY_INCLUDE_DIR})
include_directories(${LIBRARY_SOURCE_DIR})
include_directories(${LIBRARY_SOURCE_DIR}/detail)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${THIRD_PARTY_DIR}/cxxtest)
include_directories(${THIRD_PARTY_DIR}/libstudxml)
include_directories(${THIRD_PARTY_DIR}/utfcpp/source)
include_directories(${THIRD_PARTY_DIR}/zlib)
file(GLOB CELL_TESTS ${LIBRARY_SOURCE_DIR}/cell/tests/test_*.hpp)
file(GLOB CHARTS_TESTS ${LIBRARY_SOURCE_DIR}/charts/tests/test_*.hpp)
file(GLOB CHARTSHEET_TESTS ${LIBRARY_SOURCE_DIR}/chartsheet/tests/test_*.hpp)
file(GLOB DRAWING_TESTS ${LIBRARY_SOURCE_DIR}/drawing/tests/test_*.hpp)
file(GLOB FORMULA_TESTS ${LIBRARY_SOURCE_DIR}/formula/tests/test_*.hpp)
file(GLOB PACKAGING_TESTS ${LIBRARY_SOURCE_DIR}/packaging/tests/test_*.hpp)
file(GLOB STYLES_TESTS ${LIBRARY_SOURCE_DIR}/styles/tests/test_*.hpp)
file(GLOB UTILS_TESTS ${LIBRARY_SOURCE_DIR}/utils/tests/test_*.hpp)
file(GLOB WORKBOOK_TESTS ${LIBRARY_SOURCE_DIR}/workbook/tests/test_*.hpp)
file(GLOB WORKSHEET_TESTS ${LIBRARY_SOURCE_DIR}/worksheet/tests/test_*.hpp)
file(GLOB CELL_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/cell/tests/test_*.hpp)
file(GLOB CHARTS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/charts/tests/test_*.hpp)
file(GLOB CHARTSHEET_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/chartsheet/tests/test_*.hpp)
file(GLOB DRAWING_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/drawing/tests/test_*.hpp)
file(GLOB FORMULA_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/formula/tests/test_*.hpp)
file(GLOB PACKAGING_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/packaging/tests/test_*.hpp)
file(GLOB STYLES_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/styles/tests/test_*.hpp)
file(GLOB UTILS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/utils/tests/test_*.hpp)
file(GLOB WORKBOOK_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/workbook/tests/test_*.hpp)
file(GLOB WORKSHEET_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/worksheet/tests/test_*.hpp)
set(XLNT_ZIP
${LIBRARY_SOURCE_DIR}/detail/zstream.cpp
${LIBRARY_SOURCE_DIR}/detail/zstream.hpp)
${CMAKE_CURRENT_SOURCE_DIR}/../source/detail/zstream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../source//detail/zstream.hpp)
set(TESTS ${CELL_TESTS} ${CHARTS_TESTS} ${CHARTSHEET_TESTS} ${DRAWING_TESTS}
${FORMULA_TESTS} ${PACKAGING_TESTS} ${STYLES_TESTS} ${UTILS_TESTS}
@ -48,9 +40,14 @@ if(COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
endif()
add_executable(${PROJECT_NAME} ${TEST_HELPERS} ${TESTS} ${RUNNER} ${XLNT_ZIP})
target_compile_definitions(${PROJECT_NAME} PRIVATE LIBSTUDXML_STATIC_LIB=1)
target_link_libraries(${PROJECT_NAME} xlnt.third-party)
add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER} ${XLNT_ZIP})
target_link_libraries(xlnt.test xlnt)
target_include_directories(xlnt.test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../source
PRIVATE ${CXXTEST_INCLUDE_DIR})
set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR})
source_group(helpers FILES ${TEST_HELPERS})
source_group(xlnt\\detail FILES ${XLNT_ZIP})
@ -67,26 +64,21 @@ source_group(tests\\workbook FILES ${WORKBOOK_TESTS})
source_group(tests\\worksheet FILES ${WORKSHEET_TESTS})
source_group(runner FILES ${RUNNER})
target_link_libraries(${PROJECT_NAME} ${LIBRARY_NAME})
if(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\"")
# Needed for PathFileExists in path_helper
target_link_libraries(${PROJECT_NAME} Shlwapi)
set_target_properties(xlnt.test PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\"")
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
target_link_libraries(xlnt.test Threads::Threads)
endif()
find_package(PythonInterp)
find_package(PythonInterp REQUIRED)
find_package(CxxTest REQUIRED)
add_custom_command(OUTPUT ${RUNNER}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ${RUNNER} ${TESTS}
COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ErrorPrinter -o ${RUNNER} ${TESTS}
DEPENDS ${TESTS}
COMMENT "Generating test runner ${RUNNER}")
add_custom_target(generate-test-runner DEPENDS ${RUNNER})
add_dependencies(${PROJECT_NAME} generate-test-runner)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data DESTINATION ${CMAKE_BINARY_DIR}/bin)
add_dependencies(xlnt.test generate-test-runner)

View File

@ -20,13 +20,20 @@
#include <sys/stat.h>
#endif
#define STRING_LITERAL2(a) #a
#define LSTRING_LITERAL2(a) L#a
#define U8STRING_LITERAL2(a) u8#a
#define STRING_LITERAL(a) STRING_LITERAL2(a)
#define LSTRING_LITERAL(a) STRING_LITERAL2(a)
#define U8STRING_LITERAL(a) STRING_LITERAL2(a)
class path_helper
{
public:
static xlnt::path get_data_directory(const std::string &append = "")
static xlnt::path data_directory(const std::string &append = "")
{
return xlnt::path("data")
.append(xlnt::path(append));
static const std::string data_dir = STRING_LITERAL(XLNT_TEST_DATA_DIR);
return xlnt::path(data_dir).append(xlnt::path(append));
}
static void copy_file(const xlnt::path &source, const xlnt::path &destination, bool overwrite)

View File

@ -1,136 +1,58 @@
cmake_minimum_required(VERSION 3.1)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common.cmake)
project(${LIBRARY_NAME}.third-party VERSION ${LIBRARY_VERSION} LANGUAGES CXX C)
cmake_minimum_required(VERSION 3.2)
project(xlnt.third-party)
# Includes
include_directories(libstudxml
utfcpp/source
zlib
cryptopp
${LIBRARY_SOURCE_DIR}/detail)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(ZLIB REQUIRED)
find_package(CryptoPP REQUIRED)
find_package(CxxTest REQUIRED)
set(LIBSTUDXML_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libstudxml)
set(LIBSTUDXML
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/parser.cxx
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/qname.cxx
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/serializer.cxx
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/value-traits.cxx
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/content
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/exception
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/forward
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/parser
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/qname
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/serializer
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/value-traits)
${LIBSTUDXML_ROOT_DIR}/xml/parser.cxx
${LIBSTUDXML_ROOT_DIR}/xml/qname.cxx
${LIBSTUDXML_ROOT_DIR}/xml/serializer.cxx
${LIBSTUDXML_ROOT_DIR}/xml/value-traits.cxx
${LIBSTUDXML_ROOT_DIR}/xml/content
${LIBSTUDXML_ROOT_DIR}/xml/exception
${LIBSTUDXML_ROOT_DIR}/xml/forward
${LIBSTUDXML_ROOT_DIR}/xml/parser
${LIBSTUDXML_ROOT_DIR}/xml/qname
${LIBSTUDXML_ROOT_DIR}/xml/serializer
${LIBSTUDXML_ROOT_DIR}/xml/value-traits)
set(EXPAT
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmlparse.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmlrole.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmltok_impl.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmltok_ns.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmltok.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/ascii.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/asciitab.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/config.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/expat_external.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/expat.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/iasciitab.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/internal.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/latin1tab.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/nametab.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/utf8tab.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmlrole.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmltok_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/expat/xmltok.h)
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmlparse.c
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmlrole.c
# ${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_impl.c
# ${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_ns.c
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok.c
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/ascii.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/asciitab.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/config.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/expat_external.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/expat.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/iasciitab.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/internal.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/latin1tab.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/nametab.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/utf8tab.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmlrole.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_impl.h
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok.h)
set(GENX
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/genx/char-props.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/genx/genx.c
${CMAKE_CURRENT_SOURCE_DIR}/libstudxml/xml/details/genx/genx.h)
${LIBSTUDXML_ROOT_DIR}/xml/details/genx/char-props.c
${LIBSTUDXML_ROOT_DIR}/xml/details/genx/genx.c
${LIBSTUDXML_ROOT_DIR}/xml/details/genx/genx.h)
set(ZLIB ${CMAKE_CURRENT_SOURCE_DIR}/zlib/adler32.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/compress.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/crc32.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/deflate.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/infback.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inffast.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inflate.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inftrees.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/trees.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/uncompr.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.c
${CMAKE_CURRENT_SOURCE_DIR}/zlib/crc32.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/deflate.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inffast.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inffixed.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inflate.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/inftrees.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/trees.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib.h
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.h)
add_library(libstudxml STATIC ${LIBSTUDXML} ${EXPAT} ${GENX})
target_compile_definitions(libstudxml PUBLIC LIBSTUDXML_STATIC_LIB=1)
target_include_directories(libstudxml PUBLIC ${LIBSTUDXML_ROOT_DIR})
file(GLOB CRYPTOPP ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/*.cpp)
list(REMOVE_ITEM CRYPTOPP
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/simple.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rdrand.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/pch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/cryplib_bds.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/bench1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/bench2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat0.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat3.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/adhoc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/datatest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/regtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/fipsalgt.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/dlltest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/fipstest.cpp)
if(MINGW OR WIN32)
list(APPEND CRYPTOPP ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp)
endif()
if(NOT MSVC)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/basecode.cpp PROPERTIES
COMPILE_FLAGS "-Wno-unused-private-field")
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rw.cpp PROPERTIES
COMPILE_FLAGS "-Wno-unused-const-variable")
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/filters.cpp PROPERTIES
COMPILE_FLAGS "-Wno-reorder")
endif()
if(NOT MSVC)
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "-Wno-implicit-function-declaration")
else()
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "/wd\"4018\"")
endif()
add_library(xlnt.third-party STATIC
${LIBSTUDXML}
${GENX}
${EXPAT}
${ZLIB}
${CRYPTOPP})
target_compile_definitions(xlnt.third-party
PRIVATE LIBSTUDXML_STATIC_LIB=1
PRIVATE NO_OS_DEPENDENCE=1
PRIVATE CRYPTOPP_DISABLE_ASM=1)
if(NOT STATIC)
set_target_properties(xlnt.third-party PROPERTIES POSITION_INDEPENDENT_CODE 1)
endif()
if(MSVC)
target_compile_definitions(xlnt.third-party PRIVATE
_CRT_SECURE_NO_WARNINGS=1
NOMINMAX)
set_target_properties(xlnt.third-party PROPERTIES COMPILE_FLAGS "/MP")
endif()
source_group(libstudxml FILES ${LIBSTUDXML})
source_group(libstudxml\\genx FILES ${GENX})
source_group(libstudxml\\expat FILES ${EXPAT})
source_group(zlib FILES ${ZLIB})
add_custom_target(libstudxml-config)
add_custom_command(TARGET libstudxml-config PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_CURRENT_SOURCE_DIR}/../source/detail/xml/details/config.h
${LIBSTUDXML_ROOT_DIR}/xml/details)
add_dependencies(libstudxml libstudxml-config)

108
third-party/FindCryptoPP.cmake vendored Normal file
View File

@ -0,0 +1,108 @@
# Module for locating the Crypto++ encryption library.
#
# Customizable variables:
# CRYPTOPP_ROOT_DIR
# This variable points to the CryptoPP root directory. On Windows the
# library location typically will have to be provided explicitly using the
# -D command-line option. The directory should include the include/cryptopp,
# lib and/or bin sub-directories.
#
# Read-only variables:
# CRYPTOPP_FOUND
# Indicates whether the library has been found.
#
# CRYPTOPP_INCLUDE_DIRS
# Points to the CryptoPP include directory.
#
# CRYPTOPP_LIBRARIES
# Points to the CryptoPP libraries that should be passed to
# target_link_libararies.
#
#
# Copyright (c) 2012 Sergiu Dotenco
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
INCLUDE (FindPackageHandleStandardArgs)
FIND_PATH (CRYPTOPP_ROOT_DIR
NAMES cryptopp/cryptlib.h include/cryptopp/cryptlib.h
PATHS ENV CRYPTOPPROOT
DOC "CryptoPP root directory")
# Re-use the previous path:
FIND_PATH (CRYPTOPP_INCLUDE_DIR
NAMES cryptopp/cryptlib.h
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES include
DOC "CryptoPP include directory")
FIND_LIBRARY (CRYPTOPP_LIBRARY_DEBUG
NAMES cryptlibd cryptoppd
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES lib
DOC "CryptoPP debug library")
FIND_LIBRARY (CRYPTOPP_LIBRARY_RELEASE
NAMES cryptlib cryptopp
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES lib
DOC "CryptoPP release library")
IF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
SET (CRYPTOPP_LIBRARY
optimized ${CRYPTOPP_LIBRARY_RELEASE}
debug ${CRYPTOPP_LIBRARY_DEBUG} CACHE DOC "CryptoPP library")
ELSEIF (CRYPTOPP_LIBRARY_RELEASE)
SET (CRYPTOPP_LIBRARY ${CRYPTOPP_LIBRARY_RELEASE} CACHE DOC
"CryptoPP library")
ENDIF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
IF (CRYPTOPP_INCLUDE_DIR)
SET (_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/cryptopp/config.h)
IF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
FILE (STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION_TMP REGEX
"^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
STRING (REGEX REPLACE
"^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH
${_CRYPTOPP_VERSION_TMP})
SET (CRYPTOPP_VERSION_COUNT 3)
SET (CRYPTOPP_VERSION
${CRYPTOPP_VERSION_MAJOR}.${CRYPTOPP_VERSION_MINOR}.${CRYPTOPP_VERSION_PATCH})
ENDIF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
ENDIF (CRYPTOPP_INCLUDE_DIR)
SET (CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIR})
SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY})
MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG
CRYPTOPP_LIBRARY_RELEASE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_ROOT_DIR
CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION)

@ -1 +0,0 @@
Subproject commit 1a17ade299c3a05e5a63a8cb3f390d21845c21c6

1
third-party/cxxtest vendored

@ -1 +0,0 @@
Subproject commit 191adddb3876ab389c0c856e1c03874bf70f8ee4

1
third-party/utfcpp vendored

@ -1 +0,0 @@
Subproject commit a5ad5ec9d936d63e9c010d1054f8b11fed0fabbc

1
third-party/zlib vendored

@ -1 +0,0 @@
Subproject commit 94575859cf7f657f0f31aff4c50761fe3f182699