Compare commits

...

1016 Commits

Author SHA1 Message Date
Thomas Fussell 297b331435
Merge pull request #667 from Teebonne/patch-7
Disambiguation from other max/min functions
2022-12-03 11:45:01 -06:00
Thomas Fussell 80a692725c
Merge pull request #665 from Teebonne/patch-5
Fixes error LNK2019: unresolved external symbol
2022-12-03 10:34:23 -06:00
Thomas Fussell 3c948d8555
Merge pull request #663 from JonLiu1993/vcpkg-installition
Add vcpkg installation instructions
2022-12-03 10:28:48 -06:00
Thomas Fussell a5bf4f57bd
Merge pull request #659 from Teebonne/patch-4
option OFF by default for building test executable
2022-12-03 10:28:06 -06:00
Jonliu1993 d9606cb0ae Apply review suggesstion 2022-10-10 09:53:54 +08:00
Teebonne f49bb7633e
Merge branch 'master' into patch-4 2022-10-09 17:02:12 +01:00
Teebonne e9f937eefc
Update config.yml 2022-10-09 16:46:51 +01:00
Teebonne d88a84ff1b
Update .appveyor.yml 2022-10-09 16:45:55 +01:00
Teebonne 9b752b7e0b
Merge branch 'master' into patch-7 2022-10-09 16:23:23 +01:00
Teebonne e55ac4f896
Merge branch 'master' into patch-5 2022-10-09 16:15:11 +01:00
Thomas Fussell f0801fb7c7
Merge pull request #658 from Teebonne/patch-3
Fixes warning C4127: conditional expression is constant
2022-10-09 09:32:59 -05:00
Thomas Fussell 1cd5357ddb
Merge pull request #657 from Teebonne/patch-2
Fixes float warnings
2022-10-09 09:30:59 -05:00
Thomas Fussell d62b267448
Merge pull request #655 from musshorn/active_sheet
Added the ability to set the active sheet
2022-10-09 09:27:09 -05:00
Thomas Fussell b96d986010
Merge pull request #654 from musshorn/master
Update documentation to make building from source clearer
2022-10-09 09:24:15 -05:00
Teebonne 73f518ca98
Disambiguation from other max/min functions
Disambiguation from other max/min functions
2022-09-08 20:42:17 +01:00
Teebonne a6ff22e95b
Fixes error LNK2019: unresolved external symbol
This fixes the error LNK2019: unresolved external symbol "__declspec(dllimport) public: that I had.
2022-09-03 22:28:38 +01:00
Jonliu1993 381b33ecc7 Add vcpkg installation instructions 2022-09-01 14:41:44 +08:00
Teebonne 707abfb941
option OFF by default for building test executable
It seems better to leave the option OFF by default for building test executable
2022-08-30 00:45:23 +01:00
Teebonne 73962b8a79
Fixes warning C4127: conditional expression is constant
Fixes warning C4127: conditional expression is constant
2022-08-29 23:31:51 +01:00
Teebonne 2137a7a243
Fixes float warnings
Fixes warning C4305: 'initializing': truncation from 'double' to 'float'
Fixes warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
2022-08-29 22:17:42 +01:00
snippet c21014c0fd Added the ability to set the active sheet
Closes #653
2022-08-29 18:30:48 +10:00
snippet 1faa8b4990 Removed zip download, they don't work with submodules. Added vcpkg command 2022-08-24 08:25:38 +10:00
Thomas Fussell fbae8cd6c1
Merge pull request #652 from tfussell/fix-merge-cell-count
Ignore merge cell count
2022-08-21 20:58:40 -05:00
Thomas Fussell 4c79627553 ignore merge cell count 2022-08-21 20:42:45 -05:00
Thomas Fussell 5620e5be7a
Merge pull request #651 from tfussell/fix-range-iterator-decrement
Fix bug in decrement method of range_iterator for column-major order
2022-08-21 20:39:49 -05:00
Thomas Fussell d45e831f47 fix copy-and-paste bug 2022-08-21 11:18:20 -05:00
Thomas Fussell c689943a63
Merge pull request #650 from tfussell/defined-names
Implement defined names
2022-08-21 11:09:55 -05:00
Thomas Fussell a52bcd5fef implement defined names 2022-08-21 10:57:02 -05:00
Thomas Fussell f1107a5b0f
Merge pull request #649 from tfussell/fix-cell-reference-hash
Import functional in cell_reference.hpp to fix build
2022-08-13 15:21:48 -05:00
Thomas Fussell 8a5f208b3a fix cell_reference hash import 2022-08-13 15:07:31 -05:00
Thomas Fussell 1945691bb6
Merge pull request #647 from tfussell/shared-array-formulas
Implement shared and array formulas
2022-08-13 13:38:01 -05:00
Thomas Fussell bf92dd7640 implement shared and array formulas 2022-08-13 13:20:25 -05:00
Thomas Fussell 69a20f3627
Merge pull request #646 from tfussell/fix-unhandled-values-in-switch
Fix unhandled enumeration values in switch statement
2022-08-13 09:15:17 -05:00
Thomas Fussell 5c2fdff70f fix unhandled enumeration values in switch statement 2022-08-13 08:52:32 -05:00
Thomas Fussell 538f80794c
Merge pull request #635 from Blakjak88/master
fix writing of missing showGridLines attribute to xlsx file
2022-08-07 14:12:15 -05:00
Blakjak88 6b5755af30
Update xlsx_producer.cpp
show_grid_lines() is default enabled in Excel so attribute should only be written when it is set to false. 

Added 'if-statement' to check for 'false' before writing attribute.
2022-08-07 11:11:15 +08:00
Thomas Fussell f3bbaa3eeb
Merge pull request #628 from softvise/softvise/patches
Fix format::number_format
2022-08-06 13:53:08 -05:00
Thomas Fussell ef4dec6ebc
Merge pull request #617 from beached/patch-1
Missing include in number_formatter.cpp
2022-08-06 12:13:04 -05:00
Thomas Fussell 80cdf8ff46
Merge branch 'master' into patch-1 2022-08-06 12:11:05 -05:00
Thomas Fussell 8b0cd6a935
Merge pull request #618 from tfussell/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-08-06 12:10:16 -05:00
Thomas Fussell c70abb76d3
Merge branch 'master' into dependabot/npm_and_yarn/minimist-1.2.6 2022-08-06 12:10:07 -05:00
Thomas Fussell 93a46a867d
Merge pull request #634 from tfussell/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.1 to 2.6.7
2022-08-06 12:09:56 -05:00
dependabot[bot] 772cd8e9d2
Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-06 17:05:20 +00:00
dependabot[bot] baa41b9722
Bump node-fetch from 2.6.1 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-06 17:05:19 +00:00
Thomas Fussell fea07a81d3
Merge pull request #645 from tfussell/dependabot/npm_and_yarn/ansi-regex-4.1.1
Bump ansi-regex from 4.1.0 to 4.1.1
2022-08-06 12:04:31 -05:00
dependabot[bot] d35868d70f
Bump ansi-regex from 4.1.0 to 4.1.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-06 16:39:27 +00:00
Thomas Fussell 1d542f0d8b
Merge pull request #636 from tfussell/dependabot/npm_and_yarn/parse-url-6.0.2
Bump parse-url from 6.0.0 to 6.0.2
2022-08-06 11:39:05 -05:00
dependabot[bot] bf0018899d
Bump parse-url from 6.0.0 to 6.0.2
Bumps [parse-url](https://github.com/IonicaBizau/parse-url) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/IonicaBizau/parse-url/releases)
- [Commits](https://github.com/IonicaBizau/parse-url/commits)

---
updated-dependencies:
- dependency-name: parse-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 23:42:50 +00:00
Blakjak88 dbfed051c8
Update xlsx_producer.cpp 2022-07-05 12:53:47 +08:00
Markus Färber cef67bdc45 Fix format::number_format
In case number_format() is called on a format that does not have
format ID set, number_format() dereferences
d_->parent->number_formats.end() causing a crash.
This might happen when calling cell::is_date() on a cell that has type
'number' without a number format but some other styling set.
This might never occur in spreadsheet files created by commercial
applications but xlnt certainly allows to create such a file.
We therefore fix number_format here by returning the general number
format as a fallback.
2022-05-10 14:50:20 +02:00
Darrell Wright 4da810eaef
Missing include in number_formatter.cpp
Limits isn't being transitively included on gcc 11.2.0/ubuntu.  Added as it produces an error
2022-03-18 18:46:27 -04:00
Thomas Fussell d88c901faa
Merge pull request #608 from imgspc/iter_has_value
Add has_value to cell_iterator
2022-01-09 17:42:00 -05:00
Thomas Fussell 0246c7bece
Merge pull request #607 from doomlaur/bugfix/windows_utf16_paths
Paths on Windows are now correctly converted from UTF-8 to UTF-16
2022-01-09 17:41:18 -05:00
Thomas Fussell 69f651e3a1
Merge pull request #601 from doomlaur/bugfix/system_default_date_time
Added support for the System Default locale for the Time and Long Date types
2022-01-09 17:39:04 -05:00
Thomas Fussell 09dd4797b4
Merge pull request #600 from doomlaur/bugfix/streaming_reader_clean_cell_state
The streaming cell now always begins with a clean state when using the xlnt::streaming_workbook_reader
2022-01-09 17:37:18 -05:00
Thomas Fussell 0193ae7b37
Merge pull request #584 from wuganhao/feature/print-settings
Fix - Print Settings (Page Size, margins, etc) not saved when loading a file and save it.
2022-01-09 17:35:32 -05:00
Thomas Fussell 7e90dad59c
Merge branch 'master' into feature/print-settings 2022-01-09 16:43:16 -05:00
Félix Bourbonnais 5ff980854a
Merge branch 'master' into iter_has_value 2021-12-09 14:13:21 -05:00
Laurențiu Leahu-Vlăducu 732cbe05b5
Merge branch 'master' into bugfix/windows_utf16_paths 2021-12-09 16:49:46 +01:00
Laurențiu Leahu-Vlăducu 8c584321a5
Paths on Windows are now correctly converted from UTF-8 to UTF-16 instead of UCS-2. This fixes issues with file paths that use 2 wchar_t characters / 4 bytes, also called surrogate pairs. Modified the unit tests to test this case. 2021-12-09 16:42:18 +01:00
Félix Bourbonnais 28f7e6fa69 Add has_value to cell_iterator
When iterating over a range that doesn't ignore null rows/columns,
the operator*() throws when dereferencing an iterator to a null cell.
Add has_value() to cell_iterator to be able to make a check without
relying on exceptions.
And add a test case.
2021-12-08 15:49:14 -05:00
Thomas Fussell 0cc90971b0
Merge pull request #604 from daixtrose/patch-1
add c++ code syntax highlighting
2021-12-06 16:18:26 -06:00
Markus Werle 919d341fb9
add c++ code rendering to markdwon text 2021-12-06 21:30:07 +01:00
Laurențiu Leahu-Vlăducu 2f2e0a37a4
Adapted the format_locale enum to include the System Default locale for the Date and Time types. 2021-12-01 23:34:20 +01:00
Laurențiu Leahu-Vlăducu 147307c90b
Added support for the System Default locale for the Time and Long Date types in Excel, as explained here: https://bz.apache.org/ooo/show_bug.cgi?id=70003
This fixes issues with some locales where "system default" is the default setting for times and dates. This happens, for example, when using German (Austria) as a locale in Windows, or when setting it manually in Excel.
2021-12-01 19:58:25 +01:00
Laurențiu Leahu-Vlăducu f6f4adca7d
Fixed a bug when using the xlnt::streaming_workbook_reader where a streaming cell could still contain information from the previously streamed cell. This could happen if the new cell did not contain information that could override the information of the previous cell, e.g. when the cell in XML only contained something like <c r="H4"/>, so the streamed cell still contained the type and the string/value of the previously streamed cell. 2021-12-01 14:09:37 +01:00
Wu, Ganhao c9d896c816 Fix character set error when compiling under non-English Windows. 2021-09-04 02:15:55 +08:00
Wu, Ganhao b81d76a223 Fix test case - page size now optional. 2021-09-04 02:15:19 +08:00
Wu, Ganhao 1be73c40f8 Fix character set error when compiling under non-English Windows. 2021-09-04 01:18:38 +08:00
Wu, Ganhao 5946eec32e Fix - Print Settings (Page Size, margins, etc) not saved when loading a file and save it. 2021-08-29 02:56:57 +08:00
Thomas Fussell 3a279fcaab
Merge pull request #580 from pomer/master
LibreOffice color names support
2021-08-22 09:04:11 -04:00
Thomas Fussell 94d784f68e
Merge pull request #575 from LorenDB/patch-1
Add shell description of AUR package
2021-08-22 09:03:06 -04:00
Thomas Fussell a736834902
Merge branch 'master' into patch-1 2021-08-22 09:01:00 -04:00
Thomas Fussell 10ff20c943 Merge branch 'imgspc-Issue484/fix-calculate-dimension-when-not-skipping-nulls' 2021-08-22 08:59:57 -04:00
Thomas Fussell 50a792a01a Merge branch 'Issue484/fix-calculate-dimension-when-not-skipping-nulls' of https://github.com/imgspc/xlnt into imgspc-Issue484/fix-calculate-dimension-when-not-skipping-nulls 2021-08-22 08:59:05 -04:00
Thomas Fussell bb7bc8c01d
Merge pull request #539 from sphawk/master
Minimum support for xlsm
2021-08-22 08:49:33 -04:00
Thomas Fussell 04b6b97577
Merge branch 'master' into master 2021-08-22 08:41:01 -04:00
Thomas Fussell febb4c6043
Merge pull request #582 from tfussell/maintenance
General maintenance
2021-08-22 08:36:50 -04:00
Thomas Fussell 04ebd7ef9d fix warnings, bump copyright, fix typo, update npm libs 2021-08-22 08:23:18 -04:00
Vladimir S. Yakovlev 99372e3f11 LibreOffice color names support 2021-08-17 00:46:39 +03:00
Loren Burkholder 5d89cf32c9
Add shell description of AUR package
Seems like this should at least be documented...
2021-07-19 16:52:34 -04:00
Sewon Park c160db4ef6
Merge branch 'master' into master 2021-06-24 15:45:51 +09:00
vkovec 4294e31253 include first empty rows and columns in range if skip_null false 2021-04-16 11:44:13 -04:00
Thomas Fussell 20f3dac28b reenable tests 2021-02-23 19:36:07 -04:00
Thomas Fussell 74fc642676 work on strikethrough for #530 2021-02-21 16:52:03 -04:00
Thomas Fussell 7f51eed107 os-independent weekday calculation 2021-02-21 08:18:26 -04:00
Thomas Fussell 70eb0d4e66 undef min and max, fixes #545 2021-02-21 08:00:10 -04:00
Thomas Fussell 65252b3a7d appveyor too 2021-02-20 22:43:57 -04:00
Thomas Fussell 705827c88e fix syntax 2021-02-20 22:34:24 -04:00
Thomas Fussell d0844421e5 checkout submodules in circleci 2021-02-20 22:33:30 -04:00
Thomas Fussell 60b2d9cfd1 ignore nullptr warning in libstudxml, update to latest beta 9, and switch to submodule 2021-02-20 22:29:59 -04:00
Thomas Fussell e15e47590c remove libstudxml 2021-02-20 18:34:53 -04:00
Sewon Park 7f44dc2274 minimum support for xlsm 2021-01-21 21:45:24 +09:00
Thomas Fussell e66e417b0c
Merge pull request #525 from kbelyaev/memory_leaks_fix
Memory leaks fix
2021-01-03 19:44:46 -05:00
Thomas Fussell f0da7f61bb
Merge branch 'master' into memory_leaks_fix 2021-01-03 19:31:11 -05:00
Thomas Fussell 7fca8fc9b9
Merge pull request #537 from tfussell/warning-and-memory
Fix compiler warnings and some valgrind problems
2021-01-03 19:30:38 -05:00
Thomas Fussell 6987c1f233 add constructor 2021-01-03 19:04:41 -05:00
Thomas Fussell a8b631bcbb replace enable_if_t 2021-01-03 18:42:56 -05:00
Thomas Fussell c007dafe33 add include 2021-01-03 18:26:48 -05:00
Thomas Fussell 1868128dda
Merge branch 'master' into memory_leaks_fix 2021-01-03 12:22:12 -05:00
Thomas Fussell e53ef68469 fix compiler warnings and some valgrind problems 2021-01-03 12:20:46 -05:00
Thomas Fussell 98e80133ae
Merge pull request #533 from tfussell/time-struct-warning
Fix time struct warning on linux
2021-01-03 10:31:50 -05:00
Thomas Fussell 23244120fb
Merge branch 'master' into time-struct-warning 2021-01-03 10:15:46 -05:00
Thomas Fussell 35687270e5
Merge pull request #536 from tfussell/gcc4-compat
Fix GCC 4.8.2 build problems
2021-01-03 09:53:52 -05:00
Thomas Fussell 0039eab40d fix gcc 4.8.2 build problems 2021-01-03 09:33:43 -05:00
Thomas Fussell b9a1b48811
Merge branch 'master' into time-struct-warning 2021-01-02 16:09:15 -05:00
Thomas Fussell f99cf3bde0
Merge pull request #535 from tfussell/fix-build
Fix build
2021-01-02 16:09:00 -05:00
Thomas Fussell 0f76a282ca update npm deps 2021-01-02 15:36:08 -05:00
Thomas Fussell c5d449915f fix shared string handling 2021-01-02 15:28:14 -05:00
Thomas Fussell 18e82f35d3 Revert "Shared strings"
This reverts commit d6262df555.
2021-01-02 15:20:56 -05:00
Thomas Fussell e9ec6a3dd1
Merge branch 'master' into time-struct-warning 2021-01-02 15:08:21 -05:00
Thomas Fussell 863372331f
Merge pull request #532 from tfussell/dependabot/npm_and_yarn/ini-1.3.8
Bump ini from 1.3.5 to 1.3.8
2021-01-02 15:08:06 -05:00
Thomas Fussell e6e00de51d
Merge branch 'master' into dependabot/npm_and_yarn/ini-1.3.8 2021-01-02 15:07:49 -05:00
Thomas Fussell bf90210d26
Merge pull request #529 from emmanuel099/worksheet_empty
worksheet: Add method to check if the worksheet is empty
2021-01-02 15:07:29 -05:00
Thomas Fussell ca2abc9ddc
Merge branch 'master' into worksheet_empty 2021-01-02 15:07:08 -05:00
Thomas Fussell 5b94bc60c0
Merge pull request #528 from emmanuel099/workbook_check_out_of_range_in_sheet_by_index
workbook: Throw if index in (const) sheet_by_index is out of range
2021-01-02 15:06:40 -05:00
dependabot[bot] 263678758c
Bump ini from 1.3.5 to 1.3.8
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-02 20:06:25 +00:00
Thomas Fussell c448d9788a
Merge branch 'master' into workbook_check_out_of_range_in_sheet_by_index 2021-01-02 15:06:21 -05:00
Thomas Fussell 059c3bd8cd
Merge pull request #513 from tfussell/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2021-01-02 15:05:38 -05:00
Thomas Fussell 39071e6abe
Merge branch 'master' into dependabot/npm_and_yarn/node-fetch-2.6.1 2021-01-02 15:05:28 -05:00
Thomas Fussell d913eec9f4
Merge pull request #512 from softmarch/issue-504-select-multiple-cells
Fixed multiple cell throw exception.
2021-01-02 15:05:09 -05:00
Thomas Fussell 4b91281280
Merge branch 'master' into issue-504-select-multiple-cells 2021-01-02 15:05:02 -05:00
Thomas Fussell 7e40e73601
Merge pull request #510 from softmarch/issue-509-count-missing
Fix the missing count of fonts and throw an exception.
2021-01-02 15:04:44 -05:00
Thomas Fussell 3f3bb97158
Merge branch 'master' into dependabot/npm_and_yarn/node-fetch-2.6.1 2021-01-02 15:03:50 -05:00
Thomas Fussell 647b5c07cb
Merge branch 'master' into issue-504-select-multiple-cells 2021-01-02 15:03:24 -05:00
Thomas Fussell 90868bdb2a
Merge branch 'master' into issue-509-count-missing 2021-01-02 15:02:37 -05:00
Thomas Fussell 10e0dd69f7
Merge pull request #508 from softmarch/issue-494-shared-string
Fix throwing exception when duplicate shared strings occur.
2021-01-02 15:01:49 -05:00
Thomas Fussell c31b2aa51d
Merge branch 'master' into issue-494-shared-string 2021-01-02 15:01:41 -05:00
Thomas Fussell 71f00e8941
Merge pull request #507 from softmarch/feature/hidden-sheet
Add the function of getting table hidden attributes.
2021-01-02 14:58:55 -05:00
Thomas Fussell 08e51ccdc0
Merge branch 'master' into feature/hidden-sheet 2021-01-02 14:58:47 -05:00
Thomas Fussell bfbfd6e94f
Merge pull request #506 from softmarch/issue_503_external_link
Fixed an exception thrown when parsing external links.
2021-01-02 14:58:28 -05:00
Thomas Fussell f6e43a312d
Merge branch 'master' into feature/hidden-sheet 2021-01-02 14:57:12 -05:00
Thomas Fussell dd215794db
Merge branch 'master' into issue_503_external_link 2021-01-02 14:54:31 -05:00
Thomas Fussell 4bd0f4df56
Merge pull request #501 from softmarch/issue-498-extlist
Fixed an exception that was thrown when the property's namespace is a web address.
2021-01-02 14:46:43 -05:00
Thomas Fussell 51406e4755
Merge pull request #428 from Johann1994/master
sharedstring table #427
2021-01-02 14:46:16 -05:00
Thomas Fussell 566d83d447
Merge branch 'master' into master 2021-01-02 14:41:10 -05:00
Thomas Fussell b6d566f1f7
Merge branch 'master' into time-struct-warning 2021-01-02 14:39:00 -05:00
Thomas Fussell 140e280210
Merge pull request #534 from tfussell/circleci
Translate travis to circleci
2021-01-02 14:38:47 -05:00
Thomas Fussell e702e7e68b remove requires 2021-01-02 12:50:27 -05:00
Thomas Fussell 27e95fd7a8 Merge branch 'circleci' of github.com:tfussell/xlnt into circleci 2021-01-02 12:49:43 -05:00
Thomas Fussell e6ecd04265 use smaller image 2021-01-02 12:49:36 -05:00
Thomas Fussell 48b3fc7383
Merge branch 'master' into circleci 2021-01-02 12:36:31 -05:00
Thomas Fussell c89c4d951a
Merge pull request #493 from adamhooper/issue-492-stream-empty-row
Streaming: skip empty rows in has_cell()/read_cell()
2021-01-02 12:36:10 -05:00
Thomas Fussell ac771ac7e7 translate travis to circleci 2021-01-02 12:32:51 -05:00
Thomas Fussell 3127e9c016
Merge branch 'master' into issue-492-stream-empty-row 2021-01-02 10:46:19 -05:00
Thomas Fussell a96c288036 fix time struct warning on gcc 2021-01-02 10:42:21 -05:00
Emmanuel Pescosta 3225f357dd
workbook: Throw if index in (const) sheet_by_index is out of range
The documentation of (const) sheet_by_index already mentions that
invalid_parameter exception will be thrown if the index is out of
range, but the implementation was missing.
2020-12-02 11:06:56 +01:00
Emmanuel Pescosta 9df7c83ca6
worksheet: Add method to check if the worksheet is empty
A worksheet is considered empty if it doesn't have any cells.
2020-12-02 10:59:29 +01:00
kira 687af90735 Memory leaks fix 2020-11-20 15:24:47 +03:00
dependabot[bot] a50ec35ded
Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 17:12:09 +00:00
胡剑波 e9a9946856 Fixed multiple cell throw exception. 2020-08-25 19:57:07 +08:00
胡剑波 dc9f550429 Fix the missing count of fonts and throw an exception. 2020-08-25 16:40:33 +08:00
胡剑波 e8dd38d0d6 Fix throwing exception when duplicate shared strings occur. 2020-08-25 15:08:20 +08:00
胡剑波 dafdfa3ebb Add the function of getting table hidden attributes. 2020-08-25 13:32:21 +08:00
胡剑波 0ecad78c1d Fixed an exception thrown when parsing external links. 2020-08-25 09:00:22 +08:00
Thomas Fussell 3c7122a78c
Merge pull request #490 from 50ty/patch-2
Fix XLNT_INCLUDE_INSTALL_DIR
2020-08-20 14:59:22 -04:00
胡剑波 4da7183b1c Fixed an exception that was thrown when the namespace in the external link is a web address. 2020-08-12 16:36:30 +08:00
Adam Hooper 319c4197c1
Streaming: skip empty rows in has_cell()/read_cell()
Previously, an empty row would mess with the parser: if we're in an
empty row, our helper methods don't detect us as being in the "row" _or_
in the "sheetData". So `has_cell()` would return false when it
shouldn't. Similarly, `read_cell()` wouldn't skip rows; so `read_cell()`
would return an invalid cell when placed in an empty row, causing a
segfault when the caller tried to use the cell.

Callers must take care to call `has_next()` before `read_next()`. In
the future, perhaps we can make `read_next()` return a `std::optional`
and nix `has_next()` altogether?

[Closes #492]
2020-07-28 15:29:12 -04:00
Stefan Rommel cdb50bbd6b
Fix XLNT_INCLUDE_INSTALL_DIR
Otherwise, XLNT_INCLUDE_INSTALL_DIR is not set correctly and find_package(Xlnt) results to an error:
 ```
CMake Error at /usr/lib64/cmake/xlnt/XlntConfig.cmake:23 (message):
  File or directory include referenced by variable XLNT_INCLUDE_DIR does not
  exist !
Call Stack (most recent call first):
  /usr/lib64/cmake/xlnt/XlntConfig.cmake:41 (set_and_check)
  CMakeLists.txt:4 (find_package)
```
The content of the line 41 of /usr/lib64/cmake/xlnt/XlntConfig.cmake is: `set_and_check(XLNT_INCLUDE_DIR "include")`. 

I'm using the Arch Linux user repository package https://aur.archlinux.org/packages/xlnt/.
The used build manual is described here: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=xlnt.
2020-07-16 21:29:06 +02:00
Thomas Fussell 8d2a8e161b
Merge pull request #467 from Crzyrndm/experimental/serialisation
locale aware double->string conversions
2020-06-08 19:40:08 -04:00
JCrawfy 06801f7d36 derp, need typename too 2020-04-26 15:54:49 +12:00
JCrawfy 6c5a5a5dae and same issue with is_convertible 2020-04-26 15:49:05 +12:00
JCrawfy f1042c5119 enable_if_t isn't a thing in C++11 2020-04-26 15:47:53 +12:00
JCrawfy 504fed3585 another missing header 2020-04-26 15:40:56 +12:00
JCrawfy 9d9d5de511 add missing include 2020-04-26 15:27:51 +12:00
JCrawfy 556d3358e9 fix bad commit 2020-04-26 14:53:15 +12:00
JCrawfy d30e705f83 fix most (all?) the places where string<->double conversions are performed
strod / stod / to_string and all related friends are dependant on current locale for how they format a number
2020-04-25 14:00:58 +12:00
JCrawfy dfb8f1518e Revert "redo serialisation by using a sorted vector instead of a lookup for each possible row/column combination"
This reverts commit 63484f8b8f.
2020-04-25 11:15:23 +12:00
JCrawfy 63484f8b8f redo serialisation by using a sorted vector instead of a lookup for each possible row/column combination
Not tested, definitely not as correct as previous implementation
2020-04-25 11:00:39 +12:00
JCrawfy 9136d21845 move the simplified cell_reference and cell structs out to a header
the standard xlnt::cell and xlnt::cell_reference have plenty of extra functionality that just slows things down during (de)serialisation
These intermediate structs can be used to minimise overhead before transforming to the final type
2020-04-25 11:00:39 +12:00
JCrawfy 1069c17fbe fixup comment in parser 2020-04-25 11:00:39 +12:00
JCrawfy e8e29e9c18 resolve some warnings (unintialised variables), remove warning suppression 2020-04-25 11:00:39 +12:00
Thomas Fussell d1d9553d4e
Merge pull request #454 from Tectu/master
Remove superfluous semicolon
2020-03-25 14:16:20 -04:00
Joel Bodenmann 4e0333ac91 Remove superfluous semicolon 2020-03-25 13:16:02 +01:00
Thomas Fussell 568ac85346
release v1.5.0 2020-03-21 15:19:37 -04:00
Thomas Fussell 05fb0ceaf6
revert version bump 2020-03-21 15:18:59 -04:00
Thomas Fussell 80b94549a7
edit version bump path 2020-03-21 15:16:20 -04:00
Thomas Fussell 7c0d64248c
move release files to root for now 2020-03-21 15:15:32 -04:00
Thomas Fussell b118d8f1f2
bump version to 1.5.0 2020-03-21 15:13:22 -04:00
Thomas Fussell 7e1e8cb1a1
release v1.5.0 2020-03-21 14:58:12 -04:00
Thomas Fussell c3a1f1da95
fix release name 2020-03-21 14:57:06 -04:00
Thomas Fussell 0f178e46c8
fix release title 2020-03-21 14:52:26 -04:00
Thomas Fussell 138fb967bc
improve consistency with previous releases 2020-03-21 14:49:58 -04:00
Thomas Fussell 0a2a618663
Merge pull request #452 from tfussell/automate-releases
Automate releases
2020-03-21 14:40:49 -04:00
Thomas Fussell a07c8c0c10
flesh out package.json [ci skip] 2020-03-21 14:39:22 -04:00
Thomas Fussell 8e451f24e3
empty commit [ci skip] 2020-03-21 14:36:57 -04:00
Thomas Fussell 92577d6cac
update github deploy token 2020-03-21 14:36:45 -04:00
Thomas Fussell 5602edbd2d
add packaging and release deployment workflow 2020-03-21 14:25:39 -04:00
Thomas Fussell 9a18cd9fcd
disable npm 2020-03-21 11:02:03 -04:00
Thomas Fussell 252dd76616
initial implementation 2020-03-21 10:59:00 -04:00
Thomas Fussell 2f5934f60e
Merge pull request #447 from Crzyrndm/feature/benchmark
microbenchmarks for double<->string conversion, serialisation improvements
2020-03-20 18:02:37 -04:00
Thomas Fussell 6c52e52487
Merge pull request #451 from amiremohamadi/fix-cell-reference-parsing
fix cell reference parsing
2020-03-20 16:16:40 -04:00
amiremohamadi 3af9567946 fix-bug: set absolute flags correctly 2020-03-20 23:08:27 +03:30
amiremohamadi 33a56b3a04 add more tests for absolute and relative column, row forms 2020-03-20 23:06:58 +03:30
JCrawfy f4d00acb9f resolve warnings 2020-03-02 13:32:39 +13:00
JCrawfy e8cb8d9bc6 fix compiler error 2020-03-01 23:23:20 +13:00
JCrawfy 0ea054026f speedup worksheet::calculate dimension by only looping the cell map once 2020-03-01 23:20:44 +13:00
JCrawfy c418c13010 remove a double lookup in the cell map during serialisation 2020-03-01 23:18:13 +13:00
JCrawfy 932fc4596f remove declarations of copy/assignment operators that only do default work
user defined copy operators suppress compiler creation of move operations, and not having all of copy/move/dtor
defined (rule of 0/5) is suspicious. Also happens to be very slightly slower
2020-03-01 23:16:57 +13:00
JCrawfy 39f498f401 use the new faster serialisation everywhere in xlsx_producer 2020-03-01 22:01:53 +13:00
JCrawfy ee593c2673 bug fixes, move the faster serialisation into the numeric header
serialisation ends up roughly 2x improvement going from sstream to snprintf

Run on (4 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32K (x4)
  L1 Instruction 32K (x4)
  L2 Unified 262K (x4)
  L3 Unified 6291K (x1)
-------------------------------------------------------------------------------------------------------------
Benchmark                                                                   Time             CPU   Iterations
-------------------------------------------------------------------------------------------------------------
RandFloatStrs/double_from_string_sstream                                  968 ns          977 ns       640000
RandFloatStrs/double_from_string_strtod                                   272 ns          270 ns      2488889
RandFloatStrs/double_from_string_strtod_fixed                             272 ns          270 ns      2488889
RandFloatStrs/double_from_string_strtod_fixed_const_ref                   273 ns          270 ns      2488889
RandFloatStrs/double_from_string_std_from_chars                           193 ns          195 ns      3446154
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_ref              272 ns          273 ns      2635294
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_const_ref        276 ns          273 ns      2635294
RandFloats/string_from_double_sstream                                    1311 ns         1318 ns       497778
RandFloats/string_from_double_sstream_cached                             1076 ns         1050 ns       640000
RandFloats/string_from_double_snprintf                                    601 ns          600 ns      1120000
RandFloats/string_from_double_snprintf_fixed                              600 ns          600 ns      1120000
RandFloats/string_from_double_std_to_chars                                117 ns          117 ns      5600000
RandFloatsComma/string_from_double_snprintf_fixed_comma                   600 ns          600 ns      1120000
2020-03-01 22:01:14 +13:00
JCrawfy fbbf7ae767 fix git revert error 2020-03-01 20:46:19 +13:00
JCrawfy 0915fde090 add saving to the spreadsheet-load test, fix a bug in the serialiser 2020-03-01 20:43:56 +13:00
JCrawfy d135f35bd4 minor cleanup 2020-03-01 20:24:22 +13:00
JCrawfy a5aca5c212 add the fixed snprintf serialiser
Run on (4 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32K (x4)
  L1 Instruction 32K (x4)
  L2 Unified 262K (x4)
  L3 Unified 6291K (x1)
-------------------------------------------------------------------------------------------------------------
Benchmark                                                                   Time             CPU   Iterations
-------------------------------------------------------------------------------------------------------------
RandFloatStrs/double_from_string_sstream                                  969 ns          977 ns       640000
RandFloatStrs/double_from_string_strtod                                   274 ns          270 ns      2488889
RandFloatStrs/double_from_string_strtod_fixed                             273 ns          273 ns      2635294
RandFloatStrs/double_from_string_strtod_fixed_const_ref                   274 ns          276 ns      2488889
RandFloatStrs/double_from_string_std_from_chars                           193 ns          193 ns      3733333
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_ref              273 ns          267 ns      2635294
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_const_ref        273 ns          273 ns      2635294
RandFloats/string_from_double_sstream                                    1323 ns         1311 ns       560000
RandFloats/string_from_double_sstream_cached                             1074 ns         1074 ns       640000
RandFloats/string_from_double_snprintf                                    519 ns          516 ns      1000000
RandFloats/string_from_double_snprintf_fixed                              517 ns          516 ns      1000000
RandFloats/string_from_double_std_to_chars                                118 ns          117 ns      5600000
RandFloatsComma/string_from_double_snprintf_fixed_comma                   520 ns          516 ns      1120000
2020-02-29 23:10:38 +13:00
JCrawfy 7ba36b5e73 fix dumb bug in input randomiser, add basic double->string benchmarks
* input randomiser was feeding a constant value previously, now actually randomising
* start to_string with the current method (sstream), an faster more correct version (sstream_cached), snprintf, and std::to_chars
** NOTE: only std::to_chars and sstream_cached are correct in the face of locales

Run on (4 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32K (x4)
  L1 Instruction 32K (x4)
  L2 Unified 262K (x4)
  L3 Unified 6291K (x1)
-------------------------------------------------------------------------------------------------------------
Benchmark                                                                   Time             CPU   Iterations
-------------------------------------------------------------------------------------------------------------
RandFloatStrs/double_from_string_sstream                                 1012 ns         1001 ns       640000
RandFloatStrs/double_from_string_strtod                                   276 ns          276 ns      2488889
RandFloatStrs/double_from_string_strtod_fixed                             312 ns          308 ns      2133333
RandFloatStrs/double_from_string_strtod_fixed_const_ref                   307 ns          300 ns      2240000
RandFloatStrs/double_from_string_std_from_chars                           194 ns          188 ns      3733333
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_ref              315 ns          314 ns      2240000
RandFloatCommaStrs/double_from_string_strtod_fixed_comma_const_ref        306 ns          305 ns      2357895
RandFloats/string_from_double_sstream                                    1372 ns         1381 ns       497778
RandFloats/string_from_double_sstream_cached                             1136 ns         1123 ns       640000
RandFloats/string_from_double_snprintf                                    536 ns          516 ns      1000000
RandFloats/string_from_double_std_to_chars                                116 ns          115 ns      6400000
2020-02-29 22:59:25 +13:00
JCrawfy 0adb8a69b1 add micro benchmarking project, setup number parsing benchmark
relating to previous work https://github.com/tfussell/xlnt/issues/422
Results are matching what was observed at the time ^^ was being worked on
std::from_chars is included as the target to beat, but since only MSVC has it for floating point it's not
hugely useful yet

uniform real distribution is probably a horrible choice, and it might be good to randomise the number
of sf in each string also (currently the y all end up at max length)

Run on (4 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32K (x4)
  L1 Instruction 32K (x4)
  L2 Unified 262K (x4)
  L3 Unified 6291K (x1)
----------------------------------------------------------------------------------------------------------
Benchmark                                                                Time             CPU   Iterations
----------------------------------------------------------------------------------------------------------
RandFloats/double_from_string_sstream                                  804 ns          820 ns       896000
RandFloats/double_from_string_strtod                                   163 ns          162 ns      5973333
RandFloats/double_from_string_strtod_fixed                             175 ns          172 ns      5352107
RandFloats/double_from_string_strtod_fixed_const_ref                   150 ns          152 ns      5352107
RandFloats/double_from_string_std_from_chars                          87.1 ns         88.3 ns      9557333
RandFloatsComma/double_from_string_strtod_fixed_comma_ref              172 ns          173 ns      5146257
RandFloatsComma/double_from_string_strtod_fixed_comma_const_ref        180 ns          175 ns      5352107
2020-02-29 22:11:31 +13:00
Thomas Fussell ae6f9d2324
Merge pull request #446 from adamhooper/issue-445
Parse inlineStr values
2020-02-26 13:28:46 -05:00
Adam Hooper ac18fc6dde Parse inlineStr values
inlineStr XML structure is <c><is><t>. This was being parsed incorrectly
when streaming (because has_value wasn't being set to true) and when
reading the whole file (because the <t> was ignored).

[closes #445]
2020-02-25 14:32:14 -05:00
Thomas Fussell 0d1d85f181 Merge pull request #432 from tfussell/format
Format, update dependencies, fix warnings
2020-02-08 13:36:26 -05:00
Thomas Fussell e8ee585897
bump copyright year to 2020 2020-02-08 12:12:59 -05:00
Thomas Fussell 5a2498c229
fix windows build 2020-02-08 12:09:22 -05:00
Thomas Fussell 53b2853ae3
Merge branch 'master' into format 2020-02-08 12:03:40 -05:00
Thomas Fussell 85e6878cc4
bump version to 1.4 to match latest release, for #334 2020-02-08 11:48:50 -05:00
Thomas Fussell 39503e8bf0 fix warnings and other minor issues 2019-12-26 12:52:14 -05:00
Thomas Fussell 1a0c61f5b0 update utfcpp to 3.1 2019-12-26 12:51:52 -05:00
Thomas Fussell 8014e2fe19 update miniz to 2.1, move to third-party 2019-12-26 12:51:02 -05:00
Thomas Fussell 54e7c1df3d update libstudxml to 1.1.0-b.8 2019-12-26 12:49:05 -05:00
Thomas Fussell fcc2f0dddf bump version to 1.4 2019-12-26 12:13:29 -05:00
Thomas Fussell a560756b35 use clang-format, fix some small warnings 2019-12-26 12:03:12 -05:00
Thomas Fussell dbc0ddd9bf
Merge pull request #413 from mattparks/patch-1
Check for existing uninstall target before creating.
2019-12-19 17:07:00 -05:00
Thomas Fussell e2262a0c65
Merge pull request #421 from Crzyrndm/experimental/sheet-data-parser
Accelerated worksheet parsing
2019-12-19 16:24:51 -05:00
Thomas Fussell edb27e84f8
Merge pull request #425 from yschungmr/hotfix/gcc-5-build-bug
Fixed gcc 5 build bug
2019-12-19 16:13:48 -05:00
Johann1994 d6262df555
Shared strings
It can happen that some strings are not unique in sharedstring table
2019-12-18 13:53:23 +01:00
Johann1994 49663bc483
Sharedstringtable
Same strings in shared stringtable makes it not possible to open a xlsx file.
2019-12-18 13:50:34 +01:00
Youngsuk Chung 8e2f197f70 Fix indentation 2019-12-09 14:52:07 +09:00
Youngsuk Chung c8bda73f01 Fix g++-5 build bug (Fix #385)
Tested on g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

Note: Actually,it is not a BUG. It is compiler related issue. The issue #385 is not shown in g++-6 and clang.
2019-12-09 14:46:12 +09:00
JCrawfy f2ad495326 resolve warnings, remove failing test (CI doesn't know what locale "de-DE" is?) 2019-11-18 21:45:46 +13:00
JCrawfy 613d7b6086 add missing include 2019-11-18 21:39:33 +13:00
JCrawfy 97841413fa fixed more parsing errors, added test for ',' locale serialisation (it fails...) 2019-11-18 21:12:21 +13:00
JCrawfy a25187f788 fix using attribute<double> (causes bugs when '.' is not the decimal separator 2019-11-18 20:46:34 +13:00
JCrawfy 7621b2807a fix wrong iterator bug 2019-11-18 20:43:58 +13:00
JCrawfy d69a5dea75 scan and replace '.' with ',' when decimal separator is comma 2019-11-18 19:55:13 +13:00
JCrawfy 2eb88c23d6 move numeric utils into the public headers
resolves #398
2019-11-18 19:25:02 +13:00
JCrawfy a6fd7cc2b8 skip the user facing types, deal direct with the impls
this was being done already in most cases, and allows some simplification
e.g. no need to check if something is already present, since we're starting with a blank
2019-11-17 13:15:00 +13:00
JCrawfy 2b61cac3dc move helper functions and types to top of file ( namespace {} ) 2019-11-17 11:55:49 +13:00
JCrawfy 600cc9d000 specialised string equality template for literals strings
1-2% improvement seen locally
2019-11-17 11:11:33 +13:00
JCrawfy 001606a77c cleanup and comments 2019-11-17 10:41:05 +13:00
JCrawfy 2307ed4edf exceptions, not asserts 2019-11-16 19:49:17 +13:00
JCrawfy a580079702 and more warnings suppressed 2019-11-16 15:03:28 +13:00
JCrawfy 96beae421f matchup integer types 2019-11-16 14:49:58 +13:00
JCrawfy 9d687eaf49 remove all usages of strtod_c 2019-11-16 14:30:40 +13:00
JCrawfy e059d259c7 specialise number_converter when strtod_l is available
in load benchmark, not using the specialisation adds ~10% to execution time
2019-11-16 14:18:33 +13:00
JCrawfy ea532c5c46 resolve some warnings 2019-11-16 14:16:45 +13:00
JCrawfy ad7933d783 and another silent one... 2019-11-16 12:59:58 +13:00
JCrawfy c26a59f32e fix compile error due to reference to r-value that MSVC silently lifetime extended 2019-11-16 12:49:26 +13:00
JCrawfy ec29e227d4 slightly optimise cell parsing routine, fix formula being incorrectly loaded 2019-11-16 12:17:07 +13:00
JCrawfy 8eda9f226f parse height as a double 2019-11-16 11:54:55 +13:00
JCrawfy d83ed0b200 handle whitespace in xml (e.g. '\n' because sheet was pretty printed) 2019-11-16 11:40:43 +13:00
JCrawfy b27e7fe07e rewrite the sheet data xml parse logic
a few hacks still, but a very noticeable speed up (2.2 -> 1.1 seconds on large.xlsx)
2019-11-16 11:28:00 +13:00
JCrawfy fa58994a14 add sheet load time benchmark 2019-11-16 11:25:29 +13:00
Matthew Albrecht 9eee8ec0bb
Check for existing uninstall target before creating. 2019-09-20 15:13:09 -05:00
Thomas Fussell b22153180a default pane_corner to fix unahdled_switch_case due to uninitialized memory 2019-09-15 11:27:31 -04:00
Thomas Fussell a978e73354 change orientation name in default case 2019-09-15 11:26:39 -04:00
Thomas Fussell a1d46694c1 Merge branch 'add-all-locales' into dev 2019-09-15 11:25:39 -04:00
Thomas Fussell 90ddaedc81 Merge branch 'master' into dev 2019-09-07 21:10:11 -04:00
Thomas Fussell f30260153f
Merge pull request #409 from bettar/dateFormat
Prevent throwing exception when encountering country code 10485
2019-09-07 21:08:44 -04:00
Alessandro Bettarini 2b221fec81 Prevent throwing exception when encountering country code 10485 2019-09-07 11:32:49 +02:00
Thomas Fussell df0626579b add all windows locales as a workaround for #407 2019-09-05 15:37:55 -04:00
Thomas Fussell 5791ca80bf
Merge pull request #396 from apthorpe/master
Added CTest support
2019-07-23 08:17:23 -04:00
Bob Apthorpe bd84c7f576 Added CTest support 2019-07-17 12:09:07 -05:00
Thomas Fussell cc88c4829b fix frozen first rows/columns for #369 2019-07-07 11:17:00 -04:00
Thomas Fussell be7a91f7be try default password on read failure, closes #161 2019-07-06 15:29:04 -04:00
Thomas Fussell ba01de47a7
Merge pull request #345 from kostasdizas/issue165-compound-document
Removed duplicate code in compound document
2019-07-06 12:23:09 -06:00
Thomas Fussell 9f1b2ed4c8 Merge branch 'dev' of github.com:tfussell/xlnt into dev 2019-07-06 14:21:13 -04:00
Thomas Fussell 90b672cf6b Merge branch 'Issue#318_fp-equality' of https://github.com/Crzyrndm/xlnt into Crzyrndm-Issue#318_fp-equality 2019-07-06 14:20:53 -04:00
Thomas Fussell 01cd2a3e3f
Merge pull request #346 from Crzyrndm/Issue#335
GCC5 compatibility + CI
2019-07-06 12:03:53 -06:00
Thomas Fussell 1e52c06376 Merge branch 'dev' of github.com:tfussell/xlnt into dev 2019-07-06 14:02:50 -04:00
Thomas Fussell 40baecdf02 Merge branch 'images' of https://github.com/kostasdizas/xlnt into kostasdizas-images 2019-07-06 14:02:24 -04:00
Thomas Fussell 076c421a1f
Merge pull request #332 from Erroneous1/master
Export xlnt::xlnt target when installed.
2019-07-05 06:21:40 -06:00
Thomas Fussell d5172d8bcd implement writing of rich text phonetic properties and phonetic runs 2019-07-03 17:47:28 -04:00
Thomas Fussell 7c9443dca9
Merge branch 'dev' into issue165-xlsx-producer 2019-07-03 13:36:25 -06:00
Thomas Fussell 73b5a783a7
Merge pull request #380 from kostasdizas/issue378-unicode_title
Added support for unicode sheet titles
2019-06-22 10:54:30 -04:00
Thomas Fussell 123ecc95fe
Merge branch 'dev' into issue378-unicode_title 2019-06-22 10:54:20 -04:00
Thomas Fussell 1c22e9781e
Merge pull request #364 from kostasdizas/phonetics
Added support for phonetic fields
2019-06-22 10:53:09 -04:00
Thomas Fussell b6455ff6d1
Merge pull request #356 from kostasdizas/issue353
Fixed block calculation in xlsx_producer
2019-06-22 10:52:14 -04:00
Thomas Fussell f54a150589
Merge branch 'dev' into phonetics 2019-06-22 10:51:30 -04:00
Thomas Fussell e11188ccd1
Merge branch 'dev' into issue378-unicode_title 2019-06-22 10:48:35 -04:00
Thomas Fussell b1a2f6d0bf
Merge pull request #382 from kostasdizas/issue374-format
Update the format elements when setting the cell style
2019-06-22 10:43:41 -04:00
Thomas Fussell 595397994f
Merge pull request #359 from kostasdizas/issue254
Corrected the calculation and formatting of weekdays
2019-06-21 17:52:14 -04:00
Thomas Fussell 938d99ddc5
Merge pull request #363 from pmir/fix-relationship-ordering
Fix relationship sorting
2019-06-21 17:49:20 -04:00
Thomas Fussell 7e22fad735
Merge pull request #329 from Crzyrndm/Issue#327
Relative hyperlinks
2019-06-11 20:40:36 -04:00
Thomas Fussell 7d2a630e00
Merge pull request #342 from kostasdizas/dev
Added new feature to insert or delete rows / columns
2019-06-11 20:39:58 -04:00
Kostas Dizas 38afc61219
Update the format elements when setting the cell style. 2019-03-07 00:26:32 +00:00
Kostas Dizas d4b36b6582
Added support for unicode sheet titles
Fixes #378
2019-02-28 20:29:17 +00:00
Kostas Dizas 36d6b9823d
Adjust merged cells when moving cells 2018-12-02 03:18:37 +00:00
Kostas Dizas 0897cc9fcb
Roundtrip test of the phonetics feature 2018-11-21 13:43:42 +00:00
Kostas Dizas 38f12ff846
Serialise phonetic runs and properties 2018-11-21 13:43:42 +00:00
Kostas Dizas e9c23c3fc7
Add phonetic runs and properties to rich text 2018-11-21 13:43:31 +00:00
Kostas Dizas e9118cff24
Serialise phonetics visibility for cells 2018-11-21 13:04:07 +00:00
Kostas Dizas 48a865cd66
Added phonetics field visibility option on cells 2018-11-21 13:03:02 +00:00
przemekmirek 5a44433291 Fix relationship sorting 2018-11-08 20:47:58 +01:00
Kostas Dizas 03198f7e40 Corrected the calculation and formatting of weekdays
and relevant unit tests
2018-10-28 20:32:46 +00:00
Kostas Dizas 5decf9cf89 Test to confirm that the row spans are calculated correctly 2018-10-20 00:07:56 +01:00
Kostas Dizas dde45fd17f Fixed block calculation in xlsx_producer 2018-10-19 23:19:23 +01:00
Kostas Dizas 3ab49c8af6 Importing row spans in the row_properties object 2018-10-19 20:48:54 +01:00
Kostas Dizas db5abec894 Worksheet dimension should include lowest props 2018-10-19 20:47:35 +01:00
Kostas Dizas b6f0d0a7e1 Fixed the uninitialised bool on a rich_text_run 2018-10-13 09:11:26 +01:00
Kostas Dizas 61639c7275 Added write_rich_text method to xlsx_producer
This eliminates some duplicate code as reported in #165
2018-10-12 19:56:09 +01:00
Kostas Dizas 698b40c54c Added basic support for embedded images 2018-10-12 13:52:30 +01:00
Kostas Dizas 23fcfd636b Removed duplicate code in compound document 2018-10-01 13:31:32 +01:00
Crzyrndm ed05bfeb44 Rename parameter to avoid ambiguous parameter
-- Issue#335
2018-09-15 19:50:59 +12:00
Crzyrndm ab81bcaf08 Add GCC 5 to the build matrix, update comments about what each build is 2018-09-15 19:44:19 +12:00
Kostas Dizas c804b4c569 Added new feature to insert and delete rows and columns 2018-09-11 09:44:43 +01:00
Aaron Bishop 0d76afb801 Fix using variable before defining it 2018-08-26 07:36:24 -04:00
Aaron Bishop 37638f6d2b Use cache path for *_DEST_DIR
Use GNUInstallDirs
Prefix cache variables with XLNT_
Combine multiple target_include_directories
2018-08-25 09:39:39 -04:00
Crzyrndm e183e37ae6 remove roundoff test, add test for exponential representations
-- testing that a number with >15 significant digits rounded off to 15 failed on all tested platforms
2018-08-25 14:06:20 +12:00
Crzyrndm 1003ba507d Add a test for serialize_number_to_string
-- should allow serialisation of up to 15 significant digits
-- don't use default stringstreams, typically only get ~6 significant digits
2018-08-25 13:54:54 +12:00
Crzyrndm 875f143d74 fix parameter ordering inconsistency that could cause switching the parameters to give different results 2018-08-25 13:31:16 +12:00
Crzyrndm 4188d35caf Add tests for the other small utilities 2018-08-19 15:11:57 +12:00
Crzyrndm 9565377963 Adding tests for xlnt::detail::float_equals
-- Plenty of comments which should be useful if it becomes useful to tweak the comparison
2018-08-19 14:41:00 +12:00
Crzyrndm a28f3fb7a9 zstream implicit conversion warning 2018-08-18 18:37:19 +12:00
Crzyrndm 9e78e55c62 Another missing include 2018-08-18 18:16:39 +12:00
Crzyrndm 61e46c934a resolve float-equals warnings 2018-08-18 18:12:46 +12:00
Crzyrndm b2a514fdbf Include without relying on include directories 2018-08-18 17:55:32 +12:00
Crzyrndm 8b30319514 missing include 2018-08-18 17:31:25 +12:00
Crzyrndm d7603964e9 another compile error 2018-08-18 17:28:31 +12:00
Crzyrndm 3a10e661b8 constexpr concern no longer valid 2018-08-18 17:24:34 +12:00
Crzyrndm edafcd1bb5 More compile fixes 2018-08-18 17:23:04 +12:00
Crzyrndm 6aa10131a2 Fixing compile errors 2018-08-18 16:51:53 +12:00
Crzyrndm 7b05beae90 unsupress fp equality warnings 2018-08-18 16:34:31 +12:00
Crzyrndm 19aad52500 fuzzy floating point comparison with optional 2018-08-18 16:31:56 +12:00
Crzyrndm 3db87244f1 Compare numeric cell values using float_equals 2018-08-18 16:24:32 +12:00
Crzyrndm 68589d91eb default float for epsilon
-- Even if both arguments are doubles, they may have been promoted by a previous operation and then the comparison would fail
2018-08-15 18:19:36 +12:00
Crzyrndm 4487b988e7 Define fp equality function
-- Based on checks and defaults used by various testing frameworks (primarily GTest and Catch)
-- Moved the header into detail where it should have been to start with (oops)
2018-08-14 22:48:28 +12:00
Aaron Bishop ecf402972b Export xlnt::xlnt target when installed.
Usage:
find_package(Xlnt)
target_link_libraries(foo PRIVATE xlnt::xlnt)
2018-08-07 09:08:29 -04:00
Crzyrndm 10c5781e6d
Merge pull request #323 from Crzyrndm/build_system_improvements
Build system improvements + stylesheet optimisations
2018-08-05 14:15:09 +12:00
Crzyrndm 94fd22f492
Merge pull request #321 from Crzyrndm/Issue#282
Don't set comment size on explicit comment overload
2018-08-05 13:05:54 +12:00
Crzyrndm ca8c93c696
Merge pull request #324 from Crzyrndm/iterator-default-ctors
Default ctors for iterators
2018-08-05 13:04:09 +12:00
Crzyrndm 2d2f825f64 tests for the const iterators as well 2018-08-05 12:55:33 +12:00
Crzyrndm 3ced259a26
Merge pull request #322 from Crzyrndm/serialise_color_tint
Ensure <color tint=...> is correctly serialised as an optional double
2018-08-05 12:49:03 +12:00
Crzyrndm dc7f369be9 Add relative urls to the valid hyperlink url set 2018-08-04 14:55:17 +12:00
Crzyrndm c3296db932 Revert "Another easy 15-20% by not searching with no references"
This reverts commit 3ae31fadc3.
2018-07-30 07:22:45 +12:00
Crzyrndm 544e90c975 fix spectacular typo
- Using rgba for comparison is still faster, but it does help correctness when you compare two different instances
2018-07-30 07:07:32 +12:00
Crzyrndm 3ae31fadc3 Another easy 15-20% by not searching with no references 2018-07-29 23:28:02 +12:00
Crzyrndm e6a84c0cf0 Optimise modifying a new format to reduce garbage collection runs 2018-07-29 22:10:56 +12:00
Crzyrndm b4f695b3ea fixing warnings 2018-07-29 17:33:22 +12:00
Crzyrndm 5a5db1a50b use std::find and don't double iterate the list
- ~5% perf improvement in img2xlsx example
2018-07-29 16:48:18 +12:00
Crzyrndm f64dbc00c4 string compare is slow, use rgba member instead 2018-07-29 16:24:09 +12:00
Crzyrndm 808765ea39 format as milliseconds 2018-07-29 15:11:19 +12:00
Crzyrndm ba54f9eaa3 Reduce run-time of benchmark by 16x (160k to 10k cells) 2018-07-29 15:05:21 +12:00
Crzyrndm e01f461b64 get the initialisation order right
- members reordered to reduce sizeof classes (due to alignment). ctors needed to be updated for this
2018-07-29 14:37:08 +12:00
Crzyrndm 4124dd78e0 Add tests, fix compile error (missing include) 2018-07-29 14:27:49 +12:00
Crzyrndm 9aff73747d range_iterator default ctor 2018-07-29 14:22:35 +12:00
Crzyrndm 475f9f35d0 default ctor for cell iterator 2018-07-29 14:20:29 +12:00
Crzyrndm 6fb90ecf57 default ctor for workbook iterator 2018-07-29 14:12:47 +12:00
Crzyrndm dd6f338419 Remove memory growth based on row count
- Nested unordered_map was the cause of a significant memory/cell spike.
- added cell_reference hash, lookup by cell_reference to make memory usage proportional to cell count only
2018-07-29 11:43:23 +12:00
Crzyrndm 138c90883b Modify writer benchmark to make comparisons between column and row usage
- Cut time to write a sheet with many rows by not calling highest_row inside a loop over the rows (On^2 -> On)
- Observation: more memory is used / cell as the number of rows increases
2018-07-29 10:11:00 +12:00
Crzyrndm e350570ae6 Actually build samples + benchmarks on appveyor 2018-07-28 18:13:56 +12:00
Crzyrndm 6a4edfad40 Run documentation samples on Appveyor 2018-07-28 17:59:11 +12:00
Crzyrndm e0d5cdbd85 Visible segments 2018-07-28 16:36:36 +12:00
Crzyrndm 0fe0c20d2a Cut down on builds executing samples/benchmarks, formatting 2018-07-28 16:26:40 +12:00
Crzyrndm 6b427127ff Add folds to travis log, parameters for img sample 2018-07-28 15:57:18 +12:00
Crzyrndm ecb71db558 Run samples and benchmarks on CI 2018-07-28 15:38:36 +12:00
Crzyrndm d93e470a52 Suppress GCC maybe-uninitialized warning
Signal to noise ratio is very high, and the #pragma suppressions for optional aren't working for GCC8
2018-07-28 14:54:49 +12:00
Crzyrndm ade8cf3b6c Ensure <color tint=...> is correctly serialised as an optional double 2018-07-28 14:44:49 +12:00
Crzyrndm e1daff535c Better idea, set the defaults 2018-07-28 14:04:22 +12:00
Crzyrndm d39b7a107a comment default size only set in the overloads which can't set size
- Debatable whether position should receive the same treatment
2018-07-28 13:55:56 +12:00
Thomas Fussell 94faf01b72
Merge pull request #320 from sukoi26/SheetFormatPr
SheetformatPr issue #287
2018-07-24 23:42:51 -04:00
Thomas Fussell 8f39375f4c revert unwise data structure change 2018-07-24 23:08:44 -04:00
Thomas Fussell cbe50f4681 Fix some issues after merge 2018-07-23 00:13:20 -04:00
Thomas Fussell 0af7ad88e1 Merge branch 'tasmail-master-shared-strings-performance' into dev
remove less than comparators

fix conflicts
2018-07-23 00:10:16 -04:00
Thomas Fussell 8c29ebe738 fix gitbook link/badge (point to legacy for now) 2018-07-22 22:23:01 -04:00
sukoi26 8f4248d9c3
change SheetFormatPr
change "defaultRowHeight" not optional
2018-07-22 18:44:31 +02:00
sukoi26 7be7172ff5
update attribute required
required attribute default_row_height
2018-07-22 16:35:41 +02:00
sukoi26 fe38e01341
Merge pull request #2 from tfussell/dev
Dev
2018-07-21 10:19:19 +02:00
Crzyrndm dd79946bf0
Merge pull request #309 from Crzyrndm/dev-optional-PR
Optional implementation that doesn't require default constructors
Resolves #300
2018-07-21 13:41:58 +12:00
Crzyrndm 9e981abe05 Only add diagnostics to GCC, Clang doesn't know the warning 2018-07-21 13:30:52 +12:00
Crzyrndm 6562c41ae1 fix typo in Cmake lists 2018-07-21 12:38:33 +12:00
Crzyrndm fede2d3168 fix Clang CI warnings 2018-07-21 12:33:58 +12:00
Crzyrndm ad24d9485d Resolve CI warning about using an uninitialised variable 2018-07-21 12:19:15 +12:00
Crzyrndm b004d0863c address CI build failure
Issue #300
Previous CI fix didn't work, try with type aliasing instead

Issue #300
This reverts commit c87c0e3975.
gcc 6 ok, msvc 14 choked

Issue #300
noexcept(condition) doesn't seem to work on msvs 2015

Issue #300
Merge remote-tracking branch 'origin/dev-optional-no-default-ctor' into dev-resolve-simple-issues
ensure uniqueness (uglify) and undefine compatibility macro
2018-07-21 12:19:15 +12:00
Crzyrndm 07d648fe8b Implementation of optional using std::aligned_storage
Issue #300
-- test for no default constructor required enabled
-- Passes all tests locally
2018-07-21 12:19:15 +12:00
Crzyrndm 34e8f274de optional exception check, primarily adding noexcept to signatures
-- also reordered the assignments in set/clear to ensure "has_value_" doesn't change if the assignment operator of T throws
2018-07-21 12:19:15 +12:00
Crzyrndm ad69e7bf11 test for overloaded operator=(T)
Issue #300
2018-07-21 12:19:14 +12:00
Crzyrndm eda102ee9d testing current optional implementation against target behaviour
Issue #300
-- NOTE: construction from no_default currently wont compile so is commented out (L:113)
-- NOTE: dll import/export of template classes is probably unnecessary (the header is already required) and doesn't work in the general case (explicit instantiations are required for at least MSVC)
2018-07-21 12:19:14 +12:00
Crzyrndm 761eee3e5f
Merge pull request #314 from Crzyrndm/dev-CI-build-modifications-PR
Travis CI improvements
Resolves #147
2018-07-21 12:04:56 +12:00
Crzyrndm 4dae88f004
Merge pull request #311 from Crzyrndm/dev-unimplemented-functions-PR
Implementations for unimplemented functions
2018-07-21 11:31:25 +12:00
Crzyrndm f035b9041e
Merge pull request #310 from Crzyrndm/dev-reorder-wb-relations-PR
Resolves #279
2018-07-21 11:13:05 +12:00
Crzyrndm 011ea3a9d2
Merge pull request #315 from sukoi26/bestFit
bestFit change
2018-07-20 17:57:46 +12:00
sukoi26 016c95bb4a
Best fit (#1)
* bestFit change

remove from skip_attributes list

* update bestFit commit 

error compiling  std::vector<std::string>
2018-07-19 14:05:28 +02:00
sukoi26 a2dc4a34f1
update bestFit commit
error compiling  std::vector<std::string>
2018-07-19 13:53:54 +02:00
sukoi26 4f9e8ab37f
bestFit change
remove from skip_attributes list
2018-07-19 12:49:32 +02:00
Crzyrndm 0aee6fd9b1 Cleanup some cmake modifications 2018-07-16 19:41:40 +12:00
Crzyrndm ad759ae4f7 fix for build failure with GCC8{-std=c++17} 2018-07-16 19:08:19 +12:00
Crzyrndm b9b47672ea cxx_std_14 and co aren't available until cmake v3.8 2018-07-16 18:52:21 +12:00
Crzyrndm 5671167d1d add cmake option XLNT_CXX_LANG to set the targetted cxx standard
- valid options are 11, 14, and 17
- default is 14
- cmake will error if an invalid value is provided
- requires cmake >= 3.10.* to take effect in visual studio
2018-07-15 21:23:22 +12:00
Crzyrndm 25d75cb5c3 complete the compiler set (gcc 6/7/8 + clang 4/5/6) 2018-07-14 21:27:54 +12:00
Crzyrndm 6b0fb72e78 make benchmarking conditional on other flags (static && release) 2018-07-14 21:13:57 +12:00
Crzyrndm 11573f45e6 Resolve remaining warnings 2018-07-14 20:25:10 +12:00
Crzyrndm ea850b32d5 Add clang 4.0 to travis builds 2018-07-14 19:59:03 +12:00
Crzyrndm 9a33210144 Resolve warnings about global ctors and an unused variable
-- while unlikely to become an issue, ordering of ctors across source files is undefined and debugging issues related to it is not easy so just avoid that issue
2018-07-14 19:54:31 +12:00
Crzyrndm d4cc538faf remove -Werror from clang build to allow CI to run through
-- fixing CI warnings 1 at a time would be a complete waste of time
-- blacklist some of the overkill warnings
2018-07-14 19:02:12 +12:00
Crzyrndm c94fc5a999 Travis CI setup modifications 2018-07-14 18:35:48 +12:00
Crzyrndm ddab6551b0 Add tests for functionality added to implement declared functionality 2018-07-13 17:14:07 +12:00
Crzyrndm 03020cc793 improved hyperlink implementation
- hyperlinks to cells and ranges are complete
- hyperlink::display is now set as well as the cell value (in excel these can be different)
-- if a cell is empty, display is equal to value text
-- if a cell has a value, display can be just about anything
- This version copies excel in that display is completely ignored once value is set
- All hyperlink tests are now part of the cell test suite (not the worksheet test suite which the majority were previously located)
2018-07-13 17:14:07 +12:00
Crzyrndm 054f509f7a fix missing return statement 2018-07-13 17:14:06 +12:00
Crzyrndm 1390d6a76e unimplemented functions in range and path 2018-07-13 17:14:06 +12:00
Crzyrndm 650bfeb7dd unimplemented functions under worksheet
-- NOTE: ctor was removed because it can't have been in use, and is duplicated by the overload below it. A pair parameter is only optimal in a very limited number of use cases, and then only slightly over the begin/end overload
2018-07-13 17:14:06 +12:00
Crzyrndm f9b2ca5929 unimplemented functions under workbook/ 2018-07-13 17:14:06 +12:00
Crzyrndm 3d9e887d4a unimplemented functions under utils/ 2018-07-13 17:14:05 +12:00
Crzyrndm 95ca51e5c8 unimplemented functions under styles/ 2018-07-13 17:14:05 +12:00
Crzyrndm 49c4e725dc All unimplemented functions under cell/ 2018-07-13 17:14:05 +12:00
Crzyrndm 0d1bca3fd4 Remove hidden dependency on unordered map extraction order
Issue #279
2018-07-13 12:43:21 +12:00
Crzyrndm 7458426111 return by const ref 2018-07-13 12:43:21 +12:00
Crzyrndm ec02121c15 Add debug output for a relationship mismatch 2018-07-13 12:43:21 +12:00
Crzyrndm 53c193433f Ensure worksheets get a unique internal filename
Issue #279
2018-07-13 12:43:20 +12:00
Crzyrndm dcf50cb4cd return by const reference when possible 2018-07-13 12:43:20 +12:00
Crzyrndm cf8991a234 no need to recreate the uri 2018-07-13 12:43:19 +12:00
Crzyrndm 322490b397 re-write workbook::reorder_relationships
Issue #279
2018-07-13 12:43:19 +12:00
Crzyrndm c0a90ccb7f
Merge pull request #307 from Crzyrndm/dev-test-suite-improvements
Test suite improvements
2018-07-13 11:56:55 +12:00
Crzyrndm 24b4b6c628 declaration/definition switched files
For some reason, the declaration was in the source file. Don't ask why, I don't know
2018-07-13 11:43:13 +12:00
Crzyrndm 54b1affd1e Merge remote-tracking branch 'upstream/dev' into dev-test-suite-improvements
# Conflicts:
#	tests/workbook/workbook_test_suite.cpp
2018-07-13 11:38:56 +12:00
Crzyrndm b9fbe6241a
Merge pull request #306 from Crzyrndm/dev-Issue298
Resolution to Issue 298
2018-07-13 11:33:05 +12:00
Crzyrndm 1ab25fa7fc
Merge branch 'dev' into dev-Issue298 2018-07-13 11:21:13 +12:00
Crzyrndm 7160b7494d
Merge pull request #305 from Crzyrndm/dev-iterator-improvements-2
Remove uses of std::iterator (deprecated in C++17) + improvements
2018-07-13 11:14:19 +12:00
Crzyrndm ed84fe50d2
Merge pull request #303 from sukoi26/dev
error what(): xl/sharedStrings.xml: error: duplicate attribute #290
2018-07-13 11:04:21 +12:00
sukoi26 28a71572cf
update #290
suggested by  Crzyrndm
2018-07-10 09:32:34 +02:00
Crzyrndm 399b5e3775 Resolve CI build failure 2018-07-10 14:43:22 +12:00
Crzyrndm cffb1ce345 restart CI 2018-07-10 14:12:26 +12:00
Crzyrndm 0e69ea95bf fix build errors, fix warning about pragma once in source file 2018-07-10 13:43:16 +12:00
Crzyrndm bf5105f0a3 fix static initialisation order issues causing the tests vector to get reset 2018-07-10 13:37:34 +12:00
Crzyrndm d603ee2106 Merge pull request #1 from Crzyrndm/dev-iterator-improvements
Dev: iterator improvements
2018-07-10 12:41:02 +12:00
Crzyrndm 4afc0963c6 add post (in/de)crement tests 2018-07-10 12:41:00 +12:00
Crzyrndm 9a82c4fab7 Comment fixes and clarifications 2018-07-10 12:40:58 +12:00
Crzyrndm b95919323d add more tests for worksheet iterator, add operator--
* operator-- completes the naive bidirectional iterator requirements
* tests for various construction and assignment behaviours
* tests for iteration and dereferencing behaviours
2018-07-10 12:40:56 +12:00
Crzyrndm 04b50d9b8e worksheet_iterator - operator* const overloads
Users may still want to dereference a const iterator (note: not a const_iterator).
Also use the "reference" typedef to ensure there is only 1 source of information
2018-07-10 12:40:54 +12:00
Crzyrndm a47985b2db worksheet_iterator - rule of 5/0
For rule of 5/0, where no implementation is required, all 5 operations have been declared as defaulted. This is less likely to forget definitions for all 5 if required
- removed forwarding of copy ctor to assignment (which was defaulted already) in favour of defaulted copy ctor
- added defaulted move assignment/ctor and destructor

Changed workbook reference to a pointer to allow tests to compile (reference isn't rebindable so defaulted assignment is equivalent to deleted)
2018-07-10 12:40:52 +12:00
Crzyrndm eaf3c2a773 Remove double definition 2018-07-10 12:40:50 +12:00
Crzyrndm 62e0a7dd17 Revert "cell iterator - add operator->"
This reverts commit 1b705ae043ae1b43d0ecbc93da04c944383bb296.
2018-07-10 12:40:48 +12:00
Crzyrndm bc8cd21d67 range_iterator - operator* const overloads
Users may still want to dereference a const iterator (note: not a const_iterator).
Also use the "reference" typedef to ensure there is only 1 source of information
2018-07-10 12:40:46 +12:00
Crzyrndm 1e66824af0 range_iterator - rule of 5/0
For rule of 5/0, where no implementation is required, all 5 operations have been declared as defaulted. This is less likely to forget definitions for all 5 if required
- removed forwarding of copy ctor to assignment (which was defaulted already) in favour of defaulted copy ctor
- added defaulted move assignment/ctor and destructor
2018-07-10 12:40:44 +12:00
Crzyrndm dc020622c0 cell iterator - move parameters aren't const
copy/paste error
2018-07-10 12:40:42 +12:00
Crzyrndm 1c4f9c7ed2 cell iterator - add operator->
Implementation just forwards to operator*, but this is a typical operator in the iterator API and is suprising and inconvenient that it is not present
2018-07-10 12:40:40 +12:00
Crzyrndm 20e72d69e5 cell_iterator - operator* const overloads
Users may still want to derederence a const iterator (note: not a const_iterator).
Also use the "reference" typedef to ensure there is only 1 source of information
2018-07-10 12:40:38 +12:00
Crzyrndm 92ac3a2a2e cell_iterator - rule of 5/0
For rule of 5/0, where no implementation is required, all 5 operations have been declared as defaulted. This is less likely to forget definitions for all 5 if required
- removed forwarding of copy to assignment (which was defaulted already) in favour of defaulted copy ctor
- added defaulted move assignment/ctor and destructor
2018-07-10 12:40:36 +12:00
Joshua 744dd0afbb Remove uses of std::iterator (deprecated in C++17)
Detailed reasoning for the deprecation is provided by the paper proposing deprecation (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0174r2.html) and a related LWG issue (https://cplusplus.github.io/LWG/issue2438).

This was the only issue preventing a clean compile with VS 15.7.2 with c++17/c++latest set as the target language

The issue could be resolved in two ways. Providing a custom replacement to std::iterator (a very simple structure) or by providing the 5 required typedefs. The only functional difference from my reading is that the typedefs are not immediately available to the implementer with the inheritance. I find the inline typedefs to be clearer hence the selection in this commit
2018-07-10 12:40:34 +12:00
sukoi26 99f20a014a
error what(): xl/sharedStrings.xml: error: duplicate attribute #290 2018-07-09 18:21:01 +02:00
Thomas Fussell e1e4823908
Merge pull request #294 from Crzyrndm/dev-worksheet-test-failures
Fix all round-tripping test failures and UTF encoding test failures
2018-07-07 09:07:50 -04:00
Crzyrndm 51545734e8 Cleanup and remove <xlnt/xlnt.hpp> 2018-07-05 21:26:29 +12:00
Crzyrndm 03a56d8af9 Change all test headers to source files with related modifications
Issue #299
2018-07-05 20:47:24 +12:00
Crzyrndm a7b167032b Modifications to test suite to support test auto-registration
Issue #299
2018-07-05 20:46:32 +12:00
Crzyrndm a8fa6637fe fix workbook::operator== always returning false, add tests for workbook::load
workbook::operator== was comparing the value of the raw pointer held by two std::unique_ptr's. By definition, this is always false in a well behaved program (if it's true, things go bang...). This then led to adding equality operators to nearly every other struct/class in xlnt to support workbook::operator==

workbook::load and the non-default ctors for loading data from a file are tested using the now functional equality operator

NOTE: a large number of copy ctors need updates/fixing. Many should be defaulted
2018-07-03 14:05:07 +12:00
Crzyrndm 4eecf84713 add simple test for cell::column_index 2018-07-03 13:16:33 +12:00
Crzyrndm 688c8c7f33 add column_index to cell to be consistent with cell_reference
Issue #298
The consistency argument is a good one in my opinion
2018-07-03 11:10:47 +12:00
Crzyrndm fb195e2777 fix accidentally copied ctor declaration 2018-07-03 11:09:33 +12:00
Crzyrndm bb04205dac workbook parameterised constructors
Issue #298
- all 4 are simply duplicating existing behaviour, but perhaps we can get a more optimal version in future
- istream ctor is intended as an extension point that can then be used to create free/static functions to work with any future data source (vector), while the path ctor is a convenience function for the common case (from file)
2018-07-02 21:33:27 +12:00
Crzyrndm e0d62b0835 Cleanup from review 2018-06-26 20:32:59 +12:00
Crzyrndm 0325c19488 Cleanup 2018-06-25 23:17:21 +12:00
Crzyrndm 3d3a59012a extLst element round tripped 2018-06-25 23:12:35 +12:00
Crzyrndm 4ff68319b0 Fix CI build warnings 2018-06-25 21:45:40 +12:00
Crzyrndm 8ba7f5b45d default is not a contextual keyword 2018-06-25 21:41:25 +12:00
Crzyrndm fa19d8fccc Providing an explicit default value disables aggregate initialisation 2018-06-25 21:35:02 +12:00
Crzyrndm 49bd0c8fb4 Fix warnings + CI compile error 2018-06-25 21:28:17 +12:00
Crzyrndm 840d1bcefc Serialisation of extLst without namespace support
-- roundtripping namespaces requires modifications of the parser used for the entire worksheet as there does not appear to be a way to track the namespace changes without listening/registering for the event. This (ofcourse) breaks lots of other things...
2018-06-24 23:08:23 +12:00
Crzyrndm a347d9c05d ext_list parsing for worksheets 2018-06-24 21:25:58 +12:00
Crzyrndm 1c1d63498a Parsing headerFotter block of test sheet correctly 2018-06-24 17:31:05 +12:00
Crzyrndm d12d2e450b std::to_string is not good fpr serialising doubles
-- it uses fixed 6dp, xlsx wants 15sf
-- stringstream with precision set to 15 serialises correctly
2018-06-24 14:29:56 +12:00
Crzyrndm e8fcd49c0d Add serialisation of "topLeftCell" sheetView attribute 2018-06-24 14:19:03 +12:00
Crzyrndm d2d0c2ab55 Serialisation of sheetPr and printOptions elements 2018-06-24 14:02:01 +12:00
Crzyrndm 93323f334d Basic pageSetup persistence
-- NOTE: The struct page_setup doesn't currently reflect the attributes of the pageSetup element
2018-06-24 12:34:56 +12:00
Crzyrndm 7820ac548f re-save custom_heights_widths.xlsx, add defaultColWidth sheet attribute
-- custom_heights was the only test sheet where the integral value was being saved with a trailing ".0"
-- Updated tests to expect the new values
-- added the new property "defaultColWidth"
2018-06-24 11:53:45 +12:00
Crzyrndm 884558fd15 Write numbers using a standard formatter (15sf to match excel) 2018-06-24 11:06:02 +12:00
Crzyrndm f62e5fe5f7 Fix every 16th row (17, 33, ...) having data dropped 2018-06-24 10:20:30 +12:00
Crzyrndm d81555dbae Add "bestFit" column attribute serialisation 2018-06-24 10:13:27 +12:00
Crzyrndm 4cfb74443c fixing build warnings 2018-06-23 22:43:11 +12:00
Crzyrndm 3eb06bac0d serialisation of custom row format property added 2018-06-23 22:29:57 +12:00
Crzyrndm fe90c9d488 Fix build errors and warnings 2018-06-23 21:08:12 +12:00
Crzyrndm 07ea740d11 Add the ext_list class for parsing extLst xml elements to/from
-- no tests as yet
2018-06-23 19:08:39 +12:00
Crzyrndm fde3b90bda implement overload of manifest::has_relationship(path, relation_id) 2018-06-23 13:19:34 +12:00
Crzyrndm 5817ef5cf0 Add serialisation of worksheet phonetic properties 2018-06-23 12:15:15 +12:00
Crzyrndm 5a14d7b9d1 suppress conversion warnings
-- tolower takes chars and returns chars, types are int because C only deals with ints
-- format parameter is size_t but there is no std parsing function that returns size_t. stoull is used instead as the widest alternative, and then the cast is applied to suppress the conversion warnings
2018-06-18 23:24:13 +12:00
Crzyrndm 1066b1007c Fixed another embedded unicode sequence 2018-06-18 23:01:15 +12:00
Crzyrndm 15b3bd1b53 unicode escape sequence for libre office pwd
-- to encode: copy the string into unicodelookup.com. Take the hex representation and pad to 4 characters with '0's, prefixing each character with '\u'
2018-06-18 22:40:26 +12:00
Crzyrndm 9bbebe5fdd Add __LINE__ to test assert failed messages 2018-06-18 22:40:25 +12:00
Crzyrndm bd90cc4786 add brackets to macro expressions to ensure expected expansion results 2018-06-18 22:40:25 +12:00
Crzyrndm 6d16ffaddf Final test report now includes the test failure message 2018-06-18 22:40:25 +12:00
Crzyrndm cfef764ab9 Add exception message and test name to std::cout when a test fails
-- '*' doesn't help much when debugging
2018-06-18 22:40:25 +12:00
Crzyrndm 92ae444791 round trip unicode test had the same embedded encoding issue 2018-06-18 22:40:25 +12:00
Crzyrndm fa2b20da99 fix encoding issues with unicode file test
-- unicode string literals don't seem to work in an obvious way. Embedding the encoding using the \u escape sequences (https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF)
2018-06-18 22:40:24 +12:00
Crzyrndm fc7c69a724 Base selection on Excel behaviour
-- sqref is a block of selected cells containing the active_cell (normally is just == active_cell)
-- active cell is the selected vell in this selection/view/pane
-- inactive selections use the top-left cell as the active_cell
2018-06-18 22:40:24 +12:00
Crzyrndm 6f13002ac6 set selection::sqref in freeze_panes
-- NOTE: It doesn't seem likely that these should be 'A1' in all cases (set to 'A1' because current tests demanded it). Purpose of this parameter needs clarification
-- NOTE: [xlnt::selection] needs appropriate ctor's once the purpose of the parameters can be clarified
2018-06-18 22:40:24 +12:00
Crzyrndm 4592b86746 Fix clear_row not clearing the row properties
-- worksheet_dimensions include rows with properties
2018-06-18 22:40:24 +12:00
Crzyrndm b4e7832419 Fixes to cell hyper links
-- additional tests to cover both variants of the set function
-- additional tests to cover hyper links on cells with non-string data
-- modified hyper link set function to handle cells with non-string data
-- fixed test behaviour for a cell with no value (value is set to the string form of the link. Behaviour copied from Excel 2010)
2018-06-18 22:40:24 +12:00
Crzyrndm 04c0b4a1ca Fix issues with the worksheet "title" setter.
-- Resolves two test failures caused by a crash when setting the title to the existing value removing the sheet from the 'sheet_title_rel_id_map_'
-- added empty title check
2018-06-18 22:40:23 +12:00
Thomas Fussell e350a7734d implement abspath and archid flags, fixes some serialization problems 2018-05-28 23:13:57 -04:00
Thomas Fussell 6eb16243ca work on round-tripping for #230 2018-04-24 19:43:34 -04:00
Thomas Fussell 78ae9bbb89 specify path return value namespace to fix compiler error, closes #269 2018-04-24 18:06:30 -04:00
Thomas Fussell ec1584240c specify relationship member namespace to fix compiler error, closes #268 2018-04-24 18:03:55 -04:00
Thomas Fussell 50850ffb8a work on round-tripping for #230 2018-04-24 17:58:17 -04:00
Thomas Fussell 617f7a2525 improve hyperlinks and style round tripping 2018-03-21 09:03:37 -04:00
Thomas Fussell 410e73d594 work on hyperlinks, x14 extentions, other round tripping silliness 2018-03-16 21:21:16 -04:00
Thomas Fussell 2426215801 implement sheet view serialization 2018-03-14 20:12:07 -04:00
Andrii Tkachenko e05ce8fdc1 Directory build removed. 2018-02-17 06:53:47 +01:00
Andrii Tkachenko 074b176d33 workbook.hpp extra qualification typo fixed. 2018-02-17 06:06:39 +01:00
Andrii Tkachenko e37f9bed9d Visual Studio 2015 build files for Win32/x64 configurations. Source files references changed. 2018-02-14 06:57:14 +01:00
Andrii Tkachenko 51fbdbf56d Visual Studio 2015 build files for Win32/x64 configurations. Include reference changed. 2018-02-14 06:46:24 +01:00
Andrii Tkachenko 34362f6353 Visual Studio 2015 build files for Win32/x64 configurations. Redundant configurations removed. 2018-02-14 06:33:46 +01:00
Andrii Tkachenko 467dc860c6 Visual Studio 2015 build files for Win32/x64 configurations. Very first working version. 2018-02-14 06:22:33 +01:00
Andrii Tkachenko 27f37d3111 Visual Studio 2015 build files for Win32/x64 configurations. 2018-02-13 19:59:06 +01:00
Andrii Tkachenko 7852a3c5dd Visual Studio 2015 build files for Win32/x64 configurations. 2018-02-13 17:05:31 +01:00
Andrii Tkachenko 403605a536 xLnt. shared string performance optimization. 2018-02-08 09:52:10 +01:00
Andrii Tkachenko cb55735644 xLnt. rich_text operator less fixed. 2018-02-08 09:51:50 +01:00
Andrii Tkachenko 3246d602c2 xLnt. Implemented operator less for: rich_text, rich_text_run, color, font, optional. 2018-02-08 08:05:41 +01:00
Andrii Tkachenko 55cf7a2bed xlnt. rich_text copy constructor. 2018-02-08 07:24:58 +01:00
Andrii Tkachenko f460bb2678 benchmarks. Rows/columns value/format performance. 2018-02-07 09:31:17 +01:00
Andrii Tkachenko 1aac106a40 Test of row/columns generation with random format. 2018-02-07 07:22:33 +01:00
Andrii Tkachenko 2459b336ef benchmarks. Format benchmarks added. Load formats and styles benchmarks added. 2018-02-05 12:33:26 +01:00
Andrii Tkachenko f918c6cfaf benchmarks. Styles benchmarks updated with logs. Performance improved. 2018-02-05 10:51:01 +01:00
Andrii Tkachenko 1c50b35940 benchmarks. Styles benchmarks updated with logs. Performance improved. 2018-02-05 10:06:32 +01:00
Thomas Fussell 0f0d3de75f implement sheetFormatPr, x14ac:dyDescent, reordering workbook rels so sheets come first after insertions 2018-01-26 14:32:00 -05:00
Thomas Fussell 90633d0e8e copyright year bump (2018) 2018-01-22 09:38:48 -05:00
Thomas Fussell c960453ff4 prevent supression of failing round-trip tests 2017-12-10 15:03:03 -05:00
Thomas Fussell 44a8c8e79e minor reformatting 2017-12-09 16:04:44 -05:00
Thomas Fussell 675a8fad8a Merge branch 'sukoi26-dev' into dev 2017-12-09 15:46:10 -05:00
Thomas Fussell 1c85188ec6 Merge branch 'dev' of https://github.com/sukoi26/xlnt into sukoi26-dev 2017-12-09 15:45:49 -05:00
Thomas Fussell a653a39544 reformat a little 2017-12-08 15:31:25 -05:00
Thomas Fussell 182dea155b Merge branch 'dev' of github.com:tfussell/xlnt into dev 2017-12-08 15:20:36 -05:00
Thomas Fussell 842eedae8c Merge branch 'TataMata-master' into dev 2017-12-08 15:13:49 -05:00
Thomas Fussell 8bd85f9dbd
Merge pull request #246 from yanwei1983/master
cell_vector lost func "operator[]const"
2017-12-08 14:38:13 -05:00
Thomas Fussell 20c7d3437c
Merge pull request #248 from tlanc007/cellPropertyColors
custom_value_traits.hpp: pattern_fill from_string() ignores case
2017-12-08 14:37:24 -05:00
Thomas Fussell e261743032
Merge pull request #243 from Erroneous1/bug/miniz_const
fix -Wcast-qual in miniz
2017-12-08 13:59:32 -05:00
tal b008eacd89 custom_value_traits.hpp: pattern_fill from_string() ignores case
Values like lightGray will match with lightgray.  Unexpected inputs will
be ignored and return none.

Needs prama to clang to be happy.
2017-11-22 12:44:49 -07:00
TataMata d0bacf548c
Reformatted source
Reformatted pull request to match the library formatting style.
2017-11-12 10:34:51 +01:00
fred.yan 383337ad45 cell_vector lost func "operator[]const" 2017-11-09 14:17:49 +08:00
TataMata 8f9722686b
Delete CMakeLists.txt.user 2017-11-06 16:50:18 +01:00
Bernard Čupić 7cae301039 Added forgotten implementataion of const cell operator[std::size_t cell_index] const 2017-11-06 16:15:38 +01:00
sukoi26 4f07495abb
optimize latest commit missing a test 2017-11-06 14:12:08 +01:00
TataMata 6b668fd04e
Fix for the "index out of bounds" exception while reading styles
There was a bug introduced in version 1.2 in reading styles. As from the Office Open XML documentation:
Every cell will have a reference to one <xf> in the <cellXfs> collection. This is direct formatting for the cell. To apply a style to the cell, the <xf> references the style using the xfId attribute. The xfId attribute is an index into the <cellStyleXFs> collection, which collects the cell styles available to the user. The <cellStyleXFs> contains one <xf> for each style. Each such <xf> is tied to its name via an index (in its xfId attribute) from the <cellStyles> collection. 
Existing implementation simply tried to fetch a style name by using index in the styles vector causing an index_out_of_range exception for each xfId that was ot of bounds of cellStyles collection. What was needed is to match the xfId attribute of the cellStyle element.
2017-11-06 12:00:51 +01:00
TataMata b899c9db5c
Fix bug in cell style assingment
There was a bug introduced in version 1.2 in reading styles. As from the Office Open XML documentation:
2017-11-06 11:55:06 +01:00
sukoi26 caeadfc83c optimize code empty row cell 2017-11-04 23:41:48 +01:00
sukoi26 4a3e711a1b bug introduce by the commit continue work on #230, improves style/xf handling
as the style exist it is rewritten in cellStyleXfs and cellXfs,
with  the fillId test for format and style. remove the test and use only the format.
2017-11-04 18:12:38 +01:00
Aaron Bishop 0201f22237 fix const correctness error 2017-11-02 17:07:01 -04:00
Thomas Fussell c4a2bb8c6d Revert "add row height and column width serialization tests"
This reverts commit dc4befd867.
2017-10-30 19:53:39 -04:00
Thomas Fussell 29abdfa702 Merge branch 'master' into dev 2017-10-30 19:44:32 -04:00
Thomas Fussell 5b8820d2cd
Merge pull request #240 from shamanas/master
Setting the height of a row now produces the expected result.
2017-10-30 19:41:05 -04:00
Thomas Fussell 470c655df6 fix empty row height/cell width, #235 2017-10-30 19:36:24 -04:00
Thomas Fussell dc4befd867 add row height and column width serialization tests 2017-10-30 17:23:14 -04:00
Thomas Fussell 06b315b352 add interface to worksheet and range for clearing cells entirely, not just their values, for #232 2017-10-26 13:45:56 -04:00
Thomas Fussell 0e0bf0f8a1 continue work on #230, improves style/xf handling 2017-10-26 12:54:54 -04:00
Alexandros Naskos 7f08c77a90 Empty row properties are now written correctly. Setting a row's height now also causes customHeight to be emitted. 2017-10-25 15:04:51 +03:00
Thomas Fussell 0dcd56ebc9 (xlntpyarrow) check builder append return status and use double cell values instead of long double 2017-09-28 09:05:23 -04:00
Thomas Fussell 75de03745b start fixing serialization for #230 2017-09-28 08:55:16 -04:00
Thomas Fussell 34270f2333 specify return type of lambda to prevent compiler error 2017-09-27 17:39:59 -04:00
Thomas Fussell e910666c56 include missing header in path_helper 2017-09-27 17:35:35 -04:00
Thomas Fussell 919c65ceea Merge pull request #229 from downwash/master
Fix for issue #228: Worksheet ID is not always unique
2017-09-27 17:32:40 -04:00
vervbe c05b9f33c1 Fix for issue #228: Worksheet ID is not always unique
- Worksheet ID now generated from the maximum of existing IDs
- Worksheet ID no longer copied from existing sheet
- Added tests
2017-09-26 08:33:06 +02:00
Thomas Fussell 751599b44c add special case for numeric type cells with a date number format 2017-09-13 12:02:17 -04:00
Thomas Fussell 4c2c7a5859 add missing header for std::tolower 2017-09-13 11:03:18 -04:00
Thomas Fussell b2adee9fd3 implement upper case date/time handling, closes #221, closes #222, related to #220 2017-09-13 10:47:18 -04:00
Thomas Fussell a9b1e2af4a forgot to add new option for libstudxml too 2017-09-13 10:30:38 -04:00
Thomas Fussell f27df9732c add option to enable linking with static C runtime when compiling with MSVC, #214 2017-09-13 10:20:51 -04:00
Thomas Fussell 81812d6e29 implement sheet view selection consumption, closes #164 2017-09-13 09:36:42 -04:00
Thomas Fussell 9d71dda531 ensure only exceptions derived from xlnt::exception are thrown by library code plus some minor code cleanup, closes #163 2017-09-13 08:48:22 -04:00
Thomas Fussell bc1e3656c7 Merge branch 'master' into dev 2017-09-12 16:22:36 -04:00
Thomas Fussell c214c6ca0b Merge pull request #225 from hrsantiago/master
Parse readingOrder
2017-09-12 16:21:04 -04:00
Henrique Santiago ea5c741bfe Parse readingOrder 2017-09-12 17:04:52 -03:00
Thomas Fussell 985cfd28b4 swap readthedocs badge with gitbook badge [ci skip] 2017-09-10 09:45:06 -04:00
Thomas Fussell 954f4b84cd prevent exception on unhandled attributes 2017-09-10 09:36:53 -04:00
Thomas Fussell bf3e278ea1 change two missed long double literals into doubles 2017-09-10 09:36:04 -04:00
Thomas Fussell a21d659247 Merge pull request #218 from sukoi26/dev
Dev:  atttribut s optimize code
2017-09-08 23:16:01 -04:00
Thomas Fussell 299fc7d572 Merge branch 'dev' into dev 2017-09-08 23:15:06 -04:00
Thomas Fussell 94e19a6c70 Merge branch 'master' into dev 2017-09-08 23:10:05 -04:00
Thomas Fussell b1aac2c863 Create CODE_OF_CONDUCT.md 2017-09-08 23:09:35 -04:00
Thomas Fussell 396e6eb948 fix clang warnings 2017-09-08 22:59:19 -04:00
Thomas Fussell 12007fe2d8 change cell numeric value type from long double to double, closes #201 2017-09-08 21:05:34 -04:00
Thomas Fussell 7d0cf59286 correct off-by-one error in range dimension calculation, closes #213 2017-09-08 20:47:10 -04:00
Thomas Fussell 0d125b1534 encapsulate stateful stringstream string to float conversion into a separate struct 2017-09-08 20:10:46 -04:00
Thomas Fussell fcd68dba8f optimize cell memory usage. big improvement! 2017-09-08 19:41:34 -04:00
Thomas Fussell 716a81a19f optimize hot code paths 2017-09-08 19:08:38 -04:00
Thomas Fussell bbdace8b44 use memoization to replace cached static qnames 2017-09-08 18:03:56 -04:00
Thomas Fussell 85010f9f11 memoize calls to xml::qname builder 2017-09-08 17:39:59 -04:00
Thomas Fussell 53d7dbb67e install generated man page 2017-09-08 17:07:25 -04:00
Thomas Fussell b065cea22f Merge branch 'dev' of github.com:tfussell/xlnt into dev 2017-09-08 17:02:40 -04:00
Thomas Fussell 20d3a1dc98 generate man page from docs
generate man page from docs
2017-09-08 17:00:11 -04:00
Thomas Fussell fff2feccd2 update licenses 2017-09-08 15:26:47 -04:00
Thomas Fussell 7ed14246b2 clean up cmake files and add d suffix to xlnt debug library, closes #214 2017-09-08 14:33:18 -04:00
Thomas Fussell b7677d0783 disable stdout in serialization test 2017-09-08 13:58:50 -04:00
Thomas Fussell b0b43f6d8e cast character correctly for std::toupper 2017-09-08 13:57:29 -04:00
Thomas Fussell 50280ba2ab don't define THROW_ON_INVALID_XML by default on NDEBUG builds, fixes #179 2017-09-08 10:36:49 -04:00
sukoi26 60f3611c9c delete logo.h
no  feedback from Thierry
2017-09-05 20:51:18 +02:00
Thomas Fussell 2aaabb0579 Merge pull request #217 from tlanc007/issue216_clang5
Issue #216-cleanup for Clang 5.0 build
2017-09-04 15:59:23 -04:00
tal 46a10cfb7b Issue #216-cleanup for Clang 5.0 build
switched to nullptr instead of NULL or 0.
Switch some expressions using ',' to multiple statements separated by ';'
Removed unused template function
Used override keyword for some overridden virtual functions.
2017-09-04 13:43:30 -06:00
sukoi26 8d85ed917f Merge branch 'dev' into dev 2017-09-02 22:07:07 +02:00
Thomas Fussell 25bb6bfadf revert addition of NDEBUG for clang builds, come up with a better way to solve #179 2017-09-02 10:28:22 -04:00
Thomas Fussell f174dd825d Merge pull request #209 from pebble2015/master
fix #204 #205
2017-09-02 10:10:35 -04:00
Thomas Fussell cfe3934ab4 Merge pull request #207 from chris-b1/read-profile2
PERF: optimize read_cell
2017-09-02 10:08:08 -04:00
sukoi26 b21b856e68 code optimized for s attribut cell / row format
improve the performance
2017-08-29 13:01:47 +02:00
pebble2015 5461538396 fix xwindow bug
fix xwindow bug
2017-08-27 14:13:18 +08:00
pebble2015 17ce83e612 fix xwindow bug
fix xwindow bug
2017-08-27 13:58:17 +08:00
pebble2015 f3d5d18035 fix xwindow bug
fix xwindow bug
2017-08-27 13:44:06 +08:00
Chris e5d6a26e17 fixup formatting 2017-08-26 11:04:23 -05:00
Chris 5cc24fda39 PERF: optimize read_cell 2017-08-26 10:49:48 -05:00
sukoi26 f423c6e3fe Add an h file for the logo XLNT 2017-08-19 10:15:13 +02:00
Thomas Fussell 0ac12101fc remove accidental commit of test test 2017-08-18 21:38:53 -04:00
Thomas Fussell 4e2c0c0ffb use column width adjustment as specified in standard so that width in Excel on Windows matches value in xlnt, #193 2017-08-18 21:38:10 -04:00
Thomas Fussell 49b84a83c7 define missing method, worksheet::clear_page_breaks(), closes #192 2017-08-18 20:58:44 -04:00
Thomas Fussell c627db9984 update logo with new concept design 2017-08-18 20:54:54 -04:00
Thomas Fussell 3257274057 use utfcpp on all platforms since codecvt has been deprecated in c++17, closes #197 2017-08-15 18:23:28 -04:00
Thomas Fussell b5e10a8dbe clean up setup.py and install to LIBRARY_PREFIX on Windows instead of PREFIX 2017-08-08 07:15:50 -07:00
Thomas Fussell 60319c19d7 fix typos 2017-08-07 19:12:18 -07:00
Thomas Fussell b54b2399d9 ignore unknown-pragmas in clang, try to debug lib suffix, install using cmake instead of in setup.py 2017-08-07 19:00:49 -07:00
Thomas Fussell 5cefbc7dad path.join doesn't accept a list 2017-08-07 08:17:21 -07:00
Thomas Fussell 251387660f fix python extension build on linux 2017-08-07 07:52:13 -07:00
Thomas Fussell 8d9a4d5007 clean up read_batches and ignore some setup.py generated files 2017-08-07 07:26:04 -07:00
Thomas Fussell 474e802c40 use runtime_error instead of base exception and use arrow_home directly 2017-08-06 11:02:13 -07:00
Thomas Fussell 4cc9bee610 fix xlntpyarrow package structure and installation 2017-08-05 16:00:24 -07:00
Thomas Fussell 7cc9898dab move most of the pyarrow logic to python wrapper, use pyarrow's cmake setup.py code 2017-08-04 10:12:25 -07:00
Thomas Fussell e3ba39681e handle batches correctly. it works! 2017-08-01 16:32:06 -07:00
Thomas Fussell 2aa9e62e62 implement other type builders 2017-08-01 10:58:47 -07:00
Thomas Fussell 8801a0e352 figured out the problem 2017-07-30 20:32:37 -07:00
Thomas Fussell de0e010056 use pybind11 instead of raw C Python API, python_streambuffer is broken for now 2017-07-30 09:48:57 -07:00
Thomas Fussell eaaa310cef start implementing xlsx2arrow params 2017-07-19 17:21:55 -07:00
Thomas Fussell 8965cfa82c Merge branch 'dev' of github.com:tfussell/xlnt into dev 2017-07-18 14:25:49 -07:00
Thomas Fussell abdd1be7c8 move arrow logic to xlntpyarrow for now 2017-07-18 14:20:46 -07:00
Thomas Fussell ded81eab4a Merge pull request #190 from chris-b1/tryout
import_pyarrow returns error code, not bool
2017-07-18 13:07:23 -07:00
Chris 31611d85d5 import_pyarrow status code 2017-07-17 19:40:32 -05:00
Thomas Fussell 8d051e36e5 fix remaining clang warnings. so many static_casts... 2017-07-17 22:24:00 +00:00
Thomas Fussell 7da9187808 fix some clang warnings 2017-07-16 22:32:35 +00:00
Thomas Fussell b98f8c4fe7 don't cast integral long double to ptrdiff_t before writing to xml, fixes #188 2017-07-16 11:16:09 -07:00
Thomas Fussell 33399a5390 now we're getting somewhere! xlntpyarrow.xlsx2arrow returns an Arrow table that can be converted to a pandas DataFrame now 2017-07-15 10:39:36 -07:00
Thomas Fussell 5b95b3d463 begin implementing xlsx2arrow, fix msvc warnings, other stuff 2017-07-14 22:18:11 -07:00
Thomas Fussell 4367343e15 Merge branch 'dev' of github.com:tfussell/xlnt into dev 2017-07-13 18:40:36 -07:00
Thomas Fussell 1b7af5bccb I forgot that the extension is called xlntpyarrow and not myextension 2017-07-13 18:40:27 -07:00
Thomas Fussell c00a7a7798 put dll in the correct directory depending on system 2017-07-14 01:26:49 +00:00
Thomas Fussell 8e2486176e remove unused code 2017-07-13 17:54:17 -07:00
Thomas Fussell c00900e723 void can't return... 2017-07-13 17:51:34 -07:00
Thomas Fussell e991bbad43 get rid of traverse and clear since they were causing problems 2017-07-13 17:34:30 -07:00
Thomas Fussell e7af034e9e try to get xlnt dll to load 2017-07-13 12:42:47 -07:00
Thomas Fussell 99add77d98 remove single-version-externally-managed since it's not working for some reason 2017-07-12 23:15:11 -07:00
Thomas Fussell 0f5a1f7f20 try to make the module compatible with python 2.7 too 2017-07-12 22:55:15 -07:00
Thomas Fussell e16f5cfe51 file-specific warning disabling is not working so just disable -Werror on Clang for now [ci skip] 2017-07-12 08:55:21 -07:00
Thomas Fussell bec125d5c9 try again 2017-07-12 00:53:46 -07:00
Thomas Fussell 2949863c77 disable warnings on xlntarrow.cpp for now 2017-07-12 00:40:34 -07:00
Thomas Fussell 7c333ad923 replace backslashes with forward slashes in conda path 2017-07-12 00:31:12 -07:00
Thomas Fussell 0be7563f8b ignore arrow warnings and foward declare arrow 2017-07-12 00:03:26 -07:00
Thomas Fussell 13cfbe914f but it does depend on xlnt... 2017-07-11 22:14:13 -07:00
Thomas Fussell e6b0545c26 remove deleted xlntarrow dependency from xlntpyarrow target and don't compile xlntarrow when ARROW=OFF 2017-07-11 21:30:43 -07:00
Thomas Fussell 5c033905fb I see no good reason to make the arrow interface a separate lib. Let's just make it optionally compiled in the main target. 2017-07-11 20:55:08 -07:00
Thomas Fussell fee2319093 use static_cast instead of c-style cast for stream pointers 2017-07-11 20:40:55 -07:00
Thomas Fussell e38b1cdd69 fix gcc warnings 2017-07-09 16:44:00 +00:00
Thomas Fussell dfc5983155 clean up some paths 2017-07-08 21:18:46 -07:00
Thomas Fussell 84a6fdcc14 handle missing switch case in cell::to_string 2017-07-08 10:19:55 -07:00
Thomas Fussell 1709899373 fix some stuff [ci skip] 2017-07-07 20:16:37 -07:00
Thomas Fussell 04b0d4e2ab revert accidental commit of test change 2017-07-07 10:36:33 -07:00
Thomas Fussell 329fe488fe fix trailing space preventing linux python extension build 2017-07-06 10:28:31 -07:00
Thomas Fussell fa179d58ab add placeholder implementation of arrow2xlsx 2017-07-05 15:06:31 -07:00
Thomas Fussell 22325a2836 try to make windows and linux builds both work 2017-07-05 15:04:57 -07:00
Thomas Fussell f97ad6c1bd start working on streaming write 2017-07-04 17:52:46 -07:00
Thomas Fussell 16bfbf78f5 use cmake to build python module 2017-07-04 16:03:34 -07:00
Thomas Fussell bb96d01f49 start making python paths configurable 2017-07-03 08:54:30 -07:00
Thomas Fussell 5e3476f755 Merge branch 'feature/arrow' into dev 2017-07-03 08:42:31 -07:00
Thomas Fussell dbe60a5227 finish removing boost python dependency, looking promising! 2017-07-03 07:42:35 -07:00
Thomas Fussell 588809d74d start removing boost python dependency from python_streambuf 2017-07-03 06:47:42 -07:00
Thomas Fussell 49f520a9ed fix string array declarations and typo 2017-07-03 06:19:06 -07:00
Thomas Fussell 16683e4fbd compile xlntarrow as shared lib for now 2017-07-03 06:10:23 -07:00
Thomas Fussell dfa0ab6b69 clean up setup.py and prepare for cmake config 2017-07-03 06:08:55 -07:00
Thomas Fussell f9c17bf075 use nullptr instead of NULL, fix warning from storing string literal as non-const 2017-07-03 06:06:21 -07:00
Thomas Fussell 2aeec48b73 cast python function pointer to void pointer to avoid error 2017-07-03 06:01:33 -07:00
Thomas Fussell 80fb2a6e29 use c99 for for loop declarations 2017-07-03 06:00:27 -07:00
Thomas Fussell 6777982f08 clarify target_mode namespace 2017-07-02 19:17:14 -07:00
Thomas Fussell da8fdf6667 remove thousands separator 2017-07-02 19:15:42 -07:00
Thomas Fussell 9f95894372 use unique_ptr constructor instead of make_unique (C++14+ only) 2017-07-02 19:10:22 -07:00
Thomas Fussell 498f3a6f71 Merge branch 'master' into feature/arrow 2017-07-02 19:03:24 -07:00
Thomas Fussell aa8fc77964 Merge branch 'master' into feature/arrow 2017-07-02 19:01:24 -07:00
Thomas Fussell 456b9bbd80 specify hash to use (scoped_enum_hash) for variant::type hash table 2017-07-02 19:00:37 -07:00
Thomas Fussell 7fb9df97be ifdef out codecvt 2017-07-02 18:56:16 -07:00
Thomas Fussell 245f5117d3 don't use string_literal for now 2017-07-02 18:56:00 -07:00
Thomas Fussell e104c6a9b6 specify namespace in friend declaration 2017-07-02 18:54:32 -07:00
Thomas Fussell 9861dc761a typo 2017-07-02 18:40:11 -07:00
Thomas Fussell f502626418 forgot to conditionally include codecvt in path.cpp 2017-07-02 18:39:44 -07:00
Thomas Fussell 0ee0817757 include utfcpp for now to allow GCC <5.0 to build xlnt 2017-07-02 18:33:53 -07:00
Thomas Fussell c739eda35b get rid of underscores in file/directory names, try linking xlnt statically (is this good?) 2017-07-02 11:43:26 -04:00
Thomas Fussell 361078644e now we're getting somewhere. all components are building. just need to clean up build process, test on osx/linux, and actually write the real glue code 2017-07-01 10:46:48 -04:00
Thomas Fussell fa2e66ff2d mock out both conversion functions in the python module 2017-06-28 10:20:22 -04:00
Thomas Fussell 333e8c702f set up directory structure 2017-06-28 10:08:39 -04:00
Thomas Fussell 9f9dfe7a75 qualify use of extended_property enum class, fixes #186 2017-06-26 13:26:34 +00:00
Thomas Fussell d7b5374614 fix accidental commit of test file path 2017-06-25 13:14:56 -04:00
Thomas Fussell cf2dc9d7fb include streaming reader in xlnt.hpp 2017-06-25 13:14:29 -04:00
Thomas Fussell 56d744b6f9 start cleaning up code 2017-06-25 09:29:45 -04:00
Thomas Fussell fdd91f817f basic streaming read works now, just need to clean up the logic 2017-06-24 22:07:37 -04:00
Thomas Fussell 6f716c6e89 work on streaming cell reading, using ugly copy-pasted code for now [ci
skip]
2017-06-24 11:39:48 -04:00
Thomas Fussell 3153600768 read worksheet xml correctly 2017-06-22 08:56:01 -04:00
Thomas Fussell 72b8bd6b67 work out how to handle worksheet rels during streaming parsing 2017-06-21 09:17:06 -04:00
Thomas Fussell b79221860c show master branch travis build status [ci skip] 2017-06-20 13:36:37 -04:00
Thomas Fussell a9fd6b064e minor fixes to get it to compile. lots of failing tests for now... 2017-06-20 13:29:50 -04:00
Thomas Fussell d7e7526beb add failing tests and begin restructuring worksheet reading [ci skip] 2017-06-17 10:53:37 -04:00
Thomas Fussell eb201f5f70 handle absolute relationship targets the correct way 2017-06-16 09:13:42 -04:00
Thomas Fussell 2305eae8b6 pass streaming arg to read_part 2017-06-16 09:11:42 -04:00
Thomas Fussell 7834b564f4 handle absolute relationship targets the correct way 2017-06-16 09:11:24 -04:00
Thomas Fussell 7b391321f6 Merge branch 'master' into feature/streaming 2017-06-15 18:10:37 -04:00
Thomas Fussell 342184139f intermediate commit 2017-06-15 18:10:27 -04:00
Thomas Fussell 15492bdcc4 remove ambiguous wording about project status [ci skip] 2017-06-14 15:56:48 -04:00
Thomas Fussell cae6276b23 prevent exception from being thrown when a view doesn't contain window attributes 2017-06-14 15:45:01 -04:00
Thomas Fussell d14f8c2e5f fix canonicalization of relationship chains when the last link is absolute 2017-06-14 15:44:19 -04:00
Thomas Fussell 9d312ee7f4 make the code compile 2017-06-14 15:43:25 -04:00
Thomas Fussell b3c044948f start architecting streaming read/write api 2017-06-12 10:34:35 -04:00
Thomas Fussell 2c5d579a1b Merge branch 'master' of https://github.com/tfussell/xlnt 2017-05-10 08:44:41 -04:00
Thomas Fussell d2be054b7c optimize shared strings and handle formula strings correctly 2017-05-10 08:44:25 -04:00
Thomas Fussell 4351dfd4ca Merge pull request #149 from tpmccallum/master
Update documentation
2017-05-09 09:29:46 -04:00
Thomas Fussell b851d1c143 prevent share string formatting from being overwritten during consumption 2017-05-09 09:01:01 -04:00
Thomas Fussell f0b1e789a3 use xml:space=preserve when writing shared strings with trailing whitespace 2017-05-09 08:46:12 -04:00
Thomas Fussell 237fdcc84b ignore missing calcChain when comparing xlsx files during testing 2017-05-08 11:40:01 -04:00
Thomas Fussell 7ddd290e92 ignore dateCompatibility attribute too 2017-05-08 11:38:10 -04:00
Thomas Fussell 4aff818a87 kepp calcChain relationship, but don't actually write file to prevent excel file recovery warning 2017-05-08 10:51:56 -04:00
Thomas Fussell a37a1e102a handle all workbookPr attributes according to ecma 376 2017-05-08 10:50:33 -04:00
Timothy McCallum e5da1f41cb Adding clarification about the order of arguments
Cell reference arguments are column, row whereas vector arguments are row, column
Just a little more explanation to avoid confusion (as the arguments are reversed for each of the functions which we access on the same line.
2017-05-05 08:35:09 +10:00
Timothy McCallum 213c250751 Fixing indentation
Fixing indentation after transferring code from another area to here; somehow looses the formatting when pasting. No bother, easy fixed and back to Allman indentation.
2017-05-04 18:03:02 +10:00
Timothy McCallum 75052ac97a Adding documentation on writing to a spread sheet
This is a quick and easy example of how create a vector of values and write them to a spread sheet
2017-05-04 16:59:40 +10:00
Timothy McCallum 06fb2cf812 Adding an indication of time to install
Gives the user an idea of how long they need to spend on the task
2017-05-04 14:41:45 +10:00
Timothy McCallum 24ce486ebc Updating the documentation using xlnt 1.x.x
This work is to test the new version of xlnt - released today. The installation is much simpler now due to the fact that xlnt no longer relies on third party libraries. This was a great move! I have confirmed that the minimum gcc version required is 6.2.0. work will still continue into exploring how the newest gcc 7.1 will impact xlnt. However, this will be covered under another heading and documentation issue/ticket and will involve installing gcc 7.1 from source and so forth. the documentation in this commit is purely intended to get a new users off and running with xlnt in the shortest possible time and with the least amount of effort.
2017-05-04 14:11:16 +10:00
Timothy McCallum 94c5ba2e15 Adding tpmccallum
Congratulations on the version 1 release, and the 1000 commit milestone. Looking forward to contributing on version 1 and beyond.
2017-05-04 11:59:33 +10:00
Thomas Fussell e043aeaff7 Merge pull request #146 from tpmccallum/master
Documentation
2017-05-03 20:34:10 -04:00
Timothy McCallum 32dba95709 Removing using namespace in the header
This has been updated and is ready for deployment. No namespaces used in the header of the code now, just explicit calls in the functions. std::string, std::vector, std::clog, std::endl, xlnt::workbook.
2017-05-04 09:15:18 +10:00
Timothy McCallum c430fca9ff Removing the third-party runtime dependencies
Removing zlib1g, libssl-dev, cryptopp, and expat.

Cryptography now uses public domain code in the source tree (source/detail/cryptography), zlib was replaced with miniz and added to the source tree (source/detail/serialization/miniz.*), and since it's already a part of libstudxml (i.e. a grandchild dependency), xlnt is now using libstudxml's expat (third-party/libstudxml/xml/details/expat).
2017-05-04 08:48:08 +10:00
Timothy McCallum b5997bd878 Updating compile command
Removing the -I and -L arguments from the compile command.
I realize that it is unnecessary to specify a list of directories (to be searched) for header files and so forth in the event that the standard xlnt installation process was followed.
2017-05-04 08:31:35 +10:00
Timothy McCallum 4c5e5f3b2c Changing indent level of braces
Using Allman indent style
2017-05-04 08:24:03 +10:00
Thomas Fussell f32859b257 stop trying to read generated agile encryption info xml for now since it's not valid 2017-05-03 12:16:18 -04:00
Thomas Fussell 239c76659f work on writing a valid compound document 2017-05-02 22:22:22 -04:00
Timothy McCallum 0dcdb01bf6 Fixing indent
Just formatting
2017-05-02 22:06:47 +10:00
Timothy McCallum ed900e28dc Providing example of how to data into C++ Vector
Just an example of how to read a spread sheet into memory. Also a little word on performance. More to come on this later.
2017-05-02 22:03:17 +10:00
Timothy McCallum 7298bc0d9d Fixing indenting 2017-05-02 21:34:25 +10:00
Timothy McCallum 356c851dfd Fixing up formatting
Fixing indent
2017-05-02 21:32:16 +10:00
Thomas Fussell a5c0d03bcc fix windows dll problem due to not exporting vector_streambufs 2017-04-30 23:25:57 -04:00
Thomas Fussell e26364c388 better 2017-04-30 23:13:13 -04:00
Thomas Fussell c677a14969 fix some stream reading. all tests passing (very very slowly) so now it's time for optimization 2017-04-30 21:16:05 -04:00
Thomas Fussell ee642fc6c1 getting there 2017-04-30 20:21:47 -04:00
Timothy McCallum e122494495 Update Installation.md 2017-05-01 09:46:18 +10:00
Timothy McCallum f3e475d4ae Adding a simple read example
A simple writing example to come soon.
More complex examples also coming soon and hopefully high performance examples will not be too far away.
2017-05-01 09:45:41 +10:00
Timothy McCallum 292c7faea4 Adding ldconfig command at the end of Ubunbtu doc
Need to run ldconf so that the shared libraries are found when running cpp executable (your xlnt program)
2017-05-01 08:53:53 +10:00
Timothy McCallum 30914a930f Fixing up some formatting
Removing the TODO from last commit
2017-05-01 07:52:02 +10:00
Timothy McCallum 0a6d093010 Finalizing Ubuntu installation documentation
Ready for pull request
2017-05-01 07:49:59 +10:00
Thomas Fussell 4da901d387 forgot to commit new vector_streambuf source file 2017-04-30 17:37:35 -04:00
Thomas Fussell b7bf16d47c implement input and output streambufs for compound document streams 2017-04-30 17:23:28 -04:00
Timothy McCallum 3ce51089cd Finished installing xlnt
Need to test some code now
2017-04-30 19:13:59 +10:00
Thomas Fussell f42d3eee74 move vector_streambuf definitions to a separate file, fix zip buffer bug 2017-04-29 12:29:41 -04:00
Thomas Fussell f5b5d67594 wip 2017-04-28 17:56:05 -04:00
Thomas Fussell be37df3c86 intermediate commit 2017-04-28 12:42:42 -04:00
Thomas Fussell 6334907de7 work on short streams 2017-04-28 10:58:55 -04:00
Timothy McCallum 5268651937 Updating the comments
Still waiting for gcc to compile
2017-04-28 13:46:19 +10:00
Timothy McCallum 1214c4d2ce Updating the TODO section
Adding the future steps in readiness; waiting for the gcc 6.3.0 to compile - boy that takes a while.
Next step is to run everything after the TODO line and the create a pull request to finalize the documentation
2017-04-28 13:43:33 +10:00
Timothy McCallum 133dbea920 Adding Ubuntu installation instructions
Working on the baseline environment set up and the installation of the compiler (from source), more to come
2017-04-28 11:41:22 +10:00
Thomas Fussell a90b32f386 switch to full in-memory approach, still working 2017-04-26 23:19:28 -04:00
Thomas Fussell bb91308dd4 work in progress 2017-04-26 12:02:49 -04:00
Thomas Fussell 1e1e8272ae coding is done finally. time to debug some compound files 2017-04-25 18:14:47 -04:00
Thomas Fussell 562e163bf6 try to add a red black tree. I haven't done algorithms in a long time 2017-04-24 22:16:03 -04:00
Thomas Fussell be59d522a6 still working. It's starting to come together 2017-04-24 19:23:51 -04:00
Thomas Fussell c642db6cc2 continue fleshing out cdf writing, getting close now... 2017-04-24 16:06:58 -04:00
Thomas Fussell 16e1a1f124 intermediate commit 2017-04-24 08:50:10 -04:00
Thomas Fussell 8f4f24c180 start wiring up directory tree during writing 2017-04-23 20:51:50 -04:00
Thomas Fussell c020d31f58 delete allocation table class 2017-04-23 20:27:16 -04:00
Thomas Fussell 322190d386 remove header offset and set sector size before loading master allocation table sectors 2017-04-23 18:56:31 -04:00
Thomas Fussell 126f22816b intermediate commit 2017-04-23 18:18:35 -04:00
Thomas Fussell 2fc692d694 separate compound file into a reader and a writer class 2017-04-23 16:56:01 -04:00
Thomas Fussell be11002a93 fix clang warnings 2017-04-23 11:53:52 -04:00
Thomas Fussell f38dc4169b finish rewriting pole, continue work on encryption 2017-04-22 20:43:26 -04:00
Thomas Fussell 89858e32b3 intermediate commit 2017-04-22 14:25:27 -04:00
Thomas Fussell 3a57242b68 clean up pole, get it ready for writing 2017-04-21 21:58:40 -04:00
Thomas Fussell e2f733f6e0 intermediate commit 2017-04-21 19:52:02 -04:00
Thomas Fussell e1bf1f6262 point lcov removal to the moved miniz file 2017-04-20 14:57:25 -04:00
Thomas Fussell 4dedcd23dd use some placeholder data for agile key 2017-04-20 14:49:38 -04:00
Thomas Fussell b26d764624 fix some gcc problems 2017-04-20 14:12:59 -04:00
Thomas Fussell b2a5110939 organize detail files, start wiring up encryption logic 2017-04-20 14:03:03 -04:00
Thomas Fussell 8d1f044793 save lcov remove output and move to root so coveralls-lcov can find source files 2017-04-20 00:56:18 -04:00
c45d1e63e7 try to clean up coverage and fix coveralls->github link 2017-04-20 00:31:29 -04:00
Thomas Fussell 40ba1012b3 move endian swap to a separate function 2017-04-19 16:55:41 -04:00
Thomas Fussell 868f661be7 use /usr/local as the default CMAKE_INSTALL_PREFIX, #138 2017-04-19 16:54:51 -04:00
Thomas Fussell 607e069b33 fix two crypto related todos 2017-04-19 16:00:33 -04:00
Thomas Fussell ff56701774 update AUTHORS 2017-04-19 09:12:35 -04:00
Thomas Fussell ca17462f43 add missing include for std::transform 2017-04-18 20:11:16 -04:00
Thomas Fussell 83ea1ff58e implement password verification for standard encrypted xlsx files 2017-04-18 19:50:37 -04:00
Thomas Fussell adda7b877a add meta tests (tests that test test functions), optimize sha calls, test incorrect passwords 2017-04-18 18:30:54 -04:00
Thomas Fussell b3cc07e5db include header for std::fabs 2017-04-13 22:38:26 -04:00
Thomas Fussell b0f1bf4b77 include headers for memcpy and size_t in sha implementations 2017-04-13 22:31:44 -04:00
Thomas Fussell 28cee5f14b use platform-dependent byteswap 2017-04-13 21:59:09 -04:00
Thomas Fussell 05c1565a83 link in libstudxml for tests for some reason 2017-04-13 21:53:58 -04:00
Thomas Fussell 3b2a0ac5d6 switch to much faster project nayuki sha implementations 2017-04-13 21:45:07 -04:00
Thomas Fussell 104e3bea25 clean up samples and benchmarks, data handling 2017-04-13 20:18:32 -04:00
Thomas Fussell c68aa8fc84 finish wiring up tests 2017-04-13 19:24:20 -04:00
Thomas Fussell 185d108e82 delete some empty test suites 2017-04-13 19:03:59 -04:00
Thomas Fussell b85680c5ed start rewiring tests 2017-04-13 19:01:30 -04:00
Thomas Fussell 62f659b901 fix some rough edges 2017-04-13 14:57:27 -04:00
Thomas Fussell 835e36d6ae initial commit withou cxxtest 2017-04-13 14:51:35 -04:00
Thomas Fussell 46df18c12b improve unicode tests 2017-04-13 10:58:40 -04:00
Thomas Fussell 8bf7d0c7a6 oops, forgot to include the locale, #144 2017-04-12 19:48:00 -04:00
Thomas Fussell 8b1c6c7465 a little platform dependent magic to fix build problems, affects #144 2017-04-12 19:44:18 -04:00
Thomas Fussell 5b9304960c accept utf8 passwords for decrypting workbooks, #144 2017-04-12 19:21:21 -04:00
Thomas Fussell e465151dec fix logo 2017-04-12 10:33:40 -04:00
Thomas Fussell 714ec4ed6f fix typo [ci skip] 2017-04-12 10:25:34 -04:00
Thomas Fussell 529ca91a00 update readme doc links [ci skip] 2017-04-12 10:20:18 -04:00
Thomas Fussell 40ccc283ee start working on documentation [ci skip] 2017-04-12 10:17:26 -04:00
Thomas Fussell fb59d5b880 fix windows build 2017-04-11 22:25:33 -04:00
Thomas Fussell a3bfd86828 try to link/export local expat correctly 2017-04-11 18:21:01 -04:00
Thomas Fussell 5450a23be1 apparently pArray is used in debug builds 2017-04-11 18:13:38 -04:00
Thomas Fussell fd737912ce fix some vs-specific problems 2017-04-11 18:10:24 -04:00
Thomas Fussell 4b174ab268 fix misleading indentation in miniz, missing header, and missing forward declarations 2017-04-11 18:04:05 -04:00
Thomas Fussell 05fb40438c Merge branch 'master' of github.com:tfussell/xlnt 2017-04-11 17:57:56 -04:00
Thomas Fussell cdcd49305d add base64 license 2017-04-11 17:55:52 -04:00
Thomas Fussell 04cc698416 update ci scripts 2017-04-11 17:52:57 -04:00
Thomas Fussell 9fa9343d89 fix some stuff 2017-04-11 17:49:07 -04:00
Thomas Fussell c902af7e17 fix doxygen warnings 2017-04-11 17:27:41 -04:00
Thomas Fussell ac768830bc update licenses 2017-04-11 17:18:57 -04:00
Thomas Fussell 4c40651451 add license header to some crypto files 2017-04-11 16:58:09 -04:00
Thomas Fussell be0c1ac03a remove unused headers 2017-04-11 16:10:57 -04:00
Thomas Fussell a7cd2c9ee5 link in libstudxml as object files 2017-04-11 16:04:17 -04:00
Thomas Fussell 077e181617 pare down ltc 2017-04-11 14:23:54 -04:00
Thomas Fussell 0d65569857 pare down ltc 2017-04-11 14:14:36 -04:00
Thomas Fussell ea7b7074f0 pare down ltc 2017-04-11 13:48:09 -04:00
Thomas Fussell 36dc88cf24 pare down ltc 2017-04-11 13:35:50 -04:00
Thomas Fussell cc165dbb67 pare down ltc 2017-04-11 13:11:05 -04:00
Thomas Fussell c57e1a2bbe pare down ltc 2017-04-11 12:38:20 -04:00
Thomas Fussell 3e2a0fc15f pare down ltc 2017-04-11 12:02:35 -04:00
Thomas Fussell 83cbc3f7eb organize files 2017-04-11 11:26:57 -04:00
Thomas Fussell fc4d284615 begin removing external dependencies 2017-04-11 11:08:16 -04:00
Thomas Fussell 116106d568 fix conditional_format redefinition warning and don't try to write conditional formats for a worksheet without a stylesheet 2017-04-03 19:49:38 -04:00
Thomas Fussell d54ddea5cc Merge branch 'master' of http://github.com/tfussell/xlnt 2017-04-03 19:24:46 -04:00
Thomas Fussell 9766daacd5 initial implementation of conditional formatting plus a nifty little sample of converting images to workbooks 2017-04-03 19:24:36 -04:00
Thomas Fussell 83d2d18d1f finish documenting all headers (well enough). closes #28 2017-03-30 23:52:57 -04:00
Thomas Fussell c3d9b85530 document some style classes, start implementing builtin styles more correctly 2017-03-26 10:30:26 -04:00
Thomas Fussell 1121bcbe15 boring boring documentation 2017-03-25 11:22:21 -04:00
Thomas Fussell e040a1c4ab appveyor cache limit was reached so reduce the build matrix for now 2017-03-23 23:09:22 -04:00
Thomas Fussell a11645b42a try again, with a more elegant approach to environment variables 2017-03-23 22:31:36 -04:00
Thomas Fussell 7fc5033571 try again 2017-03-23 21:51:38 -04:00
Thomas Fussell 5d6c5e9346 try again 2017-03-23 21:06:20 -04:00
Thomas Fussell 9a3c215359 try again 2017-03-23 20:42:40 -04:00
Thomas Fussell 6a893c954c try again 2017-03-23 20:40:59 -04:00
Thomas Fussell 8a9e33d55c try to build 32 and 64-bit with appveyor. let's see how badly this breaks things 2017-03-23 20:34:33 -04:00
Thomas Fussell 4ca534a83a fix size_t to row_t/column_t::index_t conversion warning 2017-03-23 20:13:05 -04:00
Thomas Fussell 31c152c9b6 specify gcov 6 for travis build 2017-03-23 20:08:21 -04:00
Thomas Fussell 0d82aba640 improve 1d and 2d cell iteration for #135, including making empty cell skipping optional 2017-03-23 20:05:25 -04:00
Thomas Fussell c7f61e38c1 restore worksheet::cell(column_t, row_t) method (#137) and move some single use classes/structs/enums into parent header 2017-03-22 21:44:59 -04:00
Thomas Fussell 0541b74c1f rebuild documentation and add missing javascripts 2017-03-22 21:43:25 -04:00
Thomas Fussell c9dc05597b ignore unknown documentation command warning for clang 2017-03-22 21:42:36 -04:00
Thomas Fussell 3cfcc7246c clean up travis adding a build matrix 2017-03-22 21:41:00 -04:00
Thomas Fussell e7059d5475 prevent cc and cxx from being overwritten 2017-03-22 00:29:39 -04:00
Thomas Fussell 05dbd37e4f attempt to remove compiler in order to prevent cc and cxx from being overwritten 2017-03-22 00:25:21 -04:00
Thomas Fussell d6d726d391 almost got it 2017-03-22 00:21:31 -04:00
Thomas Fussell dabd29fc59 this seems unlikely to work 2017-03-21 23:28:40 -04:00
Thomas Fussell c81378f6e1 keep trying things 2017-03-21 23:12:04 -04:00
Thomas Fussell 8d04b6501c keep debugging coverage 2017-03-21 22:34:49 -04:00
Thomas Fussell dc0a8caa8b try again 2017-03-21 22:17:30 -04:00
Thomas Fussell 638c1b0df4 I can't find the gcda files 2017-03-21 22:13:00 -04:00
Thomas Fussell 2627f729bd try to specify gcov corresponding to compiler 2017-03-21 22:05:08 -04:00
Thomas Fussell 86e39164a2 debug some travis paths 2017-03-21 21:57:48 -04:00
Thomas Fussell f7338e9afc fix lcov directory 2017-03-21 21:41:57 -04:00
Thomas Fussell 3b073a8b76 samples and benchmarks are missing gcov library so let's just skip them in travis for now 2017-03-21 21:25:38 -04:00
Thomas Fussell 658a0e05d0 just do it the old way 2017-03-21 21:20:08 -04:00
Thomas Fussell ec65198255 almost got it 2017-03-21 21:14:56 -04:00
Thomas Fussell b3e7cfda16 try to find the repo directory 2017-03-21 21:11:40 -04:00
Thomas Fussell e13f0a6958 I don't know what I'm doing 2017-03-21 21:07:21 -04:00
Thomas Fussell 9b82608ba0 remove ruby from travis apt-get packages and try to fix cmake command 2017-03-21 20:35:50 -04:00
Thomas Fussell 2fca439ca6 try to fix incorrectly formatted yaml 2017-03-21 20:28:10 -04:00
Thomas Fussell 470a571755 try reporting coverage again, this time using coveralls-lcov 2017-03-21 20:25:52 -04:00
Thomas Fussell e8204133a9 switch xlsx_producer cell value call, how many more can there be? 2017-03-21 19:58:16 -04:00
Thomas Fussell fcf4d424ff also remove some cell getter template specializations 2017-03-21 19:51:16 -04:00
Thomas Fussell 938990cee5 also fix cell test cell value overloads 2017-03-21 19:38:52 -04:00
Thomas Fussell 3e89c3d196 set path to x64 to match appveyor win64 arch 2017-03-21 19:35:57 -04:00
Thomas Fussell 3feee30eac remove of the cell value xlsx producer tests 2017-03-21 19:31:23 -04:00
Thomas Fussell c448536e38 change benchmark call away from removed cell method, fix benchmark warnings 2017-03-21 19:14:27 -04:00
Thomas Fussell f6626e5079 correct syntax error in libstudxml CMakeLists, closes #136 2017-03-21 18:51:50 -04:00
Thomas Fussell b914b064b7 remove some more extraneous worksheet methods 2017-03-20 20:33:15 -04:00
Thomas Fussell d8c9d14a98 clean up worksheet api 2017-03-20 20:17:09 -04:00
Thomas Fussell 497699700f try to build 64-bit lib in appveyor 2017-03-20 19:27:00 -04:00
Thomas Fussell 6b119bec0c define _CRT_SECURE_NO_WARNINGS for libstudxml to supress MSVC C4996 2017-03-20 19:24:34 -04:00
Thomas Fussell f862de1ff7 fix clang warning from extraneous semicolon 2017-03-20 19:23:44 -04:00
Thomas Fussell ea95c6d33b fix gcc warning from unused variable 2017-03-20 19:23:22 -04:00
Thomas Fussell cf7f4e6c83 clean up switches, closes #133 2017-03-20 19:22:46 -04:00
Thomas Fussell e617d140f0 implement unhandled_switch_case exception 2017-03-20 19:20:48 -04:00
Thomas Fussell e0e38a931c remove template from cell::value setter, closes #131 2017-03-20 19:20:12 -04:00
Thomas Fussell 7fa5099a49 try to fix appveyor vcpkg cache 2017-03-19 23:26:37 -04:00
Thomas Fussell f7db4b0248 add default cases for hash_algorithm value traits serialization 2017-03-19 23:21:40 -04:00
Thomas Fussell 07001e0c07 include functional for std::function 2017-03-19 14:39:33 -04:00
Thomas Fussell 8066b853d7 try caching vcpkg and switch back to HEAD of master 2017-03-19 14:37:59 -04:00
Thomas Fussell 8f4c82dffd add batch formatting methods to range class 2017-03-19 14:22:29 -04:00
Thomas Fussell d7ee03d620 Merge branch 'master' of github.com:tfussell/xlnt 2017-03-18 21:31:05 -04:00
Thomas Fussell 21d05c4572 remove tests requirement on threads, add setting to disable tests 2017-03-18 21:30:26 -04:00
Thomas Fussell 9dccde4bff handle libstudxml and expat configuration better 2017-03-17 18:21:22 -04:00
Thomas Fussell d7cd24c9f2 specify python interpreter for cxxtestgen 2017-03-17 00:13:58 -04:00
Thomas Fussell fe041b9aa1 increment ws index when writing calcChain 2017-03-13 19:12:17 -04:00
Thomas Fussell c11fcd169e initial implementation of calcChain parser. I can only imagine how many problems I'm overlooking here 2017-03-13 19:10:14 -04:00
Thomas Fussell f908dca6fe bump version to 0.9.4 2017-03-12 17:33:52 -04:00
Thomas Fussell c2365b3b31 set dll path before running tests, copy xlnt dll 2017-03-11 17:28:03 -05:00
Thomas Fussell 61bfdc2aee for real this time 2017-03-11 15:38:27 -05:00
Thomas Fussell b2dbd2223b I think I've finally got it... 2017-03-11 15:04:54 -05:00
Thomas Fussell 98d5b64706 link libstudxml to xlnt.test too 2017-03-11 14:57:08 -05:00
Thomas Fussell 5e60b61fe9 specify module path 2017-03-11 14:47:56 -05:00
Thomas Fussell 2bbcb9f7bf link cryptopp to xlnt.test 2017-03-11 14:40:34 -05:00
Thomas Fussell f7e8e40ce2 try to find vcpkg cryptopp with FindCryptoPP.cmake 2017-03-11 14:29:55 -05:00
Thomas Fussell eb078dce99 link expat correctly 2017-03-11 14:19:23 -05:00
Thomas Fussell 11fb80ceaf recommit the cxxtest headers 2017-03-11 14:13:23 -05:00
Thomas Fussell af2005f41a remove accidental submodule 2017-03-11 14:11:49 -05:00
Thomas Fussell 80c7664509 add cxxtest to the source tree, external depepdencies are giving me a headache 2017-03-11 14:05:50 -05:00
Thomas Fussell bb600ee1ce don't specify release libs for cryptopp and zlib 2017-03-11 11:53:54 -05:00
Thomas Fussell d991466e6f revert to system cmake 2017-03-11 11:46:53 -05:00
Thomas Fussell 70e520ef47 fix local cmake path 2017-03-11 11:34:39 -05:00
Thomas Fussell 92eaaeee85 I don't even know at this point 2017-03-11 11:25:03 -05:00
Thomas Fussell 763504e532 change to back slashes 2017-03-11 11:22:34 -05:00
Thomas Fussell 3b35dbb901 specify cryptopp library name for appveyor 2017-03-11 11:15:35 -05:00
Thomas Fussell 5f9ab3a5f7 use backslash instead of forward slash 2017-03-11 10:49:22 -05:00
Thomas Fussell f42a0008b7 still need to include libstudxml in xlnt.test, I forgot 2017-03-11 10:48:58 -05:00
Thomas Fussell b404f36178 try older commit of vcpkg 2017-03-11 10:42:36 -05:00
Thomas Fussell b4d84f29f1 link zlib in a better way 2017-03-11 10:37:28 -05:00
Thomas Fussell e2f8720bb2 debug appveyor 2017-03-11 10:33:58 -05:00
Thomas Fussell 924b5a4a71 make zlib part of xlnt's link interface 2017-03-11 10:22:59 -05:00
Thomas Fussell ffc8c76f0a debug appveyor 2017-03-11 10:16:54 -05:00
Thomas Fussell 4f47087d7e correct cxxtestgen location 2017-03-11 10:13:42 -05:00
Thomas Fussell 77eeb3b567 fix cxxtestgen directory 2017-03-10 19:10:56 -05:00
Thomas Fussell db259e9422 workaround for cxxtestgen 2017-03-10 19:08:03 -05:00
Thomas Fussell e93e8ed091 fix linking 2017-03-10 19:00:10 -05:00
Thomas Fussell 29ea2a4e99 install expat with vcpkg on appveyor, always link cryptopp and zlib 2017-03-10 18:48:22 -05:00
Thomas Fussell daae577178 stop trying to build zlib and cryptopp locally 2017-03-10 18:33:20 -05:00
Thomas Fussell 11b92cf034 try 32-bit build and specify vcpkg toolchain for appveyor 2017-03-09 21:45:57 -05:00
Thomas Fussell 192e0d87d6 try to prevent prompt for downloading local cmake 2017-03-09 21:35:52 -05:00
Thomas Fussell 5b61145a0b only expect alternatecontent if it's present 2017-03-09 21:35:36 -05:00
Thomas Fussell 689bbee098 Merge pull request #127 from sukoi26/master
minor changes border style name upper letter ,  comment skip mc:Ignorable , alternativContent
2017-03-09 21:06:10 -05:00
sukoi26 a6e9907b14 Merge pull request #3 from tfussell/master
update
2017-03-06 19:46:46 +01:00
Thomas Fussell 9b4ef0db03 use the correct tests directory for the test executable 2017-03-05 23:12:14 -05:00
Thomas Fussell c87fdb1a1a link zlib to samples and benchmarks as a temporary workaround 2017-03-05 23:08:32 -05:00
Thomas Fussell 533a20bdc3 fix samples cmake lists 2017-03-05 22:59:55 -05:00
Thomas Fussell 4fdba1abce change cxxtest cmake min version to 3.2 to match other lists 2017-03-05 22:52:14 -05:00
Thomas Fussell 8c16bd037f change third-party cmake min version to 3.2 to match other lists 2017-03-05 22:50:42 -05:00
Thomas Fussell 2f9d35b983 try to use cxxtest from apt for travis 2017-03-05 22:48:15 -05:00
Thomas Fussell 0aa26019e2 clean up cmake lists 2017-03-05 22:39:27 -05:00
sukoi26 d9f755c67b Merge pull request #2 from tfussell/master
update tfussel
2017-03-02 19:31:54 +01:00
Thomas Fussell 3883d8ae19 use correct cryptopp apt-get packages 2017-03-02 08:50:00 -05:00
Thomas Fussell 273bb97bc3 include libstudxml in source tree since it will never be a system library 2017-03-02 08:47:16 -05:00
Thomas Fussell 3db6cc8f0f use externalproject instead of git submodules for dependencies 2017-03-02 08:41:17 -05:00
sukoi26 fc1d73fee2 Merge pull request #1 from tfussell/master
update
2017-03-01 19:42:41 +01:00
Thomas Fussell 65ad2466e1 use the correct names for apt-get 2017-02-28 00:26:17 -05:00
Thomas Fussell ba533688c3 update samples and benchmarks build, work on ci scripts 2017-02-28 00:07:37 -05:00
Thomas Fussell 9cdf31065c improve third-party lib handling for vcpkg 2017-02-28 00:00:25 -05:00
Thomas Fussell d7b0e252fd write missing property attribute for dcterms:created and dcterms:modified, update headingpairs and titlesofparts when sheet titles change 2017-02-27 07:47:33 -05:00
Thomas Fussell 0db50a7b15 improve property handling, comment serialization 2017-02-25 08:55:11 -06:00
Thomas Fussell 9535f94e38 don't attempt to garbage collect cells without formulae, closes #121 2017-02-25 08:54:38 -06:00
sukoi26 fcb16ed655 comment change skip "mc:Ignorable" attribut and "mc:alternateContent"
concern  location of the comment
"the Ignorable attribute specifies namespaces that can be ignored when they are not understood by the consuming application. Alternate-Content elements specify markup alternatives that can be chosen by an application at run time. For example, Word 2013 can choose only the markup alternative that it recognizes. The complete list of compatibility-rule attributes and alternate-content elements and their details can be found in the specification. " and so  to  implement
2017-02-25 11:50:45 +01:00
sukoi26 2daf1dd32a boder style upper case name
Value must be one of {‘medium’, ‘mediumDashDot’, ‘mediumDashed’, ‘dashDotDot’, ‘double’, ‘dotted’, ‘mediumDashDotDot’, ‘thick’, ‘thin’, ‘hair’, ‘dashed’, ‘slantDashDot’, ‘dashDot’}
2017-02-24 23:14:03 +01:00
sukoi26 07cefa4a2d border style upper case letter
Value must be one of {‘medium’, ‘mediumDashDot’, ‘mediumDashed’, ‘dashDotDot’, ‘double’, ‘dotted’, ‘mediumDashDotDot’, ‘thick’, ‘thin’, ‘hair’, ‘dashed’, ‘slantDashDot’, ‘dashDot’}
2017-02-24 23:10:57 +01:00
Thomas Fussell 4ed8dae49c minor cleanup 2017-02-18 20:33:59 -06:00
Thomas Fussell c01af37da3 Merge branch 'sukoi26-master' 2017-02-18 10:25:16 -06:00
sukoi26 60459bcd25 Merge remote-tracking branch 'upstream/master' 2017-02-18 09:27:06 +01:00
Thomas Fussell 767d498dac separate crypto_helper into header file, fix lots of stuff 2017-02-17 23:11:06 -06:00
sukoi26 b758b5f7e5 recommit "rename some things and fix some formatting" 2017-02-14 22:45:44 +01:00
sukoi26 6b9995be44 recommit "rename some things and fix some formatting" 2017-02-14 22:33:54 +01:00
sukoi26 dc3decd0be fix some comments on autofilter update
push mistake
2017-02-14 22:11:31 +01:00
sukoi26 bb8202f779 update for xf pivotButton quotedPrefix attributes 2017-02-14 22:02:51 +01:00
sukoi26 8fa929256d update quotePrefix location , add pivotButton 2017-02-13 16:28:32 +01:00
sukoi26 167c14e908 attribute "quotePrefix" in style
skip temporary , to analyze the using
2017-02-13 15:01:42 +01:00
sukoi26 0c517a9b0a autofilter complex type
a filter is a complex type to manage 
<autoFilter ref="A1:D25"> 
  <filterColumn colId="0"> 
    <filters> 
      <filter val="Southeast" /> 
      <filter val="Northeast" /> 
    </filters> 
  </filterColumn> 
</autoFilter>
2017-02-13 13:41:35 +01:00
Thomas Fussell 84011553a8 rename some things and fix some formatting 2017-02-10 20:22:38 -08:00
Thomas Fussell 81258f1498 Merge branch 'sukoi26-master' 2017-02-10 13:12:02 -08:00
sukoi26 b0664ded17 update check extension with xlnt function 2017-02-09 13:33:23 +01:00
sukoi26 4678048c21 check file extension workbook .xlsx 2017-02-07 22:49:02 +01:00
sukoi26 3fee3f0eb5 skip comment "shapeId" 2017-02-07 15:13:34 +01:00
sukoi26 d7486830a6 comment changes anchor() , in element() 2017-02-06 23:00:45 +01:00
sukoi26 26eacce248 font change for charset, outline shadow 2017-02-06 22:54:09 +01:00
Thomas Fussell 85a3f2d60a add a custom property to the condensed file 2017-02-03 19:40:39 -06:00
Thomas Fussell 89be3d83df instead of always writing at least one style, don't write cellStyleXfs and cellStyles at all when there are no styles defined 2017-02-03 19:40:13 -06:00
Thomas Fussell 101c36802e Merge commit '09d95616833bde0975bf391ebce9a94b63b14f32' 2017-02-03 19:29:13 -06:00
Thomas Fussell 5936b1e6af Merge commit 'b83dcd6a1f98965cb02750c21d15eb950a828c77' 2017-02-03 18:38:44 -06:00
sukoi26 09d9561683 update problem on char latest commit 2017-01-28 10:02:02 +01:00
sukoi26 078fab6953 problem char latest change 2017-01-28 00:15:18 +01:00
sukoi26 833d5e81ae problem char on latest change 2017-01-28 00:13:03 +01:00
sukoi26 a1cf2fefd2 update for style xfs
on file xl\styles.xml file find <cellStyleXfs count="0"/>
problem need count 1
2017-01-28 00:08:06 +01:00
sukoi26 b83dcd6a1f variant read, bool change take in account number(0,1) or text(false, true) 2017-01-27 23:48:27 +01:00
Thomas Fussell e14e595b6a document some things 2017-01-27 23:41:05 +01:00
Thomas Fussell 9907f5a8c8 re-enable round-trip tests, continue condensing test files 2017-01-27 23:41:05 +01:00
Thomas Fussell 82d5f623de document some things 2017-01-26 19:57:19 -05:00
Thomas Fussell 7a18c816b6 re-enable round-trip tests, continue condensing test files 2017-01-22 14:54:07 -05:00
alaw 9262576f27 custom-properties bool variant change i4 to bool 2017-01-22 19:34:40 +01:00
Thomas Fussell 0c100e166a fix up comments, hyperlinks, and formulae consumption tests 2017-01-21 19:12:26 -05:00
Thomas Fussell 1858752a13 Merge branch 'master' of github.com:tfussell/xlnt 2017-01-21 18:40:16 -05:00
Thomas Fussell 0def63d86f compile libstudxml as pic when building shared xlnt [ci skip] 2017-01-21 18:38:58 -05:00
Thomas Fussell e47baaf008 begin condensing test files, no reason to have so many [ci skip] 2017-01-21 11:35:47 -05:00
Thomas Fussell 7a991da9df Merge branch 'master' of http://github.com/tfussell/xlnt 2017-01-21 10:29:32 -05:00
Thomas Fussell 22c1f08b83 fix custom property pids 2017-01-21 10:29:23 -05:00
Thomas Fussell e4ec1a2850 use system packages for zlib, cryptopp, and cxxtest. WIP [ci skip] 2017-01-21 10:12:08 -05:00
Thomas Fussell a2bfdee2f2 intermediate commit 2017-01-21 09:04:10 -05:00
Thomas Fussell 1d34d966a8 clean up readme, move technical stuff to separate documentation website 2017-01-19 08:59:46 -05:00
Thomas Fussell 472dd85026 use slate instead of sphinx for documentation 2017-01-19 08:37:40 -05:00
Thomas Fussell 7e391d9ef2 update logo location 2017-01-16 20:46:30 -05:00
Thomas Fussell 72470c6371 hardcode enum serialization/deserialization, improve metadata property comsumption 2017-01-16 13:05:19 -05:00
Thomas Fussell 13321a6740 try non-previous vs in appveyor 2017-01-16 10:17:54 -05:00
Thomas Fussell 571c0103b5 continue work on workbook metadata properties 2017-01-15 19:08:57 -05:00
Thomas Fussell f18e9dbc09 begin work on handling properties correctly 2017-01-14 14:09:01 -05:00
Thomas Fussell 753597510d Merge branch 'master' of https://github.com/sukoi26/xlnt into sukoi26-master 2017-01-10 20:28:06 -05:00
Thomas Fussell 2991872778 clean up namespace handling in consumer and producer, improve stylesheet consumption 2017-01-10 20:25:59 -05:00
Thomas Fussell 3acd06b857 get relationship strings up to spec, closes #106 2017-01-10 20:25:11 -05:00
Thomas Fussell bef9effa12 shift relationship ids down by one after deleting one to maintain contiguity, fixes #104 2017-01-10 22:14:33 +01:00
Thomas Fussell a66c0d1f3e remove two more linux-specific overloads and fix the call that was requiring them 2017-01-10 22:14:33 +01:00
Thomas Fussell ce138d71cd bump dynamic library version to 0.9.3 (forgot to update it after 0.9.1) 2017-01-10 22:14:33 +01:00
Thomas Fussell 7100b64e45 remove long long overloads for cell::value, let's see if this breaks anything 2017-01-10 22:14:33 +01:00
Thomas Fussell bc91bccc3a rename zip to zstream in tests too 2017-01-10 22:14:33 +01:00
Thomas Fussell 90c7e929a9 clean up test xml_helper, rename zip to zstream 2017-01-10 22:14:33 +01:00
Thomas Fussell 44b11d342c shift relationship ids down by one after deleting one to maintain contiguity, fixes #104 2017-01-08 14:12:55 -05:00
Thomas Fussell e9c8116b0d remove two more linux-specific overloads and fix the call that was requiring them 2017-01-05 08:09:08 -05:00
Thomas Fussell 1047a35581 bump dynamic library version to 0.9.3 (forgot to update it after 0.9.1) 2017-01-05 07:47:52 -05:00
Thomas Fussell a0dea36605 remove long long overloads for cell::value, let's see if this breaks anything 2017-01-04 21:15:29 -05:00
Thomas Fussell cc5952ec19 rename zip to zstream in tests too 2017-01-04 21:14:37 -05:00
Thomas Fussell cc1a5e15f6 clean up test xml_helper, rename zip to zstream 2017-01-04 19:02:31 -05:00
sukoi26 32d3e7a61c Update xlsx_consumer.cpp 2017-01-04 18:53:45 +01:00
Thomas Fussell 45428c7f2b update copyright dates for 2017 2017-01-02 20:35:18 -05:00
Thomas Fussell c43561b4bd remove calcChain when no formulae remain in any cell, correct calcChain relationship type string, closes #98 2017-01-02 19:13:38 -05:00
Thomas Fussell 34304fd9c7 define worksheet::add_row_properties, closes #97 2017-01-02 18:36:33 -05:00
Thomas Fussell 186ec184e2 Merge branch 'master' of github.com:tfussell/xlnt 2017-01-02 18:32:17 -05:00
Thomas Fussell e4d18b5603 skip optional protection attributes if they're not present, closes #93 2017-01-02 18:32:10 -05:00
Thomas Fussell ffdf570907 remove incorrect link on static build 2017-01-02 18:19:24 -05:00
Thomas Fussell 8362913aa6 export workbook properties template specializations correctly 2017-01-02 18:09:51 -05:00
Thomas Fussell 78d67ec37d add test xlsx for custom properties consumption 2017-01-02 17:42:54 -05:00
Thomas Fussell afbab819c4 implement consumption of vt:lpwstr custom properties 2017-01-02 17:42:16 -05:00
Thomas Fussell 42c9233ad9 compile and link third-party amalgamation as a static lib instead of object files and fix clang warnings in cryptopp 2017-01-02 17:41:39 -05:00
Thomas Fussell 913507dda6 Merge branch 'master' of http://github.com/tfussell/xlnt 2017-01-02 14:47:31 -05:00
Thomas Fussell 5ea76c7292 remove rdrand since it calls some asm functions incorrectly 2017-01-02 14:47:22 -05:00
Thomas Fussell 2229c54427 specify g++ version 2017-01-02 14:03:48 -05:00
Thomas Fussell 3215e3a472 simplify travis build for now 2017-01-02 13:57:56 -05:00
Thomas Fussell 38cb446e3e remove cryptopp-object from static xlnt 2017-01-02 12:03:22 -05:00
Thomas Fussell ccd2a0eb1e finally figure out how to build cryptopp directly rather than as an external project, time to test on other platforms 2017-01-02 10:47:54 -05:00
436 changed files with 78433 additions and 20329 deletions

View File

@ -1,25 +1,36 @@
version: '{build}'
os: Previous Visual Studio 2015
version: "{build}"
os: Visual Studio 2015
cache:
- vcpkg -> .appveyor.yml
platform:
- x64
configuration:
- Debug
- Debug
environment:
matrix:
- STATIC: OFF
- STATIC: ON
- STATIC: OFF
- STATIC: ON
matrix:
fast_finish: true
init: []
install: []
before_build:
- git submodule update --init
- cmake -H. -Bbuild -G"Visual Studio 14 2015 Win64" -DSTATIC=%STATIC% -DSAMPLES=ON -DBENCHMARKS=ON
- git submodule update --init --recursive
- mkdir build
- cd build
- cmake -G "Visual Studio 14 2015" -D CMAKE_GENERATOR_PLATFORM=%platform% -D STATIC=%STATIC% -D SAMPLES=ON -D BENCHMARKS=ON -D TESTS=ON ..
build:
project: build/tests/xlnt.test.sln
project: build/xlnt_all.sln
parallel: true
verbosity: minimal
test_script:
- cd build/bin
- xlnt.test.exe
- tests\%configuration%\xlnt.test.exe
- samples\%configuration%\sample-documentation.exe

79
.circleci/config.yml Normal file
View File

@ -0,0 +1,79 @@
version: 2.1
jobs:
build:
docker:
- image: lycantropos/cmake:3.9.5
parameters:
benchmarks:
default: "OFF"
type: string
build-type:
default: Release
type: string
coverage:
default: "OFF"
type: string
cxx-ver:
default: "11"
type: string
samples:
default: "OFF"
type: string
static:
default: "ON"
type: string
steps:
- checkout
- run: git submodule update --init --recursive
- run: cmake -D XLNT_CXX_LANG=<< parameters.cxx-ver >> -D STATIC=<< parameters.static >> -D BENCHMARKS=<< parameters.benchmarks >> -D TESTS=ON -D SAMPLES=<< parameters.samples >> -D COVERAGE=<< parameters.coverage >> -D CMAKE_BUILD_TYPE=<< parameters.build-type >> .
- run: cmake --build . -- -j2
- run: ./tests/xlnt.test
- when:
condition:
equal: ["ON", << parameters.samples >>]
steps:
- run: ./samples/sample-decrypt
- run: ./samples/sample-img2xlsx ./samples/data/penguin.jpg img.xlsx
- run: ./samples/sample-documentation
- when:
condition:
equal: ["ON", << parameters.benchmarks >>]
steps:
- run: ./benchmarks/benchmark-styles
- run: ./benchmarks/benchmark-writer
- when:
condition:
equal: ["ON", << parameters.coverage >>]
steps:
- run: lcov --directory source/CMakeFiles/xlnt.dir --capture --output-file coverage.info --base-directory ../source --no-external --gcov-tool /usr/bin/gcov-6
- run: lcov --output-file coverage.info --remove coverage.info source/detail/serialization/miniz.cpp
- run: i=$(dirname $(pwd))
- run: sed -i "s|$i/||" coverage.info
- run: cd ..
- run: coveralls-lcov build/coverage.info
workflows:
build:
jobs:
- build:
name: tests
matrix:
parameters:
cxx-ver:
- "11"
- "17"
build-type:
- Release
- Debug
static:
- "ON"
- "OFF"
- build:
name: samples-benchmarks-coverage
cxx-ver: "11"
build-type: Debug
static: "ON"
samples: "ON"
benchmarks: "ON"
coverage: "OFF"

17
.gitignore vendored
View File

@ -1,8 +1,7 @@
bin/
lib/
build/
docs/_*/
docs/build/
docs/doxyxml/
node_modules/
*.obj
*.sdf
*.suo
@ -12,3 +11,15 @@ docs/doxyxml/
#*#
*~
.DS_Store
__pycache__/
Win32/
*.pyd
python/record.txt
python/xlntpyarrow.egg-info/
/x64/
.envrc
.vscode
/dist/
/.vs/
/out/
/CMakeSettings.json

33
.gitmodules vendored
View File

@ -1,32 +1,3 @@
[submodule "third-party/libstudxml"]
path = third-party/libstudxml
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
path = third-party/libstudxml
url = https://git.codesynthesis.com/libstudxml/libstudxml.git

24
.release-it.json Normal file
View File

@ -0,0 +1,24 @@
{
"git": {
"commitMessage": "release v${version}",
"requireBranch": "master",
"requireCommits": true,
"tagAnnotation": "release v${version}",
"tagName": "v${version}"
},
"github": {
"release": true,
"releaseName": "xlnt v${version}"
},
"npm": {
"publish": false
},
"plugins": {
"@release-it/bumper": {
"out": {
"file": "source/CMakeLists.txt",
"type": "text/plain"
}
}
}
}

View File

@ -1,55 +0,0 @@
# from: https://github.com/nlohmann/json/blob/master/.travis.yml
language: cpp
sudo: required
dist: trusty
notifications:
email: false
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
- python-pip
before_script:
- pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
env:
- COMPILER=g++-4.9
- COVERAGE=ON
- STATIC=ON
- SAMPLES=OFF
- BENCHMARKS=OFF
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- valgrind
env:
- COMPILER=g++-5
- COVERAGE=OFF
- STATIC=OFF
- SAMPLES=ON
- BENCHMARKS=ON
script:
- mkdir build
- cd build
- cmake -D STATIC=$STATIC -D BENCHMARKS=$BENCHMARKS -D SAMPLES=$SAMPLES -D COVERAGE=$COVERAGE -D CMAKE_CXX_COMPILER=$COMPILER -D CMAKE_BUILD_TYPE=Debug ..
- cmake --build .
- cd bin && ./xlnt.test
- cd ..
- find source/CMakeFiles/xlnt.dir
- if [ "$COMPILER" = "g++4.9" ]; then coveralls --root source/CMakeFiles/xlnt.dir --verbose -x ".cpp" --gcov-options '\-p' ; fi

View File

@ -4,7 +4,10 @@ It was initially inspired by the openpyxl library: https://openpyxl.readthedocs.
Thanks to everyone who has contributed to this project (in alphabetical order):
* adam-nielsen
* Malvineous
* sukoi26
* tpmccallum
* xpol
Project logo designed by Thomas Fussell.

4
CHANGELOG.md Normal file
View File

@ -0,0 +1,4 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
Every release is documented on the Github [Releases](https://github.com/tfussell/xlnt/releases) page.

View File

@ -1,37 +1,59 @@
cmake_minimum_required(VERSION 3.1)
set(LIBRARY_NAME xlnt)
project(${LIBRARY_NAME}_all VERSION ${LIBRARY_VERSION} LANGUAGES CXX C)
project(xlnt_all)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
# CTest setup
# include (CTest) # Add this for valgrind support; CTest works without it
enable_testing()
# 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)
option(STATIC "Set to ON to build xlnt as a static library instead of a shared library" OFF)
# c++ language standard to use
set(XLNT_VALID_LANGS 11 14 17)
set(XLNT_CXX_LANG "14" CACHE STRING "c++ language features to compile with")
# enumerate allowed values for cmake gui
set_property(CACHE XLNT_CXX_LANG PROPERTY STRINGS ${XLNT_VALID_LANGS})
# validate value is in XLNT_VALID_LANGS
list(FIND XLNT_VALID_LANGS ${XLNT_CXX_LANG} index)
if(index EQUAL -1)
message(FATAL_ERROR "XLNT_CXX_LANG must be one of ${XLNT_VALID_LANGS}")
endif()
# Optional components
option(TESTS "Set to ON to build test executable (in ./tests)" OFF)
option(SAMPLES "Set to ON to build executable code samples (in ./samples)" OFF)
option(BENCHMARKS "Set to ON to build performance benchmarks (in ./benchmarks)" OFF)
option(PYTHON "Set to ON to build Arrow conversion functions (in ./python)" OFF)
# Platform specific options
if(NOT MSVC)
option(COVERAGE "Generate coverage data using gcov" OFF)
if(MSVC)
option(STATIC_CRT "Link with the static version of MSVCRT (/MD[d])" OFF)
else()
option(COVERAGE "Generate coverage data using gcov" OFF)
endif()
# Add components according to selected options
if(SAMPLES)
add_subdirectory(samples)
add_subdirectory(samples)
endif()
if(BENCHMARKS)
add_subdirectory(benchmarks)
add_subdirectory(benchmarks)
endif()
find_package(PythonInterp)
if(TESTS)
add_subdirectory(tests)
endif()
if(PYTHONINTERP_FOUND)
add_subdirectory(tests)
else()
message("Python couldn't be found in the current PATH but is required for building tests. Tests will be skipped for now.")
if(PYTHON)
add_subdirectory(python)
endif()
add_subdirectory(source)

46
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at thomas.fussell@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,7 +1,10 @@
This software is distributed under the MIT Licence
==================================================
# License
Copyright (c) 2014-2015 Thomas Fussell
## [xlnt](https://github.com/tfussell/xlnt)
>[MIT License](https://github.com/tfussell/xlnt/blob/master/LICENSE.md)
```
Copyright (c) 2014-2018 Thomas Fussell
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
@ -21,14 +24,43 @@ 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.
```
# Dependency Licences
Third-party licenses
====================
## [utfcpp](https://github.com/nemtrif/utfcpp)
>[Boost Software License - Version 1.0](https://github.com/nemtrif/utfcpp/blob/master/source/utf8.h)
Pole is distributed under the BSD 2-Clause License
==================================================
```
Copyright 2006 Nemanja Trifunovic
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.
```
## [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.
@ -52,37 +84,12 @@ 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.
```
## [libstudxml](http://www.codesynthesis.com/projects/libstudxml/)
>[MIT License](http://www.codesynthesis.com/licenses/mit.txt)
Crypto++ is distributed under the Boost Software License - Version 1.0
======================================================================
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 is distributed under the MIT License
===============================================
```
Summary: Everything is licensed under the MIT License (text below).
Code found in the xml/details/expat/ directory is distributed under
@ -114,91 +121,210 @@ 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.
```
## [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)
pugixml is distributed under the MIT License
============================================
```
Copyright 2010 Disney Enterprises, Inc. All rights reserved
Copyright (c) 2006-2016 Arseny Kapoulkine
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
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:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
* 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.
```
## [miniz](https://github.com/richgel999/miniz)
>[Public Domain/MIT License](https://github.com/richgel999/miniz/blob/master/LICENSE)
```
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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
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 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.
For more information, please refer to <http://unlicense.org/>
zlib is distributed under the zlib license
==========================================
Copyright 2013-2014 RAD Game Tools and Valve Software
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
All Rights Reserved.
(C) 1995-2013 Jean-loup Gailly and Mark Adler
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:
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
utfcpp is distributed under the Boost Software License - Version 1.0
====================================================================
Copyright 2006 Nemanja Trifunovic
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 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, 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.
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.
```
CxxTest is distributed under the LGPL License
=============================================
## [SHA-512 hash in C](https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly)
>[MIT License](https://www.nayuki.io/res/fast-sha2-hashes-in-x86-assembly/sha512.c)
```
Copyright (c) 2016 Project Nayuki
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.
```
## [SHA-1 hash in C](https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly)
>[MIT License](https://www.nayuki.io/res/fast-sha1-hash-implementation-in-x86-assembly/sha1-fast.c)
```
Copyright (c) 2014 Project Nayuki
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.
```
## [LibTomCrypt](http://www.libtom.net/)
>[Public Domain](https://github.com/libtom/libtomcrypt/blob/develop/LICENSE)
```
LibTomCrypt is public domain. As should all quality software be.
Tom St Denis
```
# Dependency Licences (Python Module)
## [pybind11](https://github.com/pybind/pybind11)
>[BSD 3-Clause License](https://github.com/pybind/pybind11/blob/master/LICENSE)
```
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, 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.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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 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.
You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to the author of this software, without
imposing a separate written license agreement for such Enhancements, then you
hereby grant the following license: a non-exclusive, royalty-free perpetual
license to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.
```
# Dependency Licences (Testing Only)
## [CxxTest](http://cxxtest.com/)
>[LGPL License](https://github.com/CxxTest/cxxtest/blob/master/COPYING)
```
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
@ -364,39 +490,4 @@ 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 is distributed under the BSD 3-Clause License (with specific non-attribution clause)
===========================================================================================
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

@ -1,24 +1,24 @@
<img height="100" src="https://raw.githubusercontent.com/tfussell/xlnt/gh-pages/images/xlnt.png" alt="xlnt"><br/>
<img height="100" src="https://user-images.githubusercontent.com/1735211/29433390-f37fa28e-836c-11e7-8a60-f8df4c30b424.png" alt="xlnt logo"><br/>
====
[![Travis Build Status](https://travis-ci.org/tfussell/xlnt.svg)](https://travis-ci.org/tfussell/xlnt)
[![Travis Build Status](https://travis-ci.org/tfussell/xlnt.svg?branch=master)](https://travis-ci.org/tfussell/xlnt)
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/2hs79a1xoxy16sol?svg=true)](https://ci.appveyor.com/project/tfussell/xlnt)
[![Coverage Status](https://coveralls.io/repos/github/tfussell/xlnt/badge.svg?branch=master)](https://coveralls.io/github/tfussell/xlnt?branch=master)
[![ReadTheDocs Documentation Status](https://readthedocs.org/projects/xlnt/badge/?version=latest)](http://xlnt.readthedocs.org/en/latest/?badge=latest)
[![Documentation Status](https://legacy.gitbook.com/button/status/book/tfussell/xlnt)](https://tfussell.gitbooks.io/xlnt/content/)
[![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). The first public release of xlnt version 1.0 was on May 10th, 2017. Current work is focused on increasing compatibility, improving performance, and brainstorming future development goals. For a high-level summary of what you can do with this library, see [the feature list](https://tfussell.gitbooks.io/xlnt/content/docs/introduction/Features.html). Contributions are welcome in the form of pull requests or discussions on [the repository's Issues page](https://github.com/tfussell/xlnt/issues).
## 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,53 +27,26 @@ 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
```
## Documentation
More detailed documentation with examples can be found on [Read The Docs](http://xlnt.readthedocs.org/en/latest/) (Warning: As of November 9, 2016 this is very out of date).
Documentation for the current release of xlnt is available [here](https://tfussell.gitbooks.io/xlnt/content/).
## Building xlnt - Using vcpkg
You can download and install xlnt using the [vcpkg](https://github.com/microsoft/vcpkg) dependency manager:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install xlnt
The xlnt port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/microsoft/vcpkg) on the vcpkg repository.
## 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.
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/LICENSE.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/LICENSE.md) should be distributed alongside any assemblies that use xlnt in source or compiled form.

1
SUMMARY.md Symbolic link
View File

@ -0,0 +1 @@
docs/README.md

View File

@ -1,29 +1,48 @@
cmake_minimum_required(VERSION 3.1)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common.cmake)
project(${LIBRARY_NAME}.benchmarks VERSION ${LIBRARY_VERSION} LANGUAGES CXX)
project(xlnt.benchmarks)
# Require C++11 compiler
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT COMBINED_PROJECT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source)
# Include xlnt library
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source)
endif()
include_directories(${LIBRARY_INCLUDE_DIR})
file(GLOB SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
if(NOT MSVC)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(STATIC_CRT)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ucm.cmake)
ucm_set_runtime(STATIC)
endif()
foreach(SAMPLE_SOURCE IN ITEMS ${SAMPLE_SOURCES})
get_filename_component(SAMPLE_NAME ${SAMPLE_SOURCE} NAME_WE)
set(SAMPLE_EXECUTABLE benchmark-${SAMPLE_NAME})
add_executable(${SAMPLE_EXECUTABLE} ${SAMPLE_SOURCE})
target_link_libraries(${SAMPLE_EXECUTABLE} ${LIBRARY_NAME})
if(NOT MSVC)
target_link_libraries(${SAMPLE_EXECUTABLE} Threads::Threads)
endif()
set(XLNT_BENCHMARK_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
file(GLOB BENCHMARK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(BENCHMARK_SOURCE IN ITEMS ${BENCHMARK_SOURCES})
# Convert <name>.cpp to benchmark-<name>
get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE)
set(BENCHMARK_EXECUTABLE benchmark-${BENCHMARK_NAME})
add_executable(${BENCHMARK_EXECUTABLE} ${BENCHMARK_SOURCE})
target_link_libraries(${BENCHMARK_EXECUTABLE} PRIVATE xlnt)
# Need to use some test helpers
target_include_directories(${BENCHMARK_EXECUTABLE}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tests)
target_compile_definitions(${BENCHMARK_EXECUTABLE}
PRIVATE XLNT_BENCHMARK_DATA_DIR=${XLNT_BENCHMARK_DATA_DIR})
if(MSVC AND NOT STATIC)
# Copy xlnt DLL into benchmarks directory
add_custom_command(TARGET ${BENCHMARK_EXECUTABLE} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:xlnt>
$<TARGET_FILE_DIR:${BENCHMARK_EXECUTABLE}>)
endif()
endforeach()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data
DESTINATION ${CMAKE_BINARY_DIR}/bin)
option(XLNT_MICROBENCH_ENABLED "Enable small benchmarks typically used for development" OFF)
if (XLNT_MICROBENCH_ENABLED)
add_subdirectory(microbenchmarks)
endif()

View File

@ -0,0 +1,36 @@
# FetchContent added in cmake v3.11
# https://cmake.org/cmake/help/v3.11/module/FetchContent.html
# this file is behind a feature flag (XLNT_MICROBENCH_ENABLED) so the primary build is not affected
cmake_minimum_required(VERSION 3.11)
project(xlnt_ubench)
# acquire google benchmark dependency
# disable generation of the various test projects
set(BENCHMARK_ENABLE_TESTING OFF)
# gtest not required
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
include(FetchContent)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark
GIT_TAG v1.5.0
)
# download if not already present
FetchContent_GetProperties(googlebenchmark)
if(NOT googlebenchmark_POPULATED)
FetchContent_Populate(googlebenchmark)
add_subdirectory(${googlebenchmark_SOURCE_DIR} ${googlebenchmark_BINARY_DIR})
endif()
# equivalent of add_subdirectory, now available for use
FetchContent_MakeAvailable(googlebenchmark)
add_executable(xlnt_ubench)
target_sources(xlnt_ubench
PRIVATE
string_to_double.cpp
double_to_string.cpp
)
target_link_libraries(xlnt_ubench benchmark_main xlnt)
target_compile_features(xlnt_ubench PRIVATE cxx_std_17)

View File

@ -0,0 +1,207 @@
// A core part of the xlsx serialisation routine is taking doubles from memory and stringifying them
// this has a few requirements
// - expect strings in the form 1234.56 (i.e. no thousands seperator, '.' used for the decimal seperator)
// - outputs up to 15 significant figures (excel only serialises numbers up to 15sf)
#include "benchmark/benchmark.h"
#include <locale>
#include <random>
#include <sstream>
namespace {
// setup a large quantity of random doubles as strings
template <bool Decimal_Locale = true>
class RandomFloats : public benchmark::Fixture
{
static constexpr size_t Number_of_Elements = 1 << 20;
static_assert(Number_of_Elements > 1'000'000, "ensure a decent set of random values is generated");
std::vector<double> inputs;
size_t index = 0;
const char *locale_str = nullptr;
public:
void SetUp(const ::benchmark::State &state)
{
if (Decimal_Locale)
{
locale_str = setlocale(LC_ALL, "C");
}
else
{
locale_str = setlocale(LC_ALL, "de-DE");
}
std::random_device rd; // obtain a seed for the random number engine
std::mt19937 gen(rd());
// doing full range is stupid (<double>::min/max()...), it just ends up generating very large numbers
// uniform is probably not the best distribution to use here, but it will do for now
std::uniform_real_distribution<double> dis(-1'000, 1'000);
// generate a large quantity of doubles to deserialise
inputs.reserve(Number_of_Elements);
for (int i = 0; i < Number_of_Elements; ++i)
{
double d = dis(gen);
inputs.push_back(d);
}
}
void TearDown(const ::benchmark::State &state)
{
// restore locale
setlocale(LC_ALL, locale_str);
// gbench is keeping the fixtures alive somewhere, need to clear the data after use
inputs = std::vector<double>{};
}
double &get_rand()
{
return inputs[++index & (Number_of_Elements - 1)];
}
};
/// Takes in a double and outputs a string form of that number which will
/// serialise and deserialise without loss of precision
std::string serialize_number_to_string(double num)
{
// more digits and excel won't match
constexpr int Excel_Digit_Precision = 15; //sf
std::stringstream ss;
ss.precision(Excel_Digit_Precision);
ss << num;
return ss.str();
}
class number_serialiser
{
static constexpr int Excel_Digit_Precision = 15; //sf
std::ostringstream ss;
public:
explicit number_serialiser()
{
ss.precision(Excel_Digit_Precision);
ss.imbue(std::locale("C"));
}
std::string serialise(double d)
{
ss.str(""); // reset string buffer
ss.clear(); // reset any error flags
ss << d;
return ss.str();
}
};
class number_serialiser_mk2
{
static constexpr int Excel_Digit_Precision = 15; //sf
bool should_convert_comma;
void convert_comma(char *buf, int len)
{
char *buf_end = buf + len;
char *decimal = std::find(buf, buf_end, ',');
if (decimal != buf_end)
{
*decimal = '.';
}
}
public:
explicit number_serialiser_mk2()
: should_convert_comma(std::use_facet<std::numpunct<char>>(std::locale{}).decimal_point() == ',')
{
}
std::string serialise(double d)
{
char buf[Excel_Digit_Precision + 1]; // need space for trailing '\0'
int len = snprintf(buf, sizeof(buf), "%.15g", d);
if (should_convert_comma)
{
convert_comma(buf, len);
}
return std::string(buf, len);
}
};
using RandFloats = RandomFloats<true>;
using RandFloatsComma = RandomFloats<false>;
} // namespace
BENCHMARK_F(RandFloats, string_from_double_sstream)
(benchmark::State &state)
{
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
serialize_number_to_string(get_rand()));
}
}
BENCHMARK_F(RandFloats, string_from_double_sstream_cached)
(benchmark::State &state)
{
number_serialiser ser;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
ser.serialise(get_rand()));
}
}
BENCHMARK_F(RandFloats, string_from_double_snprintf)
(benchmark::State &state)
{
while (state.KeepRunning())
{
char buf[16];
int len = snprintf(buf, sizeof(buf), "%.15g", get_rand());
benchmark::DoNotOptimize(
std::string(buf, len));
}
}
BENCHMARK_F(RandFloats, string_from_double_snprintf_fixed)
(benchmark::State &state)
{
number_serialiser_mk2 ser;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
ser.serialise(get_rand()));
}
}
// locale names are different between OS's, and std::from_chars is only complete in MSVC
#ifdef _MSC_VER
#include <charconv>
BENCHMARK_F(RandFloats, string_from_double_std_to_chars)
(benchmark::State &state)
{
while (state.KeepRunning())
{
char buf[16];
std::to_chars_result result = std::to_chars(buf, buf + std::size(buf), get_rand());
benchmark::DoNotOptimize(
std::string(buf, result.ptr));
}
}
BENCHMARK_F(RandFloatsComma, string_from_double_snprintf_fixed_comma)
(benchmark::State &state)
{
number_serialiser_mk2 ser;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
ser.serialise(get_rand()));
}
}
#endif

View File

@ -0,0 +1,223 @@
// A core part of the xlsx parsing routine is taking strings from the xml parser and parsing these to a double
// this has a few requirements
// - expect strings in the form 1234.56 (i.e. no thousands seperator, '.' used for the decimal seperator)
// - handles atleast 15 significant figures (excel only serialises numbers up to 15sf)
#include <benchmark/benchmark.h>
#include <locale>
#include <random>
#include <sstream>
namespace {
// setup a large quantity of random doubles as strings
template <bool Decimal_Locale = true>
class RandomFloatStrs : public benchmark::Fixture
{
static constexpr size_t Number_of_Elements = 1 << 20;
static_assert(Number_of_Elements > 1'000'000, "ensure a decent set of random values is generated");
std::vector<std::string> inputs;
size_t index = 0;
const char *locale_str = nullptr;
public:
void SetUp(const ::benchmark::State &state)
{
if (Decimal_Locale)
{
locale_str = setlocale(LC_ALL, "C");
}
else
{
locale_str = setlocale(LC_ALL, "de-DE");
}
std::random_device rd; // obtain a seed for the random number engine
std::mt19937 gen(rd());
// doing full range is stupid (<double>::min/max()...), it just ends up generating very large numbers
// uniform is probably not the best distribution to use here, but it will do for now
std::uniform_real_distribution<double> dis(-1'000, 1'000);
// generate a large quantity of doubles to deserialise
inputs.reserve(Number_of_Elements);
for (int i = 0; i < Number_of_Elements; ++i)
{
double d = dis(gen);
char buf[16];
snprintf(buf, 16, "%.15f", d);
inputs.push_back(std::string(buf));
}
}
void TearDown(const ::benchmark::State &state)
{
// restore locale
setlocale(LC_ALL, locale_str);
// gbench is keeping the fixtures alive somewhere, need to clear the data after use
inputs = std::vector<std::string>{};
}
std::string &get_rand()
{
return inputs[++index & (Number_of_Elements - 1)];
}
};
// method used by xlsx_consumer.cpp in commit - ba01de47a7d430764c20ec9ac9600eec0eb38bcf
// std::istringstream with the locale set to "C"
struct number_converter
{
number_converter()
{
stream.imbue(std::locale("C"));
}
double stold(const std::string &s)
{
stream.str(s);
stream.clear();
stream >> result;
return result;
}
std::istringstream stream;
double result;
};
// to resolve the locale issue with strtod, a little preprocessing of the input is required
struct number_converter_mk2
{
explicit number_converter_mk2()
: should_convert_to_comma(std::use_facet<std::numpunct<char>>(std::locale{}).decimal_point() == ',')
{
}
double stold(std::string &s) const noexcept
{
assert(!s.empty());
if (should_convert_to_comma)
{
auto decimal_pt = std::find(s.begin(), s.end(), '.');
if (decimal_pt != s.end())
{
*decimal_pt = ',';
}
}
return strtod(s.c_str(), nullptr);
}
double stold(const std::string &s) const
{
assert(!s.empty());
if (!should_convert_to_comma)
{
return strtod(s.c_str(), nullptr);
}
std::string copy(s);
auto decimal_pt = std::find(copy.begin(), copy.end(), '.');
if (decimal_pt != copy.end())
{
*decimal_pt = ',';
}
return strtod(copy.c_str(), nullptr);
}
private:
bool should_convert_to_comma = false;
};
using RandFloatStrs = RandomFloatStrs<true>;
// german locale uses ',' as the seperator
using RandFloatCommaStrs = RandomFloatStrs<false>;
} // namespace
BENCHMARK_F(RandFloatStrs, double_from_string_sstream)
(benchmark::State &state)
{
number_converter converter;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
converter.stold(get_rand()));
}
}
// using strotod
// https://en.cppreference.com/w/cpp/string/byte/strtof
// this naive usage is broken in the face of locales (fails condition 1)
#include <cstdlib>
BENCHMARK_F(RandFloatStrs, double_from_string_strtod)
(benchmark::State &state)
{
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
strtod(get_rand().c_str(), nullptr));
}
}
BENCHMARK_F(RandFloatStrs, double_from_string_strtod_fixed)
(benchmark::State &state)
{
number_converter_mk2 converter;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
converter.stold(get_rand()));
}
}
BENCHMARK_F(RandFloatStrs, double_from_string_strtod_fixed_const_ref)
(benchmark::State &state)
{
number_converter_mk2 converter;
while (state.KeepRunning())
{
const std::string &inp = get_rand();
benchmark::DoNotOptimize(
converter.stold(inp));
}
}
// locale names are different between OS's, and std::from_chars is only complete in MSVC
#ifdef _MSC_VER
#include <charconv>
BENCHMARK_F(RandFloatStrs, double_from_string_std_from_chars)
(benchmark::State &state)
{
while (state.KeepRunning())
{
const std::string &input = get_rand();
double output;
benchmark::DoNotOptimize(
std::from_chars(input.data(), input.data() + input.size(), output));
}
}
// not using the standard "C" locale with '.' seperator
BENCHMARK_F(RandFloatCommaStrs, double_from_string_strtod_fixed_comma_ref)
(benchmark::State &state)
{
number_converter_mk2 converter;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(
converter.stold(get_rand()));
}
}
BENCHMARK_F(RandFloatCommaStrs, double_from_string_strtod_fixed_comma_const_ref)
(benchmark::State &state)
{
number_converter_mk2 converter;
while (state.KeepRunning())
{
const std::string &inp = get_rand();
benchmark::DoNotOptimize(
converter.stold(inp));
}
}
#endif

View File

@ -0,0 +1,58 @@
#include <xlnt/xlnt.hpp>
#include <chrono>
#include <helpers/path_helper.hpp>
namespace {
using milliseconds_d = std::chrono::duration<double, std::milli>;
void run_load_test(const xlnt::path &file, int runs = 10)
{
std::cout << file.string() << "\n\n";
xlnt::workbook wb;
std::vector<std::chrono::steady_clock::duration> test_timings;
for (int i = 0; i < runs; ++i)
{
auto start = std::chrono::steady_clock::now();
wb.load(file);
auto end = std::chrono::steady_clock::now();
wb.clear();
test_timings.push_back(end - start);
std::cout << milliseconds_d(test_timings.back()).count() << " ms\n";
}
}
void run_save_test(const xlnt::path &file, int runs = 10)
{
std::cout << file.string() << "\n\n";
xlnt::workbook wb;
wb.load(file);
const xlnt::path save_path(file.filename());
std::vector<std::chrono::steady_clock::duration> test_timings;
for (int i = 0; i < runs; ++i)
{
auto start = std::chrono::steady_clock::now();
wb.save(save_path);
auto end = std::chrono::steady_clock::now();
test_timings.push_back(end - start);
std::cout << milliseconds_d(test_timings.back()).count() << " ms\n";
}
}
} // namespace
int main()
{
run_load_test(path_helper::benchmark_file("large.xlsx"));
run_load_test(path_helper::benchmark_file("very_large.xlsx"));
run_save_test(path_helper::benchmark_file("large.xlsx"));
run_save_test(path_helper::benchmark_file("very_large.xlsx"));
}

View File

@ -1,108 +1,250 @@
// Copyright (c) 2017-2018 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <chrono>
#include <string>
#include <iostream>
#include <sstream>
#include <iterator>
#include <random>
#include <helpers/timing.hpp>
#include <xlnt/xlnt.hpp>
std::size_t current_time()
{
return std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
}
namespace {
std::size_t random_index(std::size_t max)
{
static std::random_device rd;
static std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, max - 1);
std::uniform_int_distribution<> dis(0, static_cast<int>(max - 1));
return dis(gen);
}
std::vector<xlnt::style> generate_all_styles(xlnt::workbook &wb)
void generate_all_formats(xlnt::workbook &wb, std::vector<xlnt::format>& formats)
{
std::vector<xlnt::style> styles;
const auto vertical_alignments = std::vector<xlnt::vertical_alignment>
{
xlnt::vertical_alignment::center,
xlnt::vertical_alignment::justify,
xlnt::vertical_alignment::top,
xlnt::vertical_alignment::bottom
};
std::vector<xlnt::vertical_alignment> vertical_alignments = {xlnt::vertical_alignment::center, xlnt::vertical_alignment::justify, xlnt::vertical_alignment::top, xlnt::vertical_alignment::bottom};
std::vector<xlnt::horizontal_alignment> horizontal_alignments = {xlnt::horizontal_alignment::center, xlnt::horizontal_alignment::center_continuous, xlnt::horizontal_alignment::general, xlnt::horizontal_alignment::justify, xlnt::horizontal_alignment::left, xlnt::horizontal_alignment::right};
std::vector<std::string> font_names = {"Calibri", "Tahoma", "Arial", "Times New Roman"};
std::vector<int> font_sizes = {11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35};
std::vector<bool> bold_options = {true, false};
std::vector<xlnt::font::underline_style> underline_options = {xlnt::font::underline_style::single, xlnt::font::underline_style::none};
std::vector<bool> italic_options = {true, false};
std::size_t index = 0;
for(auto vertical_alignment : vertical_alignments)
{
for(auto horizontal_alignment : horizontal_alignments)
{
for(auto name : font_names)
{
for(auto size : font_sizes)
{
for(auto bold : bold_options)
{
for(auto underline : underline_options)
{
for(auto italic : italic_options)
{
auto s = wb.create_style(std::to_string(index++));
const auto horizontal_alignments = std::vector<xlnt::horizontal_alignment>
{
xlnt::horizontal_alignment::center,
xlnt::horizontal_alignment::center_continuous,
xlnt::horizontal_alignment::general,
xlnt::horizontal_alignment::justify,
xlnt::horizontal_alignment::left,
xlnt::horizontal_alignment::right
};
xlnt::font f;
f.name(name);
f.size(size);
f.italic(italic);
f.underline(underline);
f.bold(bold);
s.font(f);
const auto font_names = std::vector<std::string>
{
"Calibri",
"Tahoma",
"Arial",
"Times New Roman"
};
xlnt::alignment a;
a.vertical(vertical_alignment);
a.horizontal(horizontal_alignment);
s.alignment(a);
const auto font_sizes = std::vector<double>
{
11.,
13.,
15.,
17.,
19.,
21.,
23.,
25.,
27.,
29.,
31.,
33.,
35.
};
styles.push_back(s);
}
}
}
}
}
}
}
const auto underline_options = std::vector<xlnt::font::underline_style>
{
xlnt::font::underline_style::single,
xlnt::font::underline_style::none
};
return styles;
for (auto vertical_alignment : vertical_alignments)
{
for (auto horizontal_alignment : horizontal_alignments)
{
for (auto name : font_names)
{
for (auto size : font_sizes)
{
for (auto bold : { true, false })
{
for (auto underline : underline_options)
{
for (auto italic : { true, false })
{
auto fmt = wb.create_format();
xlnt::font f;
f.name(name);
f.size(size);
f.italic(italic);
f.underline(underline);
f.bold(bold);
fmt.font(f);
xlnt::alignment a;
a.vertical(vertical_alignment);
a.horizontal(horizontal_alignment);
fmt.alignment(a);
formats.push_back(fmt);
}
}
}
}
}
}
}
}
xlnt::workbook non_optimized_workbook(int n)
xlnt::workbook non_optimized_workbook_formats(int rows_number, int columns_number)
{
xlnt::workbook wb;
auto styles = generate_all_styles(wb);
using xlnt::benchmarks::current_time;
for(int idx = 1; idx < n; idx++)
{
auto worksheet = wb[random_index(wb.sheet_count())];
auto cell = worksheet.cell(1, (xlnt::row_t)idx);
cell.value(0);
cell.style(styles.at(random_index(styles.size())));
}
xlnt::workbook wb;
std::vector<xlnt::format> formats;
auto start = current_time();
return wb;
generate_all_formats(wb, formats);
auto elapsed = current_time() - start;
std::cout << "elapsed " << elapsed / 1000.0 << ". generate_all_formats. number of unique formats " << formats.size() << std::endl;
start = current_time();
auto worksheet = wb[random_index(wb.sheet_count())];
auto cells_proceeded = 0;
for (int row_idx = 1; row_idx <= rows_number; row_idx++)
{
for (int col_idx = 1; col_idx <= columns_number; col_idx++)
{
auto cell = worksheet.cell(xlnt::cell_reference((xlnt::column_t)col_idx, (xlnt::row_t)row_idx));
std::ostringstream string_stm;
string_stm << "Col: " << col_idx << "Row: " << row_idx;
cell.value(string_stm.str());
cell.format(formats.at(random_index(formats.size())));
cells_proceeded++;
}
}
elapsed = current_time() - start;
std::cout << "elapsed " << elapsed / 1000.0 << ". set values and formats for cells. cells proceeded " << cells_proceeded << std::endl;
return wb;
}
void to_profile(xlnt::workbook &wb, const std::string &f, int n)
void to_save_profile(xlnt::workbook &wb, const std::string &f)
{
using xlnt::benchmarks::current_time;
auto start = current_time();
wb.save(f);
auto elapsed = current_time() - start;
std::cout << "took " << elapsed / 1000.0 << "s for " << n << " styles" << std::endl;
std::cout << "elapsed " << elapsed / 1000.0 << ". save workbook." << std::endl;
}
int main()
void to_load_profile(xlnt::workbook &wb, const std::string &f)
{
int n = 10000;
auto wb = non_optimized_workbook(n);
std::string f = "temp.xlsx";
to_profile(wb, f, n);
using xlnt::benchmarks::current_time;
auto start = current_time();
wb.load(f);
auto elapsed = current_time() - start;
std::cout << "elapsed " << elapsed / 1000.0 << ". load workbook." << std::endl;
}
void read_formats_profile(xlnt::workbook &wb, int rows_number, int columns_number)
{
using xlnt::benchmarks::current_time;
std::vector<std::string> values;
std::vector<xlnt::format> formats;
auto start = current_time();
auto worksheet = wb[random_index(wb.sheet_count())];
for (int row_idx = 1; row_idx <= rows_number; row_idx++)
{
for (int col_idx = 1; col_idx <= columns_number; col_idx++)
{
auto cell = worksheet.cell(xlnt::cell_reference((xlnt::column_t)col_idx, (xlnt::row_t)row_idx));
values.push_back(cell.value<std::string>());
formats.push_back(cell.format());
}
}
auto elapsed = current_time() - start;
std::cout << "elapsed " << elapsed / 1000.0 << ". read values and formats for cells. values count " << values.size()
<< ". formats count " << formats.size() << std::endl;
}
} // namespace
int main(int argc, char * argv[])
{
int rows_number = 1000;
int columns_number = 10;
try
{
if (argc > 1)
rows_number = std::stoi(argv[1]);
if (argc > 2)
columns_number = std::stoi(argv[2]);
std::cout << "started. number of rows " << rows_number << ", number of columns " << columns_number << std::endl;
auto wb = non_optimized_workbook_formats(rows_number, columns_number);
auto f = "temp-formats.xlsx";
to_save_profile(wb, f);
xlnt::workbook load_formats_wb;
to_load_profile(load_formats_wb, f);
read_formats_profile(load_formats_wb, rows_number, columns_number);
}
catch(std::exception& ex)
{
std::cout << "failed. " << ex.what() << std::endl;
}
return 0;
}

View File

@ -1,11 +1,33 @@
// Copyright (c) 2017-2018 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <chrono>
#include <iostream>
#include <helpers/timing.hpp>
#include <xlnt/xlnt.hpp>
std::size_t current_time()
{
return std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
}
namespace {
// Create a worksheet with variable width rows. Because data must be
// serialised row by row it is often the width of the rows which is most
@ -15,61 +37,54 @@ void writer(int cols, int rows)
xlnt::workbook wb;
auto ws = wb.create_sheet();
std::vector<int> row;
for(int i = 0; i < cols; i++)
{
row.push_back(i);
}
for(int index = 0; index < rows; index++)
{
if ((index + 1) % (rows / 10) == 0)
if (rows >= 10 && (index + 1) % (rows / 10) == 0)
{
std::string progress = std::string((index + 1) / (1 + rows / 10), '.');
std::cout << "\r" << progress;
std::cout.flush();
}
ws.append(row);
for (int i = 0; i < cols; i++)
{
ws.cell(xlnt::cell_reference(i + 1, index + 1)).value(i);
}
}
std::cout << '\n';
std::cout << std::endl;
auto filename = "data/benchmark.xlsx";
auto filename = "benchmark.xlsx";
wb.save(filename);
}
// Create a timeit call to a function and pass in keyword arguments.
// The function is called twice, once using the standard workbook, then with the optimised one.
// Time from the best of three is taken.
int timer(std::function<void(int, int)> fn, int cols, int rows)
void timer(std::function<void(int, int)> fn, int cols, int rows)
{
const auto repeat = std::size_t(3);
auto time = std::numeric_limits<std::size_t>::max();
std::chrono::duration<double, std::milli> time{};
std::cout << cols << " cols " << rows << " rows" << std::endl;
fn(rows, cols); // 1 cold run
for(int i = 0; i < repeat; i++)
{
auto start = current_time();
auto start = std::chrono::high_resolution_clock::now();
fn(cols, rows);
time = std::min(current_time() - start, time);
time += std::chrono::high_resolution_clock::now() - start;
}
std::cout << time / 1000.0 << std::endl;
return time;
std::cout << time.count() / repeat << " ms per iteration" << '\n' << '\n';
}
} // namespace
int main()
{
timer(&writer, 10000, 1);
timer(&writer, 1000, 10);
timer(&writer, 100, 100);
timer(&writer, 1000, 100);
timer(&writer, 4000, 100);
timer(&writer, 8192, 100);
timer(&writer, 10, 10000);
timer(&writer, 4000, 1000);
timer(&writer, 10, 1000);
timer(&writer, 1, 10000);
return 0;
}

10
book.json Normal file
View File

@ -0,0 +1,10 @@
{
"plugins": ["build"],
"pluginsConfig": {
"build": {
"template": "docs/template.ejs",
"format": "man",
"output": "docs/xlnt.3"
}
}
}

133
cmake/FindArrow.cmake Normal file
View File

@ -0,0 +1,133 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# - Find ARROW (arrow/api.h, libarrow.a, libarrow.so)
# This module defines
# ARROW_INCLUDE_DIR, directory containing headers
# ARROW_LIBS, directory containing arrow libraries
# ARROW_STATIC_LIB, path to libarrow.a
# ARROW_SHARED_LIB, path to libarrow's shared library
# ARROW_SHARED_IMP_LIB, path to libarrow's import library (MSVC only)
# ARROW_FOUND, whether arrow has been found
include(FindPkgConfig)
if ("$ENV{ARROW_HOME}" STREQUAL "")
pkg_check_modules(ARROW arrow)
if (ARROW_FOUND)
pkg_get_variable(ARROW_ABI_VERSION arrow abi_version)
message(STATUS "Arrow ABI version: ${ARROW_ABI_VERSION}")
pkg_get_variable(ARROW_SO_VERSION arrow so_version)
message(STATUS "Arrow SO version: ${ARROW_SO_VERSION}")
set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS})
set(ARROW_LIBS ${ARROW_LIBRARY_DIRS})
set(ARROW_SEARCH_LIB_PATH ${ARROW_LIBRARY_DIRS})
endif()
else()
set(ARROW_HOME "$ENV{ARROW_HOME}")
set(ARROW_SEARCH_HEADER_PATHS
${ARROW_HOME}/include
)
set(ARROW_SEARCH_LIB_PATH
${ARROW_HOME}/lib
)
find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS
${ARROW_SEARCH_HEADER_PATHS}
# make sure we don't accidentally pick up a different version
NO_DEFAULT_PATH
)
endif()
find_library(ARROW_LIB_PATH NAMES arrow
PATHS
${ARROW_SEARCH_LIB_PATH}
NO_DEFAULT_PATH)
get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY)
find_library(ARROW_PYTHON_LIB_PATH NAMES arrow_python
PATHS
${ARROW_SEARCH_LIB_PATH}
NO_DEFAULT_PATH)
get_filename_component(ARROW_PYTHON_LIBS ${ARROW_PYTHON_LIB_PATH} DIRECTORY)
if (MSVC)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
if (MSVC AND NOT ARROW_MSVC_STATIC_LIB_SUFFIX)
set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static")
endif()
find_library(ARROW_SHARED_LIBRARIES NAMES arrow
PATHS ${ARROW_HOME} NO_DEFAULT_PATH
PATH_SUFFIXES "bin" )
find_library(ARROW_PYTHON_SHARED_LIBRARIES NAMES arrow_python
PATHS ${ARROW_HOME} NO_DEFAULT_PATH
PATH_SUFFIXES "bin" )
get_filename_component(ARROW_SHARED_LIBS ${ARROW_SHARED_LIBRARIES} PATH )
get_filename_component(ARROW_PYTHON_SHARED_LIBS ${ARROW_PYTHON_SHARED_LIBRARIES} PATH )
endif ()
if (ARROW_INCLUDE_DIR AND ARROW_LIBS)
set(ARROW_FOUND TRUE)
set(ARROW_LIB_NAME arrow)
set(ARROW_PYTHON_LIB_NAME arrow_python)
if (MSVC)
set(ARROW_STATIC_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ARROW_PYTHON_STATIC_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ARROW_SHARED_LIB ${ARROW_SHARED_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(ARROW_PYTHON_SHARED_LIB ${ARROW_PYTHON_SHARED_LIBS}/${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(ARROW_SHARED_IMP_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.lib)
set(ARROW_PYTHON_SHARED_IMP_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}.lib)
else()
set(ARROW_STATIC_LIB ${ARROW_PYTHON_LIB_PATH}/lib${ARROW_LIB_NAME}.a)
set(ARROW_PYTHON_STATIC_LIB ${ARROW_PYTHON_LIB_PATH}/lib${ARROW_PYTHON_LIB_NAME}.a)
set(ARROW_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(ARROW_PYTHON_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
endif()
if (ARROW_FOUND)
if (NOT Arrow_FIND_QUIETLY)
message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}")
message(STATUS "Found the Arrow Python library: ${ARROW_PYTHON_LIB_PATH}")
endif ()
else ()
if (NOT Arrow_FIND_QUIETLY)
set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers")
set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs")
set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_LIB_PATH}")
if (Arrow_FIND_REQUIRED)
message(FATAL_ERROR "${ARROW_ERR_MSG}")
else (Arrow_FIND_REQUIRED)
message(STATUS "${ARROW_ERR_MSG}")
endif (Arrow_FIND_REQUIRED)
endif ()
set(ARROW_FOUND FALSE)
endif ()
mark_as_advanced(
ARROW_INCLUDE_DIR
ARROW_STATIC_LIB
ARROW_SHARED_LIB
ARROW_PYTHON_STATIC_LIB
ARROW_PYTHON_SHARED_LIB
)

13
cmake/XlntConfig.cmake.in Normal file
View File

@ -0,0 +1,13 @@
set(XLNT_VERSION "@xlnt_VERSION@")
@PACKAGE_INIT@
get_filename_component(XLNT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set_and_check(XLNT_INCLUDE_DIR "@XLNT_INCLUDE_INSTALL_DIR@")
check_required_components(xlnt)
if(NOT TARGET xlnt::xlnt)
include("${XLNT_CMAKE_DIR}/XlntTargets.cmake")
endif()

View File

@ -1,24 +0,0 @@
set(LIBRARY_NAME xlnt)
set(LIBRARY_VERSION 0.9.1)
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()

634
cmake/ucm.cmake Normal file
View File

@ -0,0 +1,634 @@
#
# ucm.cmake - useful cmake macros
#
# Copyright (c) 2016 Viktor Kirilov
#
# Distributed under the MIT Software License
# See accompanying file LICENSE.txt or copy at
# https://opensource.org/licenses/MIT
#
# The documentation can be found at the library's page:
# https://github.com/onqtam/ucm
cmake_minimum_required(VERSION 2.8.12)
include(CMakeParseArguments)
# optionally include cotire - the git submodule might not be inited (or the user might have already included it)
if(NOT COMMAND cotire)
include(${CMAKE_CURRENT_LIST_DIR}/../cotire/CMake/cotire.cmake OPTIONAL)
endif()
if(COMMAND cotire AND "1.7.9" VERSION_LESS "${COTIRE_CMAKE_MODULE_VERSION}")
set(ucm_with_cotire 1)
else()
set(ucm_with_cotire 0)
endif()
option(UCM_UNITY_BUILD "Enable unity build for targets registered with the ucm_add_target() macro" OFF)
option(UCM_NO_COTIRE_FOLDER "Do not use a cotire folder in the solution explorer for all unity and cotire related targets" ON)
# ucm_add_flags
# Adds compiler flags to CMAKE_<LANG>_FLAGS or to a specific config
macro(ucm_add_flags)
cmake_parse_arguments(ARG "C;CXX;CLEAR_OLD" "" "CONFIG" ${ARGN})
if(NOT ARG_CONFIG)
set(ARG_CONFIG " ")
endif()
foreach(CONFIG ${ARG_CONFIG})
# determine to which flags to add
if(NOT ${CONFIG} STREQUAL " ")
string(TOUPPER ${CONFIG} CONFIG)
set(CXX_FLAGS CMAKE_CXX_FLAGS_${CONFIG})
set(C_FLAGS CMAKE_C_FLAGS_${CONFIG})
else()
set(CXX_FLAGS CMAKE_CXX_FLAGS)
set(C_FLAGS CMAKE_C_FLAGS)
endif()
# clear the old flags
if(${ARG_CLEAR_OLD})
if("${ARG_CXX}" OR NOT "${ARG_C}")
set(${CXX_FLAGS} "")
endif()
if("${ARG_C}" OR NOT "${ARG_CXX}")
set(${C_FLAGS} "")
endif()
endif()
# add all the passed flags
foreach(flag ${ARG_UNPARSED_ARGUMENTS})
if("${ARG_CXX}" OR NOT "${ARG_C}")
set(${CXX_FLAGS} "${${CXX_FLAGS}} ${flag}")
endif()
if("${ARG_C}" OR NOT "${ARG_CXX}")
set(${C_FLAGS} "${${C_FLAGS}} ${flag}")
endif()
endforeach()
endforeach()
endmacro()
# ucm_set_flags
# Sets the CMAKE_<LANG>_FLAGS compiler flags or for a specific config
macro(ucm_set_flags)
ucm_add_flags(CLEAR_OLD ${ARGN})
endmacro()
# ucm_add_linker_flags
# Adds linker flags to CMAKE_<TYPE>_LINKER_FLAGS or to a specific config
macro(ucm_add_linker_flags)
cmake_parse_arguments(ARG "CLEAR_OLD;EXE;MODULE;SHARED;STATIC" "" "CONFIG" ${ARGN})
if(NOT ARG_CONFIG)
set(ARG_CONFIG " ")
endif()
foreach(CONFIG ${ARG_CONFIG})
string(TOUPPER "${CONFIG}" CONFIG)
if(NOT ${ARG_EXE} AND NOT ${ARG_MODULE} AND NOT ${ARG_SHARED} AND NOT ${ARG_STATIC})
set(ARG_EXE 1)
set(ARG_MODULE 1)
set(ARG_SHARED 1)
set(ARG_STATIC 1)
endif()
set(flags_configs "")
if(${ARG_EXE})
if(NOT "${CONFIG}" STREQUAL " ")
list(APPEND flags_configs CMAKE_EXE_LINKER_FLAGS_${CONFIG})
else()
list(APPEND flags_configs CMAKE_EXE_LINKER_FLAGS)
endif()
endif()
if(${ARG_MODULE})
if(NOT "${CONFIG}" STREQUAL " ")
list(APPEND flags_configs CMAKE_MODULE_LINKER_FLAGS_${CONFIG})
else()
list(APPEND flags_configs CMAKE_MODULE_LINKER_FLAGS)
endif()
endif()
if(${ARG_SHARED})
if(NOT "${CONFIG}" STREQUAL " ")
list(APPEND flags_configs CMAKE_SHARED_LINKER_FLAGS_${CONFIG})
else()
list(APPEND flags_configs CMAKE_SHARED_LINKER_FLAGS)
endif()
endif()
if(${ARG_STATIC})
if(NOT "${CONFIG}" STREQUAL " ")
list(APPEND flags_configs CMAKE_STATIC_LINKER_FLAGS_${CONFIG})
else()
list(APPEND flags_configs CMAKE_STATIC_LINKER_FLAGS)
endif()
endif()
# clear the old flags
if(${ARG_CLEAR_OLD})
foreach(flags ${flags_configs})
set(${flags} "")
endforeach()
endif()
# add all the passed flags
foreach(flag ${ARG_UNPARSED_ARGUMENTS})
foreach(flags ${flags_configs})
set(${flags} "${${flags}} ${flag}")
endforeach()
endforeach()
endforeach()
endmacro()
# ucm_set_linker_flags
# Sets the CMAKE_<TYPE>_LINKER_FLAGS linker flags or for a specific config
macro(ucm_set_linker_flags)
ucm_add_linker_flags(CLEAR_OLD ${ARGN})
endmacro()
# ucm_gather_flags
# Gathers all lists of flags for printing or manipulation
macro(ucm_gather_flags with_linker result)
set(${result} "")
# add the main flags without a config
list(APPEND ${result} CMAKE_C_FLAGS)
list(APPEND ${result} CMAKE_CXX_FLAGS)
if(${with_linker})
list(APPEND ${result} CMAKE_EXE_LINKER_FLAGS)
list(APPEND ${result} CMAKE_MODULE_LINKER_FLAGS)
list(APPEND ${result} CMAKE_SHARED_LINKER_FLAGS)
list(APPEND ${result} CMAKE_STATIC_LINKER_FLAGS)
endif()
if("${CMAKE_CONFIGURATION_TYPES}" STREQUAL "" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
# handle single config generators - like makefiles/ninja - when CMAKE_BUILD_TYPE is set
string(TOUPPER ${CMAKE_BUILD_TYPE} config)
list(APPEND ${result} CMAKE_C_FLAGS_${config})
list(APPEND ${result} CMAKE_CXX_FLAGS_${config})
if(${with_linker})
list(APPEND ${result} CMAKE_EXE_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_MODULE_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_SHARED_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_STATIC_LINKER_FLAGS_${config})
endif()
else()
# handle multi config generators (like msvc, xcode)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
list(APPEND ${result} CMAKE_C_FLAGS_${config})
list(APPEND ${result} CMAKE_CXX_FLAGS_${config})
if(${with_linker})
list(APPEND ${result} CMAKE_EXE_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_MODULE_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_SHARED_LINKER_FLAGS_${config})
list(APPEND ${result} CMAKE_STATIC_LINKER_FLAGS_${config})
endif()
endforeach()
endif()
endmacro()
# ucm_set_runtime
# Sets the runtime (static/dynamic) for msvc/gcc
macro(ucm_set_runtime)
cmake_parse_arguments(ARG "STATIC;DYNAMIC" "" "" ${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" STREQUAL "")
message(AUTHOR_WARNING "ucm_set_runtime() does not support clang yet!")
endif()
ucm_gather_flags(0 flags_configs)
# add/replace the flags
# note that if the user has messed with the flags directly this function might fail
# - for example if with MSVC and the user has removed the flags - here we just switch/replace them
if("${ARG_STATIC}")
foreach(flags ${flags_configs})
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(NOT ${flags} MATCHES "-static-libstdc\\+\\+")
set(${flags} "${${flags}} -static-libstdc++")
endif()
if(NOT ${flags} MATCHES "-static-libgcc")
set(${flags} "${${flags}} -static-libgcc")
endif()
elseif(MSVC)
if(${flags} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flags} "${${flags}}")
endif()
endif()
endforeach()
elseif("${ARG_DYNAMIC}")
foreach(flags ${flags_configs})
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(${flags} MATCHES "-static-libstdc\\+\\+")
string(REGEX REPLACE "-static-libstdc\\+\\+" "" ${flags} "${${flags}}")
endif()
if(${flags} MATCHES "-static-libgcc")
string(REGEX REPLACE "-static-libgcc" "" ${flags} "${${flags}}")
endif()
elseif(MSVC)
if(${flags} MATCHES "/MT")
string(REGEX REPLACE "/MT" "/MD" ${flags} "${${flags}}")
endif()
endif()
endforeach()
endif()
endmacro()
# ucm_print_flags
# Prints all compiler flags for all configurations
macro(ucm_print_flags)
ucm_gather_flags(1 flags_configs)
message("")
foreach(flags ${flags_configs})
message("${flags}: ${${flags}}")
endforeach()
message("")
endmacro()
# ucm_count_sources
# Counts the number of source files
macro(ucm_count_sources)
cmake_parse_arguments(ARG "" "RESULT" "" ${ARGN})
if(${ARG_RESULT} STREQUAL "")
message(FATAL_ERROR "Need to pass RESULT and a variable name to ucm_count_sources()")
endif()
set(result 0)
foreach(SOURCE_FILE ${ARG_UNPARSED_ARGUMENTS})
if("${SOURCE_FILE}" MATCHES \\.\(c|C|cc|cp|cpp|CPP|c\\+\\+|cxx|i|ii\)$)
math(EXPR result "${result} + 1")
endif()
endforeach()
set(${ARG_RESULT} ${result})
endmacro()
# ucm_include_file_in_sources
# Includes the file to the source with compiler flags
macro(ucm_include_file_in_sources)
cmake_parse_arguments(ARG "" "HEADER" "" ${ARGN})
if(${ARG_HEADER} STREQUAL "")
message(FATAL_ERROR "Need to pass HEADER and a header file to ucm_include_file_in_sources()")
endif()
foreach(src ${ARG_UNPARSED_ARGUMENTS})
if(${src} MATCHES \\.\(c|C|cc|cp|cpp|CPP|c\\+\\+|cxx\)$)
# get old flags
get_source_file_property(old_compile_flags ${src} COMPILE_FLAGS)
if(old_compile_flags STREQUAL "NOTFOUND")
set(old_compile_flags "")
endif()
# update flags
if(MSVC)
set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS
"${old_compile_flags} /FI\"${CMAKE_CURRENT_SOURCE_DIR}/${ARG_HEADER}\"")
else()
set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS
"${old_compile_flags} -include \"${CMAKE_CURRENT_SOURCE_DIR}/${ARG_HEADER}\"")
endif()
endif()
endforeach()
endmacro()
# ucm_dir_list
# Returns a list of subdirectories for a given directory
macro(ucm_dir_list thedir result)
file(GLOB sub-dir "${thedir}/*")
set(list_of_dirs "")
foreach(dir ${sub-dir})
if(IS_DIRECTORY ${dir})
get_filename_component(DIRNAME ${dir} NAME)
LIST(APPEND list_of_dirs ${DIRNAME})
endif()
endforeach()
set(${result} ${list_of_dirs})
endmacro()
# ucm_trim_front_words
# Trims X times the front word from a string separated with "/" and removes
# the front "/" characters after that (used for filters for visual studio)
macro(ucm_trim_front_words source out num_filter_trims)
set(result "${source}")
set(counter 0)
while(${counter} LESS ${num_filter_trims})
MATH(EXPR counter "${counter} + 1")
# removes everything at the front up to a "/" character
string(REGEX REPLACE "^([^/]+)" "" result "${result}")
# removes all consecutive "/" characters from the front
string(REGEX REPLACE "^(/+)" "" result "${result}")
endwhile()
set(${out} ${result})
endmacro()
# ucm_remove_files
# Removes source files from a list of sources (path is the relative path for it to be found)
macro(ucm_remove_files)
cmake_parse_arguments(ARG "" "FROM" "" ${ARGN})
if("${ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(FATAL_ERROR "Need to pass some relative files to ucm_remove_files()")
endif()
if(${ARG_FROM} STREQUAL "")
message(FATAL_ERROR "Need to pass FROM and a variable name to ucm_remove_files()")
endif()
foreach(cur_file ${ARG_UNPARSED_ARGUMENTS})
list(REMOVE_ITEM ${ARG_FROM} ${cur_file})
endforeach()
endmacro()
# ucm_remove_directories
# Removes all source files from the given directories from the sources list
macro(ucm_remove_directories)
cmake_parse_arguments(ARG "" "FROM" "MATCHES" ${ARGN})
if("${ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(FATAL_ERROR "Need to pass some relative directories to ucm_remove_directories()")
endif()
if(${ARG_FROM} STREQUAL "")
message(FATAL_ERROR "Need to pass FROM and a variable name to ucm_remove_directories()")
endif()
foreach(cur_dir ${ARG_UNPARSED_ARGUMENTS})
foreach(cur_file ${${ARG_FROM}})
string(REGEX MATCH ${cur_dir} res ${cur_file})
if(NOT "${res}" STREQUAL "")
if("${ARG_MATCHES}" STREQUAL "")
list(REMOVE_ITEM ${ARG_FROM} ${cur_file})
else()
foreach(curr_ptrn ${ARG_MATCHES})
string(REGEX MATCH ${curr_ptrn} res ${cur_file})
if(NOT "${res}" STREQUAL "")
list(REMOVE_ITEM ${ARG_FROM} ${cur_file})
break()
endif()
endforeach()
endif()
endif()
endforeach()
endforeach()
endmacro()
# ucm_add_files_impl
macro(ucm_add_files_impl result trim files)
foreach(cur_file ${files})
SET(${result} ${${result}} ${cur_file})
get_filename_component(FILEPATH ${cur_file} PATH)
ucm_trim_front_words("${FILEPATH}" FILEPATH "${trim}")
# replacing forward slashes with back slashes so filters can be generated (back slash used in parsing...)
STRING(REPLACE "/" "\\" FILTERS "${FILEPATH}")
SOURCE_GROUP("${FILTERS}" FILES ${cur_file})
endforeach()
endmacro()
# ucm_add_files
# Adds files to a list of sources
macro(ucm_add_files)
cmake_parse_arguments(ARG "" "TO;FILTER_POP" "" ${ARGN})
if("${ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(FATAL_ERROR "Need to pass some relative files to ucm_add_files()")
endif()
if(${ARG_TO} STREQUAL "")
message(FATAL_ERROR "Need to pass TO and a variable name to ucm_add_files()")
endif()
if("${ARG_FILTER_POP}" STREQUAL "")
set(ARG_FILTER_POP 0)
endif()
ucm_add_files_impl(${ARG_TO} ${ARG_FILTER_POP} "${ARG_UNPARSED_ARGUMENTS}")
endmacro()
# ucm_add_dir_impl
macro(ucm_add_dir_impl result rec trim dirs_in additional_ext)
set(dirs "${dirs_in}")
# handle the "" and "." cases
if("${dirs}" STREQUAL "" OR "${dirs}" STREQUAL ".")
set(dirs "./")
endif()
foreach(cur_dir ${dirs})
# to circumvent some linux/cmake/path issues - barely made it work...
if(cur_dir STREQUAL "./")
set(cur_dir "")
else()
set(cur_dir "${cur_dir}/")
endif()
# since unix is case sensitive - add these valid extensions too
# we don't use "UNIX" but instead "CMAKE_HOST_UNIX" because we might be cross
# compiling (for example emscripten) under windows and UNIX may be set to 1
# Also OSX is case insensitive like windows...
set(additional_file_extensions "")
if(CMAKE_HOST_UNIX AND NOT APPLE)
set(additional_file_extensions
"${cur_dir}*.CPP"
"${cur_dir}*.C"
"${cur_dir}*.H"
"${cur_dir}*.HPP"
)
endif()
foreach(ext ${additional_ext})
list(APPEND additional_file_extensions "${cur_dir}*.${ext}")
endforeach()
# find all sources and set them as result
FILE(GLOB found_sources RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
# https://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Overall-Options.html#index-file-name-suffix-71
# sources
"${cur_dir}*.cpp"
"${cur_dir}*.cxx"
"${cur_dir}*.c++"
"${cur_dir}*.cc"
"${cur_dir}*.cp"
"${cur_dir}*.c"
"${cur_dir}*.i"
"${cur_dir}*.ii"
# headers
"${cur_dir}*.h"
"${cur_dir}*.h++"
"${cur_dir}*.hpp"
"${cur_dir}*.hxx"
"${cur_dir}*.hh"
"${cur_dir}*.inl"
"${cur_dir}*.inc"
"${cur_dir}*.ipp"
"${cur_dir}*.ixx"
"${cur_dir}*.txx"
"${cur_dir}*.tpp"
"${cur_dir}*.tcc"
"${cur_dir}*.tpl"
${additional_file_extensions})
SET(${result} ${${result}} ${found_sources})
# set the proper filters
ucm_trim_front_words("${cur_dir}" cur_dir "${trim}")
# replacing forward slashes with back slashes so filters can be generated (back slash used in parsing...)
STRING(REPLACE "/" "\\" FILTERS "${cur_dir}")
SOURCE_GROUP("${FILTERS}" FILES ${found_sources})
endforeach()
if(${rec})
foreach(cur_dir ${dirs})
ucm_dir_list("${cur_dir}" subdirs)
foreach(subdir ${subdirs})
ucm_add_dir_impl(${result} ${rec} ${trim} "${cur_dir}/${subdir}" "${additional_ext}")
endforeach()
endforeach()
endif()
endmacro()
# ucm_add_dirs
# Adds all files from directories traversing them recursively to a list of sources
# and generates filters according to their location (accepts relative paths only).
# Also this macro trims X times the front word from the filter string for visual studio filters.
macro(ucm_add_dirs)
cmake_parse_arguments(ARG "RECURSIVE" "TO;FILTER_POP" "ADDITIONAL_EXT" ${ARGN})
if(${ARG_TO} STREQUAL "")
message(FATAL_ERROR "Need to pass TO and a variable name to ucm_add_dirs()")
endif()
if("${ARG_FILTER_POP}" STREQUAL "")
set(ARG_FILTER_POP 0)
endif()
ucm_add_dir_impl(${ARG_TO} ${ARG_RECURSIVE} ${ARG_FILTER_POP} "${ARG_UNPARSED_ARGUMENTS}" "${ARG_ADDITIONAL_EXT}")
endmacro()
# ucm_add_target
# Adds a target eligible for cotiring - unity build and/or precompiled header
macro(ucm_add_target)
cmake_parse_arguments(ARG "UNITY" "NAME;TYPE;PCH_FILE;CPP_PER_UNITY" "UNITY_EXCLUDED;SOURCES" ${ARGN})
if(NOT "${ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(FATAL_ERROR "Unrecognized options passed to ucm_add_target()")
endif()
if("${ARG_NAME}" STREQUAL "")
message(FATAL_ERROR "Need to pass NAME and a name for the target to ucm_add_target()")
endif()
set(valid_types EXECUTABLE STATIC SHARED MODULE)
list(FIND valid_types "${ARG_TYPE}" is_type_valid)
if(${is_type_valid} STREQUAL "-1")
message(FATAL_ERROR "Need to pass TYPE and the type for the target [EXECUTABLE/STATIC/SHARED/MODULE] to ucm_add_target()")
endif()
if("${ARG_SOURCES}" STREQUAL "")
message(FATAL_ERROR "Need to pass SOURCES and a list of source files to ucm_add_target()")
endif()
# init with the global unity flag
set(do_unity ${UCM_UNITY_BUILD})
# check the UNITY argument
if(NOT ARG_UNITY)
set(do_unity FALSE)
endif()
# if target is excluded through the exclusion list
list(FIND UCM_UNITY_BUILD_EXCLUDE_TARGETS ${ARG_NAME} is_target_excluded)
if(NOT ${is_target_excluded} STREQUAL "-1")
set(do_unity FALSE)
endif()
# unity build only for targets with > 1 source file (otherwise there will be an additional unnecessary target)
if(do_unity) # optimization
ucm_count_sources(${ARG_SOURCES} RESULT num_sources)
if(${num_sources} LESS 2)
set(do_unity FALSE)
endif()
endif()
set(wanted_cotire ${do_unity})
# if cotire cannot be used
if(do_unity AND NOT ucm_with_cotire)
set(do_unity FALSE)
endif()
# inform the developer that the current target might benefit from a unity build
if(NOT ARG_UNITY AND ${UCM_UNITY_BUILD})
ucm_count_sources(${ARG_SOURCES} RESULT num_sources)
if(${num_sources} GREATER 1)
message(AUTHOR_WARNING "Target '${ARG_NAME}' may benefit from a unity build.\nIt has ${num_sources} sources - enable with UNITY flag")
endif()
endif()
# prepare for the unity build
set(orig_target ${ARG_NAME})
if(do_unity)
# the original target will be added with a different name than the requested
set(orig_target ${ARG_NAME}_ORIGINAL)
# exclude requested files from unity build of the current target
foreach(excluded_file "${ARG_UNITY_EXCLUDED}")
set_source_files_properties(${excluded_file} PROPERTIES COTIRE_EXCLUDED TRUE)
endforeach()
endif()
# add the original target
if(${ARG_TYPE} STREQUAL "EXECUTABLE")
add_executable(${orig_target} ${ARG_SOURCES})
else()
add_library(${orig_target} ${ARG_TYPE} ${ARG_SOURCES})
endif()
if(do_unity)
# set the number of unity cpp files to be used for the unity target
if(NOT "${ARG_CPP_PER_UNITY}" STREQUAL "")
set_property(TARGET ${orig_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES "${ARG_CPP_PER_UNITY}")
else()
set_property(TARGET ${orig_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES "100")
endif()
if(NOT "${ARG_PCH_FILE}" STREQUAL "")
set_target_properties(${orig_target} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${ARG_PCH_FILE}")
else()
set_target_properties(${orig_target} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
endif()
# add a unity target for the original one with the name intended for the original
set_target_properties(${orig_target} PROPERTIES COTIRE_UNITY_TARGET_NAME ${ARG_NAME})
# this is the library call that does the magic
cotire(${orig_target})
set_target_properties(clean_cotire PROPERTIES FOLDER "CMakePredefinedTargets")
# disable the original target and enable the unity one
get_target_property(unity_target_name ${orig_target} COTIRE_UNITY_TARGET_NAME)
set_target_properties(${orig_target} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
set_target_properties(${unity_target_name} PROPERTIES EXCLUDE_FROM_ALL 0 EXCLUDE_FROM_DEFAULT_BUILD 0)
# also set the name of the target output as the original one
set_target_properties(${unity_target_name} PROPERTIES OUTPUT_NAME ${ARG_NAME})
if(UCM_NO_COTIRE_FOLDER)
# reset the folder property so all unity targets dont end up in a single folder in the solution explorer of VS
set_target_properties(${unity_target_name} PROPERTIES FOLDER "")
endif()
set_target_properties(all_unity PROPERTIES FOLDER "CMakePredefinedTargets")
elseif(NOT "${ARG_PCH_FILE}" STREQUAL "")
set(wanted_cotire TRUE)
if(ucm_with_cotire)
set_target_properties(${orig_target} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
set_target_properties(${orig_target} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${ARG_PCH_FILE}")
cotire(${orig_target})
set_target_properties(clean_cotire PROPERTIES FOLDER "CMakePredefinedTargets")
endif()
endif()
# print a message if the target was requested to be cotired but it couldn't
if(wanted_cotire AND NOT ucm_with_cotire)
if(NOT COMMAND cotire)
message(AUTHOR_WARNING "Target \"${ARG_NAME}\" not cotired because cotire isn't loaded")
else()
message(AUTHOR_WARNING "Target \"${ARG_NAME}\" not cotired because cotire is older than the required version")
endif()
endif()
endmacro()

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."

25
docs/README.md Normal file
View File

@ -0,0 +1,25 @@
# Table of Contents
* [Read Me](/README.md)
* [Introduction](/docs/introduction/README.md)
* [Motivation](/docs/introduction/Motivation.md)
* [Examples](/docs/introduction/Examples.md)
* [Features](/docs/introduction/Features.md)
* [Installation](/docs/introduction/Installation.md)
* [Basics](/docs/basics/README.md)
* [Workbook](/docs/basics/Workbook.md)
* [Worksheet](/docs/basics/Worksheet.md)
* [Cell](/docs/basics/Cell.md)
* [Iteration](/docs/basics/Iteration.md)
* [Advanced](/docs/advanced/README.md)
* [Formatting](/docs/advanced/Formatting.md)
* [Properties](/docs/advanced/Properties.md)
* [Printing](/docs/advanced/Printing.md)
* [Encryption](/docs/advanced/Encryption.md)
* [Views](/docs/advanced/Views.md)
* [API Reference](/docs/api/README.md)
* [cell](/docs/api/cell.md)
* [cell_reference](/docs/api/cell_reference.md)
* [Change Log](/CHANGELOG.md)
* [Contributing](/CONTRIBUTING.md)
* [License](/LICENSE.md)

View File

@ -0,0 +1 @@
## Encryption

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 @@
## Printing

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");
```

7
docs/advanced/README.md Normal file
View File

@ -0,0 +1,7 @@
## Advanced
* [Formatting](Formatting.md)
* [Properties](Properties.md)
* [Printing](Printing.md)
* [Encryption](Encryption.md)
* [Views](Views.md)

1
docs/advanced/Views.md Normal file
View File

@ -0,0 +1 @@
## Views

4
docs/api/README.md Normal file
View File

@ -0,0 +1,4 @@
## API
* [cell](cell.md)
* [cell_reference](cell_reference.md)

188
docs/api/cell.md Normal file
View File

@ -0,0 +1,188 @@
# cell
## ```using xlnt::cell::type = cell_typeundefined```
Alias xlnt::cell_type to xlnt::cell::type since it looks nicer.
## ```friend class detail::xlsx_consumerundefined```
## ```friend class detail::xlsx_producerundefined```
## ```friend struct detail::cell_implundefined```
## ```static const std::unordered_map<std::string, int>& xlnt::cell::error_codes()```
Returns a map of error strings such as #DIV/0! and their associated indices.
## ```xlnt::cell::cell(const cell &)=default```
Default copy constructor.
## ```bool xlnt::cell::has_value() const```
Returns true if value has been set and has not been cleared using cell::clear_value().
## ```T xlnt::cell::value() const```
Returns the value of this cell as an instance of type T. Overloads exist for most C++ fundamental types like bool, int, etc. as well as for std::string and xlnt datetime types: date, time, datetime, and timedelta.
## ```void xlnt::cell::clear_value()```
Makes this cell have a value of type null. All other cell attributes are retained.
## ```void xlnt::cell::value(std::nullptr_t)```
Sets the type of this cell to null.
## ```void xlnt::cell::value(bool boolean_value)```
Sets the value of this cell to the given boolean value.
## ```void xlnt::cell::value(int int_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(unsigned int int_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(long long int int_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(unsigned long long int int_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(float float_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(double float_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(long double float_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const date &date_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const time &time_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const datetime &datetime_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const timedelta &timedelta_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const std::string &string_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const char *string_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const rich_text &text_value)```
Sets the value of this cell to the given value.
## ```void xlnt::cell::value(const cell other_cell)```
Sets the value and formatting of this cell to that of other_cell.
## ```void xlnt::cell::value(const std::string &string_value, bool infer_type)```
Analyzes string_value to determine its type, convert it to that type, and set the value of this cell to that converted value.
## ```type xlnt::cell::data_type() const```
Returns the type of this cell.
## ```void xlnt::cell::data_type(type t)```
Sets the type of this cell. This should usually be done indirectly by setting the value of the cell to a value of that type.
## ```bool xlnt::cell::garbage_collectible() const```
There's no reason to keep a cell which has no value and is not a placeholder. Returns true if this cell has no value, style, isn't merged, etc.
## ```bool xlnt::cell::is_date() const```
Returns true iff this cell's number format matches a date format.
## ```cell_reference xlnt::cell::reference() const```
Returns a cell_reference that points to the location of this cell.
## ```column_t xlnt::cell::column() const```
Returns the column of this cell.
## ```row_t xlnt::cell::row() const```
Returns the row of this cell.
## ```std::pair<int, int> xlnt::cell::anchor() const```
Returns the location of this cell as an ordered pair (left, top).
## ```std::string xlnt::cell::hyperlink() const```
Returns the URL of this cell's hyperlink.
## ```void xlnt::cell::hyperlink(const std::string &url)```
Adds a hyperlink to this cell pointing to the URL of the given value.
## ```void xlnt::cell::hyperlink(const std::string &url, const std::string &display)```
Adds a hyperlink to this cell pointing to the URI of the given value and sets the text value of the cell to the given parameter.
## ```void xlnt::cell::hyperlink(xlnt::cell target)```
Adds an internal hyperlink to this cell pointing to the given cell.
## ```bool xlnt::cell::has_hyperlink() const```
Returns true if this cell has a hyperlink set.
## ```class alignment xlnt::cell::computed_alignment() const```
Returns the alignment that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```class border xlnt::cell::computed_border() const```
Returns the border that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```class fill xlnt::cell::computed_fill() const```
Returns the fill that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```class font xlnt::cell::computed_font() const```
Returns the font that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```class number_format xlnt::cell::computed_number_format() const```
Returns the number format that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```class protection xlnt::cell::computed_protection() const```
Returns the protection that should be used when displaying this cell graphically based on the workbook default, the cell-level format, and the named style applied to the cell in that order.
## ```bool xlnt::cell::has_format() const```
Returns true if this cell has had a format applied to it.
## ```const class format xlnt::cell::format() const```
Returns the format applied to this cell. If this cell has no format, an invalid_attribute exception will be thrown.
## ```void xlnt::cell::format(const class format new_format)```
Applies the cell-level formatting of new_format to this cell.
## ```void xlnt::cell::clear_format()```
Removes the cell-level formatting from this cell. This doesn't affect the style that may also be applied to the cell. Throws an invalid_attribute exception if no format is applied.
## ```class number_format xlnt::cell::number_format() const```
Returns the number format of this cell.
## ```void xlnt::cell::number_format(const class number_format &format)```
Creates a new format in the workbook, sets its number_format to the given format, and applies the format to this cell.
## ```class font xlnt::cell::font() const```
Returns the font applied to the text in this cell.
## ```void xlnt::cell::font(const class font &font_)```
Creates a new format in the workbook, sets its font to the given font, and applies the format to this cell.
## ```class fill xlnt::cell::fill() const```
Returns the fill applied to this cell.
## ```void xlnt::cell::fill(const class fill &fill_)```
Creates a new format in the workbook, sets its fill to the given fill, and applies the format to this cell.
## ```class border xlnt::cell::border() const```
Returns the border of this cell.
## ```void xlnt::cell::border(const class border &border_)```
Creates a new format in the workbook, sets its border to the given border, and applies the format to this cell.
## ```class alignment xlnt::cell::alignment() const```
Returns the alignment of the text in this cell.
## ```void xlnt::cell::alignment(const class alignment &alignment_)```
Creates a new format in the workbook, sets its alignment to the given alignment, and applies the format to this cell.
## ```class protection xlnt::cell::protection() const```
Returns the protection of this cell.
## ```void xlnt::cell::protection(const class protection &protection_)```
Creates a new format in the workbook, sets its protection to the given protection, and applies the format to this cell.
## ```bool xlnt::cell::has_style() const```
Returns true if this cell has had a style applied to it.
## ```class style xlnt::cell::style()```
Returns a wrapper pointing to the named style applied to this cell.
## ```const class style xlnt::cell::style() const```
Returns a wrapper pointing to the named style applied to this cell.
## ```void xlnt::cell::style(const class style &new_style)```
Sets the named style applied to this cell to a style named style_name. Equivalent to style(new_style.name()).
## ```void xlnt::cell::style(const std::string &style_name)```
Sets the named style applied to this cell to a style named style_name. If this style has not been previously created in the workbook, a key_not_found exception will be thrown.
## ```void xlnt::cell::clear_style()```
Removes the named style from this cell. An invalid_attribute exception will be thrown if this cell has no style. This will not affect the cell format of the cell.
## ```std::string xlnt::cell::formula() const```
Returns the string representation of the formula applied to this cell.
## ```void xlnt::cell::formula(const std::string &formula)```
Sets the formula of this cell to the given value. This formula string should begin with '='.
## ```void xlnt::cell::clear_formula()```
Removes the formula from this cell. After this is called, has_formula() will return false.
## ```bool xlnt::cell::has_formula() const```
Returns true if this cell has had a formula applied to it.
## ```std::string xlnt::cell::to_string() const```
Returns a string representing the value of this cell. If the data type is not a string, it will be converted according to the number format.
## ```bool xlnt::cell::is_merged() const```
Returns true iff this cell has been merged with one or more surrounding cells.
## ```void xlnt::cell::merged(bool merged)```
Makes this a merged cell iff merged is true. Generally, this shouldn't be called directly. Instead, use worksheet::merge_cells on its parent worksheet.
## ```std::string xlnt::cell::error() const```
Returns the error string that is stored in this cell.
## ```void xlnt::cell::error(const std::string &error)```
Directly assigns the value of this cell to be the given error.
## ```cell xlnt::cell::offset(int column, int row)```
Returns a cell from this cell's parent workbook at a relative offset given by the parameters.
## ```class worksheet xlnt::cell::worksheet()```
Returns the worksheet that owns this cell.
## ```const class worksheet xlnt::cell::worksheet() const```
Returns the worksheet that owns this cell.
## ```class workbook& xlnt::cell::workbook()```
Returns the workbook of the worksheet that owns this cell.
## ```const class workbook& xlnt::cell::workbook() const```
Returns the workbook of the worksheet that owns this cell.
## ```calendar xlnt::cell::base_date() const```
Returns the base date of the parent workbook.
## ```std::string xlnt::cell::check_string(const std::string &to_check)```
Returns to_check after verifying and fixing encoding, size, and illegal characters.
## ```bool xlnt::cell::has_comment()```
Returns true if this cell has a comment applied.
## ```void xlnt::cell::clear_comment()```
Deletes the comment applied to this cell if it exists.
## ```class comment xlnt::cell::comment()```
Gets the comment applied to this cell.
## ```void xlnt::cell::comment(const std::string &text, const std::string &author="Microsoft Office User")```
Creates a new comment with the given text and optional author and applies it to the cell.
## ```void xlnt::cell::comment(const std::string &comment_text, const class font &comment_font, const std::string &author="Microsoft Office User")```
Creates a new comment with the given text, formatting, and optional author and applies it to the cell.
## ```void xlnt::cell::comment(const class comment &new_comment)```
Apply the comment provided as the only argument to the cell.
## ```double xlnt::cell::width() const```
Returns the width of this cell in pixels.
## ```double xlnt::cell::height() const```
Returns the height of this cell in pixels.
## ```cell& xlnt::cell::operator=(const cell &rhs)```
Makes this cell interally point to rhs. The cell data originally pointed to by this cell will be unchanged.
## ```bool xlnt::cell::operator==(const cell &comparand) const```
Returns true if this cell the same cell as comparand (compared by reference).
## ```bool xlnt::cell::operator==(std::nullptr_t) const```
Returns true if this cell is uninitialized.

View File

@ -0,0 +1,55 @@
# cell_reference
## ```static std::pair<std::string, row_t> xlnt::cell_reference::split_reference(const std::string &reference_string)```
Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}.
## ```static std::pair<std::string, row_t> xlnt::cell_reference::split_reference(const std::string &reference_string, bool &absolute_column, bool &absolute_row)```
Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}. Reference parameters absolute_column and absolute_row will be set to true if column part or row part are prefixed by a dollar-sign indicating they are absolute, otherwise false.
## ```xlnt::cell_reference::cell_reference()```
Default constructor makes a reference to the top-left-most cell, "A1".
## ```xlnt::cell_reference::cell_reference(const char *reference_string)```
Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
## ```xlnt::cell_reference::cell_reference(const std::string &reference_string)```
Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
## ```xlnt::cell_reference::cell_reference(column_t column, row_t row)```
Constructs a cell_reference from a 1-indexed column index and row index.
## ```cell_reference& xlnt::cell_reference::make_absolute(bool absolute_column=true, bool absolute_row=true)```
Converts a coordinate to an absolute coordinate string (e.g. B12 -> $B$12) Defaulting to true, absolute_column and absolute_row can optionally control whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12) and absolute row (e.g. B12 -> B$12) respectively.
## ```bool xlnt::cell_reference::column_absolute() const```
Returns true if the reference refers to an absolute column, otherwise false.
## ```void xlnt::cell_reference::column_absolute(bool absolute_column)```
Makes this reference have an absolute column if absolute_column is true, otherwise not absolute.
## ```bool xlnt::cell_reference::row_absolute() const```
Returns true if the reference refers to an absolute row, otherwise false.
## ```void xlnt::cell_reference::row_absolute(bool absolute_row)```
Makes this reference have an absolute row if absolute_row is true, otherwise not absolute.
## ```column_t xlnt::cell_reference::column() const```
Returns a string that identifies the column of this reference (e.g. second column from left is "B")
## ```void xlnt::cell_reference::column(const std::string &column_string)```
Sets the column of this reference from a string that identifies a particular column.
## ```column_t::index_t xlnt::cell_reference::column_index() const```
Returns a 1-indexed numeric index of the column of this reference.
## ```void xlnt::cell_reference::column_index(column_t column)```
Sets the column of this reference from a 1-indexed number that identifies a particular column.
## ```row_t xlnt::cell_reference::row() const```
Returns a 1-indexed numeric index of the row of this reference.
## ```void xlnt::cell_reference::row(row_t row)```
Sets the row of this reference from a 1-indexed number that identifies a particular row.
## ```cell_reference xlnt::cell_reference::make_offset(int column_offset, int row_offset) const```
Returns a cell_reference offset from this cell_reference by the number of columns and rows specified by the parameters. A negative value for column_offset or row_offset results in a reference above or left of this cell_reference, respectively.
## ```std::string xlnt::cell_reference::to_string() const```
Returns a string like "A1" for cell_reference(1, 1).
## ```range_reference xlnt::cell_reference::to_range() const```
Returns a 1x1 range_reference containing only this cell_reference.
## ```range_reference xlnt::cell_reference::operator,(const cell_reference &other) const```
I've always wanted to overload the comma operator. cell_reference("A", 1), cell_reference("B", 1) will return range_reference(cell_reference("A", 1), cell_reference("B", 1))
## ```bool xlnt::cell_reference::operator==(const cell_reference &comparand) const```
Returns true if this reference is identical to comparand including in absoluteness of column and row.
## ```bool xlnt::cell_reference::operator==(const std::string &reference_string) const```
Constructs a cell_reference from reference_string and return the result of their comparison.
## ```bool xlnt::cell_reference::operator==(const char *reference_string) const```
Constructs a cell_reference from reference_string and return the result of their comparison.
## ```bool xlnt::cell_reference::operator!=(const cell_reference &comparand) const```
Returns true if this reference is not identical to comparand including in absoluteness of column and row.
## ```bool xlnt::cell_reference::operator!=(const std::string &reference_string) const```
Constructs a cell_reference from reference_string and return the result of their comparison.
## ```bool xlnt::cell_reference::operator!=(const char *reference_string) const```
Constructs a cell_reference from reference_string and return the result of their comparison.

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:

1
docs/basics/Cell.md Normal file
View File

@ -0,0 +1 @@
## Cell

1
docs/basics/Iteration.md Normal file
View File

@ -0,0 +1 @@
## Iteration

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.

6
docs/basics/README.md Normal file
View File

@ -0,0 +1,6 @@
## Basics
* [Workbook](/docs/basics/Workbook.md)
* [Worksheet](/docs/basics/Worksheet.md)
* [Cell](/docs/basics/Cell.md)
* [Iteration](/docs/basics/Iteration.md)

1
docs/basics/Workbook.md Normal file
View File

@ -0,0 +1 @@
## Workbook

1
docs/basics/Worksheet.md Normal file
View File

@ -0,0 +1 @@
## Worksheet

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

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;
}

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
++++++++++

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``

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

@ -0,0 +1,195 @@
## Examples
### Simple - reading from an existing xlsx spread sheet.
The following C plus plus code will read the values from an xlsx file and print the string values to the screen. This is a very simple example to get you started.
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
int main()
{
xlnt::workbook wb;
wb.load("/home/timothymccallum/test.xlsx");
auto ws = wb.active_sheet();
std::clog << "Processing spread sheet" << std::endl;
for (auto row : ws.rows(false))
{
for (auto cell : row)
{
std::clog << cell.to_string() << std::endl;
}
}
std::clog << "Processing complete" << std::endl;
return 0;
}
```
Save the contents of the above file
```
/home/timothymccallum/process.cpp
```
Compile by typing the following command
```
g++ -std=c++14 -lxlnt process.cpp -o process
```
Excecute by typing the following command
```
./process
```
The output of the program, in my case, is as follows
```
Processing spread sheet
This is cell A1.
This is cell B1
… and this is cell C1
We are now on the second row at cell A2
B2
C2
Processing complete
```
As you can see the process.cpp file simply walks through the spread sheet values row by row and column by column (A1, B1, C1, A2, B2, C2 and so on).
### Simple - storing a spread sheet in a 2 dimensional C++ Vector for further processing
Loading a spread sheet into a Vector provides oppourtunities for you to perform high performance processing. There will be more examples on performing fast look-ups, merging data, performing deduplication and more. For now, let's just learn how to get the spread sheet loaded into memory.
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
#include <vector>
int main()
{
xlnt::workbook wb;
wb.load("/home/timothymccallum/test.xlsx");
auto ws = wb.active_sheet();
std::clog << "Processing spread sheet" << std::endl;
std::clog << "Creating a single vector which stores the whole spread sheet" << std::endl;
std::vector< std::vector<std::string> > theWholeSpreadSheet;
for (auto row : ws.rows(false))
{
std::clog << "Creating a fresh vector for just this row in the spread sheet" << std::endl;
std::vector<std::string> aSingleRow;
for (auto cell : row)
{
std::clog << "Adding this cell to the row" << std::endl;
aSingleRow.push_back(cell.to_string());
}
std::clog << "Adding this entire row to the vector which stores the whole spread sheet" << std::endl;
theWholeSpreadSheet.push_back(aSingleRow);
}
std::clog << "Processing complete" << std::endl;
std::clog << "Reading the vector and printing output to the screen" << std::endl;
for (int rowInt = 0; rowInt < theWholeSpreadSheet.size(); rowInt++)
{
for (int colInt = 0; colInt < theWholeSpreadSheet.at(rowInt).size(); colInt++)
{
std::cout << theWholeSpreadSheet.at(rowInt).at(colInt) << std::endl;
}
}
return 0;
}
```
Save the contents of the above file
```
/home/timothymccallum/process.cpp
```
Compile by typing the following command
```
g++ -std=c++14 -lxlnt process.cpp -o process
```
Excecute by typing the following command
```
./process
```
The output of the program, in my case, is as follows
```
Processing spread sheet
Creating a single vector which stores the whole spread sheet
Creating a fresh vector for just this row in the spread sheet
Adding this cell to the row
Adding this cell to the row
Adding this cell to the row
Adding this entire row to the vector which stores the whole spread sheet
Creating a fresh vector for just this row in the spread sheet
Adding this cell to the row
Adding this cell to the row
Adding this cell to the row
Adding this entire row to the vector which stores the whole spread sheet
Processing complete
Reading the vector and printing output to the screen
This is cell A1.
This is cell B1
… and this is cell C1
We are now on the second row at cell A2
B2
C2
```
You will have noticed that this process is very fast. If you type the "time" as shown below, you can measure just how fast loading and retrieving your spread sheet is, using xlnt; In this case only a fraction of a second. More on this later.
```
time ./process
...
real 0m0.044s
```
### Simple - writing values to a new xlsx spread sheet.
```c++
#include <iostream>
#include <xlnt/xlnt.hpp>
#include <vector>
#include <string>
int main()
{
//Creating a 2 dimensional vector which we will write values to
std::vector< std::vector<std::string> > wholeWorksheet;
//Looping through each row (100 rows as per the second argument in the for loop)
for (int outer = 0; outer < 100; outer++)
{
//Creating a fresh vector for a fresh row
std::vector<std::string> singleRow;
//Looping through each of the columns (100 as per the second argument in the for loop) in this particular row
for(int inner = 0; inner < 100; inner++)
{
//Adding a single value in each cell of the row
std::string val = std::to_string(inner + 1);
singleRow.push_back(val);
}
//Adding the single row to the 2 dimensional vector
wholeWorksheet.push_back(singleRow);
std::clog << "Writing to row " << outer << " in the vector " << std::endl;
}
//Writing to the spread sheet
//Creating the output workbook
std::clog << "Creating workbook" << std::endl;
xlnt::workbook wbOut;
//Setting the destination output file name
std::string dest_filename = "output.xlsx";
//Creating the output worksheet
xlnt::worksheet wsOut = wbOut.active_sheet();
//Giving the output worksheet a title/name
wsOut.title("data");
//We will now be looping through the 2 dimensional vector which we created above
//In this case we have two iterators one for the outer loop (row) and one for the inner loop (column)
std::clog << "Looping through vector and writing to spread sheet" << std::endl;
for (int fOut = 0; fOut < wholeWorksheet.size(); fOut++)
{
std::clog << "Row" << fOut << std::endl;
for (int fIn = 0; fIn < wholeWorksheet.at(fOut).size(); fIn++)
{
//Take notice of the difference between accessing the vector and accessing the work sheet
//As you may already know Excel spread sheets start at row 1 and column 1 (not row 0 and column 0 like you would expect from a C++ vector)
//In short the xlnt cell reference starts at column 1 row 1 (hence the + 1s below) and the vector reference starts at row 0 and column 0
wsOut.cell(xlnt::cell_reference(fIn + 1, fOut + 1)).value(wholeWorksheet.at(fOut).at(fIn));
//Further clarification to avoid confusion
//Cell reference arguments are (column number, row number); e.g. cell_reference(fIn + 1, fOut + 1)
//Vector arguments are (row number, column number); e.g. wholeWorksheet.at(fOut).at(fIn)
}
}
std::clog << "Finished writing spread sheet" << std::endl;
wbOut.save(dest_filename);
return 0;
}
```
This process is also quite quick; a time command showed that xlnt was able to create and write 10, 000 values to the output spread sheet in 0.582 seconds.

View File

@ -0,0 +1,54 @@
## 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 | | | |

View File

@ -0,0 +1,79 @@
# Getting xlnt
## Binaries
## Homebrew
## Arch
xlnt can be [found](https://aur.archlinux.org/packages/xlnt/) on the AUR.
## vcpkg
`vcpkg` installs x86 by default
```
.\vcpkg install xlnt
```
if you need x64 use the following command
```
.\vcpkg install xlnt:x64-windows
```
## Compiling xlnt 1.x.x from Source on Ubuntu 16.04 LTS (Xenial Xerus)
Time required: Approximately 5 minutes (depending on your internet speed)
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake
sudo apt-get install zlibc
```
The following steps update the compiler and set the appropriate environment variables - see note [1] below for the reason why we need to update the standard available compiler
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt-get upgrade
sudo apt-get install gcc-6 g++-6
export CC=/usr/bin/gcc-6
export CXX=/usr/bin/g++-6
```
The following steps will intall xlnt
```
git clone https://github.com/tfussell/xlnt.git xlnt --recurse-submodules
cd xlnt
cmake .
make -j 2
sudo make install
```
The following step will map the shared library names to the location of the corresponding shared library files
```
sudo ldconfig
```
xlnt will now be ready to use on your Ubuntu instance.
[1]
Xlnt requires a minimum of gcc 6.2.0
The most recent gcc version available using the standard APT repositories is gcc 5.4.0 (obtained through build-essential 12.1ubuntu2). If these older versions of gcc are used an error "workbook.cpp error 1502:31 'extended_property' is not a class, namespace or enumeration" will occur during the xlnt make command.
## Compiling from Source
Build configurations for Visual Studio, GNU Make, Ninja, and Xcode can be created using [cmake](https://cmake.org/) v3.2+. 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" ..
```

View File

@ -0,0 +1 @@
## Motivation

View File

@ -0,0 +1,6 @@
## Introduction
* [Motivation](Motivation.md)
* [Examples](Examples.md)
* [Features](Features.md)
* [Installation](Installation.md)

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

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

3
docs/template.ejs Normal file
View File

@ -0,0 +1,3 @@
<% for(var i = 0; i < summary.length; i++) {%>
<%- summary[i].content %>
<% } %>

100
docs/tools/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 + member.argsstring + '```');
if (member.briefdescription) {
console.log(member.briefdescription);
}
}
}
}
});

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
==================

1859
docs/xlnt.3 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -31,6 +31,7 @@
#include <xlnt/xlnt_config.hpp>
#include <xlnt/cell/cell_type.hpp>
#include <xlnt/cell/index_types.hpp>
#include <xlnt/cell/rich_text.hpp>
namespace xlnt {
@ -46,11 +47,14 @@ class font;
class format;
class number_format;
class protection;
class range;
class relationship;
class style;
class workbook;
class worksheet;
class xlsx_consumer;
class xlsx_producer;
class phonetic_pr;
struct date;
struct datetime;
@ -67,7 +71,8 @@ struct cell_impl;
} // namespace detail
/// <summary>
/// Describes cell associated properties.
/// Describes a unit of data in a worksheet at a specific coordinate and its
/// associated properties.
/// </summary>
/// <remarks>
/// Properties of interest include style, type, value, and address.
@ -84,7 +89,7 @@ public:
using type = cell_type;
/// <summary>
/// Return a map of error strings such as \#DIV/0! and their associated indices.
/// Returns a map of error strings such as \#DIV/0! and their associated indices.
/// </summary>
static const std::unordered_map<std::string, int> &error_codes();
@ -96,12 +101,12 @@ public:
// value
/// <summary>
/// Return true if value has been set and has not been cleared using cell::clear_value().
/// Returns true if value has been set and has not been cleared using cell::clear_value().
/// </summary>
bool has_value() const;
/// <summary>
/// Return the value of this cell as an instance of type T.
/// Returns the value of this cell as an instance of type T.
/// Overloads exist for most C++ fundamental types like bool, int, etc. as well
/// as for std::string and xlnt datetime types: date, time, datetime, and timedelta.
/// </summary>
@ -109,32 +114,105 @@ public:
T value() const;
/// <summary>
/// Make this cell have a value of type null.
/// Makes this cell have a value of type null.
/// All other cell attributes are retained.
/// </summary>
void clear_value();
/// <summary>
/// Set the value of this cell to the given value.
/// Overloads exist for most C++ fundamental types like bool, int, etc. as well
/// as for std::string and xlnt datetime types: date, time, datetime, and timedelta.
/// Sets the type of this cell to null.
/// </summary>
template <typename T>
void value(T value);
void value(std::nullptr_t);
/// <summary>
/// Analyze string_value to determine its type, convert it to that type,
/// Sets the value of this cell to the given boolean value.
/// </summary>
void value(bool boolean_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(int int_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(unsigned int int_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(long long int int_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(unsigned long long int int_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(float float_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(double float_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const date &date_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const time &time_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const datetime &datetime_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const timedelta &timedelta_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const std::string &string_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const char *string_value);
/// <summary>
/// Sets the value of this cell to the given value.
/// </summary>
void value(const rich_text &text_value);
/// <summary>
/// Sets the value and formatting of this cell to that of other_cell.
/// </summary>
void value(const cell other_cell);
/// <summary>
/// Analyzes string_value to determine its type, convert it to that type,
/// and set the value of this cell to that converted value.
/// </summary>
void value(const std::string &string_value, bool infer_type);
/// <summary>
/// Return the type of this cell.
/// Returns the type of this cell.
/// </summary>
type data_type() const;
/// <summary>
/// Set the type of this cell.
/// Sets the type of this cell. This should usually be done indirectly
/// by setting the value of the cell to a value of that type.
/// </summary>
void data_type(type t);
@ -142,96 +220,124 @@ public:
/// <summary>
/// There's no reason to keep a cell which has no value and is not a placeholder.
/// Return true if this cell has no value, style, isn't merged, etc.
/// Returns true if this cell has no value, style, isn't merged, etc.
/// </summary>
bool garbage_collectible() const;
/// <summary>
/// Return true iff this cell's number format matches a date format.
/// Returns true iff this cell's number format matches a date format.
/// </summary>
bool is_date() const;
// position
/// <summary>
/// Return a cell_reference that points to the location of this cell.
/// Returns a cell_reference that points to the location of this cell.
/// </summary>
cell_reference reference() const;
/// <summary>
/// Return the column of this cell.
/// Returns the column of this cell.
/// </summary>
column_t column() const;
/// <summary>
/// Return the row of this cell.
/// Returns the numeric index (A == 1) of the column of this cell.
/// </summary>
column_t::index_t column_index() const;
/// <summary>
/// Returns the row of this cell.
/// </summary>
row_t row() const;
/// <summary>
/// Return the location of this cell as an ordered pair.
/// Returns the location of this cell as an ordered pair (left, top).
/// </summary>
std::pair<int, int> anchor() const;
// hyperlink
/// <summary>
/// Return the URL of this cell's hyperlink.
/// Returns the relationship of this cell's hyperlink.
/// </summary>
std::string hyperlink() const;
class hyperlink hyperlink() const;
/// <summary>
/// Add a hyperlink to this cell pointing to the URI of the given value.
/// Adds a hyperlink to this cell pointing to the URI of the given value and sets
/// the text value of the cell to the given parameter.
/// </summary>
void hyperlink(const std::string &value);
void hyperlink(const std::string &url, const std::string &display = "");
/// <summary>
/// Return true if this cell has a hyperlink set.
/// Adds an internal hyperlink to this cell pointing to the given cell.
/// </summary>
void hyperlink(xlnt::cell target, const std::string &display = "");
/// <summary>
/// Adds an internal hyperlink to this cell pointing to the given range.
/// </summary>
void hyperlink(xlnt::range target, const std::string &display = "");
/// <summary>
/// Returns true if this cell has a hyperlink set.
/// </summary>
bool has_hyperlink() const;
// computed formatting
/// <summary>
/// Returns the result of computed_format().alignment().
/// Returns the alignment that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class alignment computed_alignment() const;
/// <summary>
/// Returns the result of computed_format().border().
/// Returns the border that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class border computed_border() const;
/// <summary>
/// Returns the result of computed_format().fill().
/// Returns the fill that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class fill computed_fill() const;
/// <summary>
/// Returns the result of computed_format().font().
/// Returns the font that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class font computed_font() const;
/// <summary>
/// Returns the result of computed_format().number_format().
/// Returns the number format that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class number_format computed_number_format() const;
/// <summary>
/// Returns the result of computed_format().protection().
/// Returns the protection that should be used when displaying this cell
/// graphically based on the workbook default, the cell-level format,
/// and the named style applied to the cell in that order.
/// </summary>
class protection computed_protection() const;
// format
/// <summary>
/// Return true if this cell has had a format applied to it.
/// Returns true if this cell has had a format applied to it.
/// </summary>
bool has_format() const;
/// <summary>
/// Return a reference to the format applied to this cell.
/// If this cell has no format, an invalid_attribute exception will be thrown.
/// Returns the format applied to this cell. If this cell has no
/// format, an invalid_attribute exception will be thrown.
/// </summary>
const class format format() const;
@ -241,7 +347,7 @@ public:
void format(const class format new_format);
/// <summary>
/// Remove the cell-level formatting from this cell.
/// Removes the cell-level formatting from this cell.
/// This doesn't affect the style that may also be applied to the cell.
/// Throws an invalid_attribute exception if no format is applied.
/// </summary>
@ -320,13 +426,19 @@ public:
/// </summary>
bool has_style() const;
/// <summary>
/// Returns a wrapper pointing to the named style applied to this cell.
/// </summary>
class style style();
/// <summary>
/// Returns a wrapper pointing to the named style applied to this cell.
/// </summary>
const class style style() const;
/// <summary>
/// Equivalent to style(new_style.name())
/// Sets the named style applied to this cell to a style named style_name.
/// Equivalent to style(new_style.name()).
/// </summary>
void style(const class style &new_style);
@ -378,120 +490,142 @@ public:
// merging
/// <summary>
/// Return true iff this cell has been merged with one or more
/// Returns true iff this cell has been merged with one or more
/// surrounding cells.
/// </summary>
bool is_merged() const;
/// <summary>
/// Make this a merged cell iff merged is true.
/// Makes this a merged cell iff merged is true.
/// Generally, this shouldn't be called directly. Instead,
/// use worksheet::merge_cells on its parent worksheet.
/// </summary>
void merged(bool merged);
// phonetics
/// <summary>
/// Return the error string that is stored in this cell.
/// Returns true if this cell is set to show phonetic information.
/// </summary>
bool phonetics_visible() const;
/// <summary>
/// Enables the display of phonetic information on this cell.
/// </summary>
void show_phonetics(bool phonetics);
/// <summary>
/// Returns the error string that is stored in this cell.
/// </summary>
std::string error() const;
/// <summary>
/// Directly assign the value of this cell to be the given error.
/// Directly assigns the value of this cell to be the given error.
/// </summary>
void error(const std::string &error);
/// <summary>
/// Return a cell from this cell's parent workbook at
/// Returns a cell from this cell's parent workbook at
/// a relative offset given by the parameters.
/// </summary>
cell offset(int column, int row);
/// <summary>
/// Return the worksheet that owns this cell.
/// Returns the worksheet that owns this cell.
/// </summary>
class worksheet worksheet();
/// <summary>
/// Return the worksheet that owns this cell.
/// Returns the worksheet that owns this cell.
/// </summary>
const class worksheet worksheet() const;
/// <summary>
/// Return the workbook of the worksheet that owns this cell.
/// Returns the workbook of the worksheet that owns this cell.
/// </summary>
class workbook &workbook();
/// <summary>
/// Return the workbook of the worksheet that owns this cell.
/// Returns the workbook of the worksheet that owns this cell.
/// </summary>
const class workbook &workbook() const;
/// <summary>
/// Shortcut to return the base date of the parent workbook.
/// Equivalent to workbook().properties().excel_base_date
/// Returns the base date of the parent workbook.
/// </summary>
calendar base_date() const;
/// <summary>
/// Return to_check after checking encoding, size, and illegal characters.
/// Returns to_check after verifying and fixing encoding, size, and illegal characters.
/// </summary>
std::string check_string(const std::string &to_check);
// comment
/// <summary>
/// Return true if this cell has a comment applied.
/// Returns true if this cell has a comment applied.
/// </summary>
bool has_comment();
/// <summary>
/// Delete the comment applied to this cell if it exists.
/// Deletes the comment applied to this cell if it exists.
/// </summary>
void clear_comment();
/// <summary>
/// Get the comment applied to this cell.
/// Gets the comment applied to this cell.
/// </summary>
class comment comment();
/// <summary>
/// Create a new comment with the given text and optional author and apply it to the cell.
/// Creates a new comment with the given text and optional author and
/// applies it to the cell.
/// </summary>
void comment(const std::string &text, const std::string &author = "Microsoft Office User");
void comment(const std::string &text,
const std::string &author = "Microsoft Office User");
/// <summary>
/// Create a new comment with the given text, formatting, and optional author and apply it to the cell.
/// Creates a new comment with the given text, formatting, and optional
/// author and applies it to the cell.
/// </summary>
void comment(const std::string &comment_text, const class font &comment_font, const std::string &author = "Microsoft Office User");
void comment(const std::string &comment_text,
const class font &comment_font,
const std::string &author = "Microsoft Office User");
/// <summary>
/// Apply the comment provided as the only argument to the cell.
/// </summary>
void comment(const class comment &new_comment);
/// <summary>
/// Returns the width of this cell in pixels.
/// </summary>
double width() const;
/// <summary>
/// Returns the height of this cell in pixels.
/// </summary>
double height() const;
// operators
/// <summary>
/// Make this cell point to rhs.
/// The cell originally pointed to by this cell will be unchanged.
/// Makes this cell interally point to rhs.
/// The cell data originally pointed to by this cell will be unchanged.
/// </summary>
cell &operator=(const cell &rhs);
/// <summary>
/// Return true if this cell the same cell as comparand (compare by reference).
/// Returns true if this cell the same cell as comparand (compared by reference).
/// </summary>
bool operator==(const cell &comparand) const;
/// <summary>
/// Return true if this cell is uninitialized.
/// Returns false if this cell the same cell as comparand (compared by reference).
/// </summary>
bool operator==(std::nullptr_t) const;
bool operator!=(const cell &comparand) const;
private:
// make these friends so they can use the private constructor
friend class style;
friend class worksheet;
friend class detail::xlsx_consumer;
@ -505,7 +639,7 @@ private:
class format modifiable_format();
/// <summary>
/// Delete default zero-argument constructor.
/// Delete the default zero-argument constructor.
/// </summary>
cell() = delete;
@ -521,14 +655,58 @@ private:
};
/// <summary>
/// Return true if this cell is uninitialized.
/// Returns true if this cell is uninitialized.
/// </summary>
XLNT_API bool operator==(std::nullptr_t, const cell &cell);
/// <summary>
/// Returns true if this cell is uninitialized.
/// </summary>
XLNT_API bool operator==(const cell &cell, std::nullptr_t);
/// <summary>
/// Convenience function for writing cell to an ostream.
/// Uses cell::to_string() internally.
/// </summary>
XLNT_API std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell);
template <>
bool cell::value<bool>() const;
template <>
int cell::value<int>() const;
template <>
unsigned int cell::value<unsigned int>() const;
template <>
long long int cell::value<long long int>() const;
template <>
unsigned long long cell::value<unsigned long long int>() const;
template <>
float cell::value<float>() const;
template <>
double cell::value<double>() const;
template <>
date cell::value<date>() const;
template <>
time cell::value<time>() const;
template <>
datetime cell::value<datetime>() const;
template <>
timedelta cell::value<timedelta>() const;
template <>
std::string cell::value<std::string>() const;
template <>
rich_text cell::value<rich_text>() const;
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -23,13 +23,15 @@
#pragma once
#include <cstdint>
#include <string>
#include <utility>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/cell/index_types.hpp>
#include <cstdint>
#include <functional>
#include <string>
#include <tuple>
#include <utility>
namespace xlnt {
class cell_reference;
@ -42,7 +44,7 @@ class range_reference;
struct XLNT_API cell_reference_hash
{
/// <summary>
///
/// Returns a hash representing a particular cell_reference.
/// </summary>
std::size_t operator()(const cell_reference &k) const;
};
@ -58,12 +60,12 @@ class XLNT_API cell_reference
{
public:
/// <summary>
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// </summary>
static std::pair<std::string, row_t> split_reference(const std::string &reference_string);
/// <summary>
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// Reference parameters absolute_column and absolute_row will be set to true
/// if column part or row part are prefixed by a dollar-sign indicating they
/// are absolute, otherwise false.
@ -98,7 +100,7 @@ public:
// absoluteness
/// <summary>
/// Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
/// Converts a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
/// Defaulting to true, absolute_column and absolute_row can optionally control
/// whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12)
/// and absolute row (e.g. B12 -> B$12) respectively.
@ -113,23 +115,23 @@ public:
cell_reference &make_absolute(bool absolute_column = true, bool absolute_row = true);
/// <summary>
/// Return true if the reference refers to an absolute column, otherwise false.
/// Returns true if the reference refers to an absolute column, otherwise false.
/// </summary>
bool column_absolute() const;
/// <summary>
/// Make this reference have an absolute column if absolute_column is true,
/// Makes this reference have an absolute column if absolute_column is true,
/// otherwise not absolute.
/// </summary>
void column_absolute(bool absolute_column);
/// <summary>
/// Return true if the reference refers to an absolute row, otherwise false.
/// Returns true if the reference refers to an absolute row, otherwise false.
/// </summary>
bool row_absolute() const;
/// <summary>
/// Make this reference have an absolute row if absolute_row is true,
/// Makes this reference have an absolute row if absolute_row is true,
/// otherwise not absolute.
/// </summary>
void row_absolute(bool absolute_row);
@ -137,38 +139,38 @@ public:
// getters/setters
/// <summary>
/// Return a string that identifies the column of this reference
/// Returns a string that identifies the column of this reference
/// (e.g. second column from left is "B")
/// </summary>
column_t column() const;
/// <summary>
/// Set the column of this reference from a string that identifies a particular column.
/// Sets the column of this reference from a string that identifies a particular column.
/// </summary>
void column(const std::string &column_string);
/// <summary>
/// Return a 1-indexed numeric index of the column of this reference.
/// Returns a 1-indexed numeric index of the column of this reference.
/// </summary>
column_t::index_t column_index() const;
/// <summary>
/// Set the column of this reference from a 1-indexed number that identifies a particular column.
/// Sets the column of this reference from a 1-indexed number that identifies a particular column.
/// </summary>
void column_index(column_t column);
/// <summary>
/// Return a 1-indexed numeric index of the row of this reference.
/// Returns a 1-indexed numeric index of the row of this reference.
/// </summary>
row_t row() const;
/// <summary>
/// Set the row of this reference from a 1-indexed number that identifies a particular row.
/// Sets the row of this reference from a 1-indexed number that identifies a particular row.
/// </summary>
void row(row_t row);
/// <summary>
/// Return a cell_reference offset from this cell_reference by
/// Returns a cell_reference offset from this cell_reference by
/// the number of columns and rows specified by the parameters.
/// A negative value for column_offset or row_offset results
/// in a reference above or left of this cell_reference, respectively.
@ -176,12 +178,12 @@ public:
cell_reference make_offset(int column_offset, int row_offset) const;
/// <summary>
/// Return a string like "A1" for cell_reference(1, 1).
/// Returns a string like "A1" for cell_reference(1, 1).
/// </summary>
std::string to_string() const;
/// <summary>
/// Return a 1x1 range_reference containing only this cell_reference.
/// Returns a 1x1 range_reference containing only this cell_reference.
/// </summary>
range_reference to_range() const;
@ -195,37 +197,37 @@ public:
range_reference operator,(const cell_reference &other) const;
/// <summary>
/// Return true if this reference is identical to comparand including
/// Returns true if this reference is identical to comparand including
/// in absoluteness of column and row.
/// </summary>
bool operator==(const cell_reference &comparand) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// Constructs a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator==(const std::string &reference_string) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// Constructs a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator==(const char *reference_string) const;
/// <summary>
/// Return true if this reference is not identical to comparand including
/// Returns true if this reference is not identical to comparand including
/// in absoluteness of column and row.
/// </summary>
bool operator!=(const cell_reference &comparand) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// Constructs a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator!=(const std::string &reference_string) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// Constructs a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator!=(const char *reference_string) const;
@ -255,3 +257,16 @@ private:
};
} // namespace xlnt
namespace std {
template <>
struct hash<xlnt::cell_reference>
{
size_t operator()(const xlnt::cell_reference &x) const
{
static_assert(std::is_same<decltype(x.row()), std::uint32_t>::value, "this hash function expects both row and column to be 32-bit numbers");
static_assert(std::is_same<decltype(x.column_index()), std::uint32_t>::value, "this hash function expects both row and column to be 32-bit numbers");
return hash<std::uint64_t>{}(x.row() | static_cast<std::uint64_t>(x.column_index()) << 32);
}
};
} // namespace std

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -26,6 +26,10 @@
#include <xlnt/xlnt_config.hpp>
/// <summary>
/// Enumerates the possible types a cell can be determined by it's current value.
/// </summary>
namespace xlnt {
/// <summary>
@ -33,18 +37,22 @@ namespace xlnt {
/// </summary>
enum class XLNT_API cell_type
{
/// no value. note: this is different from an empty string value or 0 numeric value
null,
/// number
numeric,
/// string
string,
/// value is a formula
formula,
/// no value
empty,
/// value is TRUE or FALSE
boolean,
/// value is an ISO 8601 formatted date
date,
/// value is a known error code such as \#VALUE!
error,
/// value is TRUE or FALSE
boolean
/// value is a string stored in the cell
inline_string,
/// value is a number
number,
/// value is a string shared with other cells to save space
shared_string,
/// value is the string result of a formula
formula_string
};
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -52,27 +52,27 @@ public:
comment(const std::string &text, const std::string &author);
/// <summary>
/// Return the text that will be displayed for this comment.
/// Returns the text that will be displayed for this comment.
/// </summary>
rich_text text() const;
/// <summary>
/// Return the plain text that will be displayed for this comment without formatting information.
/// Returns the plain text that will be displayed for this comment without formatting information.
/// </summary>
std::string plain_text() const;
/// <summary>
/// Return the author of this comment.
/// Returns the author of this comment.
/// </summary>
std::string author() const;
/// <summary>
/// Make this comment only visible when the associated cell is hovered.
/// Makes this comment only visible when the associated cell is hovered.
/// </summary>
void hide();
/// <summary>
/// Make this comment always visible.
/// Makes this comment always visible.
/// </summary>
void show();
@ -82,7 +82,7 @@ public:
bool visible() const;
/// <summary>
/// Set the absolute position of this cell to the given coordinates.
/// Sets the absolute position of this cell to the given coordinates.
/// </summary>
void position(int left, int top);
@ -97,7 +97,7 @@ public:
int top() const;
/// <summary>
/// Set the size of the comment.
/// Sets the size of the comment.
/// </summary>
void size(int width, int height);
@ -112,9 +112,14 @@ public:
int height() const;
/// <summary>
/// Return true if both comments are equivalent.
/// Return true if this comment is equivalent to other.
/// </summary>
friend XLNT_API bool operator==(const comment &left, const comment &right);
bool operator==(const comment &other) const;
/// <summary>
/// Returns true if this comment is not equivalent to other.
/// </summary>
bool operator!=(const comment &other) const;
private:
/// <summary>
@ -150,12 +155,12 @@ private:
/// <summary>
/// Width of the comment box.
/// </summary>
int width_ = 0;
int width_ = 200;
/// <summary>
/// Height of the comment box.
/// </summary>
int height_ = 0;
int height_ = 100;
};
} // namespace xlnt

View File

@ -0,0 +1,70 @@
// Copyright (c) 2018 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <xlnt/xlnt_config.hpp>
#include <string>
namespace xlnt {
namespace detail {
struct hyperlink_impl;
}
class cell;
class range;
class relationship;
/// <summary>
/// Describes a hyperlink pointing from a cell to another cell or a URL.
/// </summary>
class XLNT_API hyperlink
{
public:
bool external() const;
class relationship relationship() const;
// external target
std::string url() const;
// internal target
std::string target_range() const;
bool has_display() const;
void display(const std::string &value);
const std::string &display() const;
bool has_tooltip() const;
void tooltip(const std::string &value);
const std::string &tooltip() const;
bool has_location() const;
void location(const std::string &value);
const std::string &location() const;
private:
friend class cell;
hyperlink(detail::hyperlink_impl *d);
detail::hyperlink_impl *d_;
};
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -48,7 +48,7 @@ class XLNT_API column_t
{
public:
/// <summary>
///
/// Alias declaration for the internal numeric type of this column.
/// </summary>
using index_t = std::uint32_t;
@ -73,237 +73,192 @@ public:
static std::string column_string_from_index(index_t column_index);
/// <summary>
/// Default column_t is the first (left-most) column.
/// Default constructor. The column points to the "A" column.
/// </summary>
column_t();
/// <summary>
/// Construct a column from a number.
/// Constructs a column from a number.
/// </summary>
column_t(index_t column_index);
/// <summary>
/// Construct a column from a string.
/// Constructs a column from a string.
/// </summary>
column_t(const std::string &column_string);
/// <summary>
/// Construct a column from a string.
/// Constructs a column from a string.
/// </summary>
column_t(const char *column_string);
/// <summary>
/// Copy constructor
/// </summary>
column_t(const column_t &other);
/// <summary>
/// Move constructor
/// </summary>
column_t(column_t &&other);
/// <summary>
/// Return a string representation of this column index.
/// Returns a string representation of this column index.
/// </summary>
std::string column_string() const;
/// <summary>
/// Set this column to be the same as rhs's and return reference to self.
/// </summary>
column_t &operator=(column_t rhs);
/// <summary>
/// Set this column to be equal to rhs and return reference to self.
/// Sets this column to be equal to rhs and return reference to self.
/// </summary>
column_t &operator=(const std::string &rhs);
/// <summary>
/// Set this column to be equal to rhs and return reference to self.
/// Sets this column to be equal to rhs and return reference to self.
/// </summary>
column_t &operator=(const char *rhs);
/// <summary>
/// Return true if this column refers to the same column as other.
/// Returns true if this column refers to the same column as other.
/// </summary>
bool operator==(const column_t &other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// Returns true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(const column_t &other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// Returns true if this column refers to the same column as other.
/// </summary>
bool operator==(int other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// Returns true if this column refers to the same column as other.
/// </summary>
bool operator==(index_t other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// Returns true if this column refers to the same column as other.
/// </summary>
bool operator==(const std::string &other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// Returns true if this column refers to the same column as other.
/// </summary>
bool operator==(const char *other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// Returns true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(int other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// Returns true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(index_t other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// Returns true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(const std::string &other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// Returns true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(const char *other) const;
/// <summary>
/// Return true if other is to the right of this column.
/// Returns true if other is to the right of this column.
/// </summary>
bool operator>(const column_t &other) const;
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// Returns true if other is to the right of or equal to this column.
/// </summary>
bool operator>=(const column_t &other) const;
/// <summary>
/// Return true if other is to the left of this column.
/// Returns true if other is to the left of this column.
/// </summary>
bool operator<(const column_t &other) const;
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// Returns true if other is to the left of or equal to this column.
/// </summary>
bool operator<=(const column_t &other) const;
/// <summary>
/// Return true if other is to the right of this column.
/// Returns true if other is to the right of this column.
/// </summary>
bool operator>(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// Returns true if other is to the right of or equal to this column.
/// </summary>
bool operator>=(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the left of this column.
/// Returns true if other is to the left of this column.
/// </summary>
bool operator<(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// Returns true if other is to the left of or equal to this column.
/// </summary>
bool operator<=(const column_t::index_t &other) const;
/// <summary>
/// Pre-increment this column, making it point to the column one to the right.
/// Pre-increments this column, making it point to the column one to the right and returning a reference to it.
/// </summary>
column_t &operator++();
/// <summary>
/// Pre-deccrement this column, making it point to the column one to the left.
/// Pre-deccrements this column, making it point to the column one to the left and returning a reference to it.
/// </summary>
column_t &operator--();
/// <summary>
/// Post-increment this column, making it point to the column one to the right and returning the old column.
/// Post-increments this column, making it point to the column one to the right and returning the old column.
/// </summary>
column_t operator++(int);
/// <summary>
/// Post-decrement this column, making it point to the column one to the left and returning the old column.
/// Post-decrements this column, making it point to the column one to the left and returning the old column.
/// </summary>
column_t operator--(int);
/// <summary>
/// Return the result of adding rhs to this column.
/// Returns the result of adding rhs to this column.
/// </summary>
friend XLNT_API column_t operator+(column_t lhs, const column_t &rhs);
/// <summary>
/// Return the result of subtracing lhs by rhs column.
/// Returns the result of subtracing lhs by rhs column.
/// </summary>
friend XLNT_API column_t operator-(column_t lhs, const column_t &rhs);
/// <summary>
/// Return the result of multiply lhs by rhs column.
/// </summary>
friend XLNT_API column_t operator*(column_t lhs, const column_t &rhs);
/// <summary>
/// Return the result of divide lhs by rhs column.
/// </summary>
friend XLNT_API column_t operator/(column_t lhs, const column_t &rhs);
/// <summary>
/// Return the result of mod lhs by rhs column.
/// </summary>
friend XLNT_API column_t operator%(column_t lhs, const column_t &rhs);
/// <summary>
/// Add rhs to this column and return a reference to this column.
/// Adds rhs to this column and returns a reference to this column.
/// </summary>
column_t &operator+=(const column_t &rhs);
/// <summary>
/// Subtrac rhs from this column and return a reference to this column.
/// Subtracts rhs from this column and returns a reference to this column.
/// </summary>
column_t &operator-=(const column_t &rhs);
/// <summary>
/// Multiply this column by rhs and return a reference to this column.
/// </summary>
column_t &operator*=(const column_t &rhs);
/// <summary>
/// Divide this column by rhs and return a reference to this column.
/// </summary>
column_t &operator/=(const column_t &rhs);
/// <summary>
/// Mod this column by rhs and return a reference to this column.
/// </summary>
column_t &operator%=(const column_t &rhs);
/// <summary>
/// Return true if other is to the right of this column.
/// Returns true if other is to the right of this column.
/// </summary>
friend XLNT_API bool operator>(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// Returns true if other is to the right of or equal to this column.
/// </summary>
friend XLNT_API bool operator>=(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the left of this column.
/// Returns true if other is to the left of this column.
/// </summary>
friend XLNT_API bool operator<(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// Returns true if other is to the left of or equal to this column.
/// </summary>
friend XLNT_API bool operator<=(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Swap the columns that left and right refer to.
/// Swaps the columns that left and right refer to.
/// </summary>
friend XLNT_API void swap(column_t &left, column_t &right);
@ -313,14 +268,20 @@ public:
index_t index;
};
enum class row_or_col_t : int
{
row,
column
};
/// <summary>
/// Functor for hashing a column.
/// Allows for use of std::unordered_set<column, column_hash> and similar.
/// Allows for use of std::unordered_set<column_t, column_hash> and similar.
/// </summary>
struct XLNT_API column_hash
{
/// <summary>
///
/// Returns the result of hashing column k.
/// </summary>
std::size_t operator()(const column_t &k) const;
};
@ -336,7 +297,7 @@ template <>
struct hash<xlnt::column_t>
{
/// <summary>
///
/// Returns the result of hashing column k.
/// </summary>
size_t operator()(const xlnt::column_t &k) const
{

View File

@ -1,5 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
// Copyright (c) 2016-2020
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -15,7 +14,7 @@
// 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,
// 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
//
@ -24,23 +23,24 @@
#pragma once
#include <string>
#include <xlnt/xlnt_config.hpp>
namespace xlnt {
/// <summary>
/// Text can be aligned horizontally in these enumerated ways.
/// Encapsulates a run of text that
/// </summary>
enum class XLNT_API horizontal_alignment
struct XLNT_API phonetic_run
{
general,
left,
center,
right,
fill,
justify,
center_continuous,
distributed
std::string text;
uint32_t start;
uint32_t end;
bool preserve_space;
bool operator==(const phonetic_run &other) const;
bool operator!=(const phonetic_run &other) const;
};
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016 Thomas Fussell
// Copyright (c) 2016-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -27,7 +27,9 @@
#include <vector>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/cell/phonetic_run.hpp>
#include <xlnt/cell/rich_text_run.hpp>
#include <xlnt/worksheet/phonetic_pr.hpp>
namespace xlnt {
@ -39,38 +41,43 @@ class XLNT_API rich_text
{
public:
/// <summary>
///
/// Constructs an empty rich text object with no font and empty text.
/// </summary>
rich_text() = default;
/// <summary>
///
/// Constructs a rich text object with the given text and no font.
/// </summary>
rich_text(const std::string &plain_text);
/// <summary>
///
/// Constructs a rich text object from other
/// </summary>
rich_text(const rich_text &other);
/// <summary>
/// Constructs a rich text object with the given text and font.
/// </summary>
rich_text(const std::string &plain_text, const class font &text_font);
/// <summary>
///
/// Copy constructor.
/// </summary>
rich_text(const rich_text_run &single_run);
/// <summary>
/// Remove all text runs from this text.
/// Removes all text runs from this text.
/// </summary>
void clear();
/// <summary>
/// Clear any runs in this text and add a single run with default formatting and
/// Clears any runs in this text and adds a single run with default formatting and
/// the given string as its textual content.
/// </summary>
void plain_text(const std::string &s);
void plain_text(const std::string &s, bool preserve_space);
/// <summary>
/// Combine the textual content of each text run in order and return the result.
/// Combines the textual content of each text run in order and returns the result.
/// </summary>
std::string plain_text() const;
@ -80,30 +87,93 @@ public:
std::vector<rich_text_run> runs() const;
/// <summary>
/// Set the runs of this text all at once.
/// Sets the runs of this text all at once.
/// </summary>
void runs(const std::vector<rich_text_run> &new_runs);
/// <summary>
/// Add a new run to the end of the set of runs.
/// Adds a new run to the end of the set of runs.
/// </summary>
void add_run(const rich_text_run &t);
/// <summary>
/// Returns a copy of the individual runs that comprise this text.
/// </summary>
std::vector<phonetic_run> phonetic_runs() const;
/// <summary>
/// Sets the runs of this text all at once.
/// </summary>
void phonetic_runs(const std::vector<phonetic_run> &new_phonetic_runs);
/// <summary>
/// Adds a new run to the end of the set of runs.
/// </summary>
void add_phonetic_run(const phonetic_run &t);
/// <summary>
/// Returns true if this text has phonetic properties
/// </summary>
bool has_phonetic_properties() const;
/// <summary>
/// Returns the phonetic properties of this text.
/// </summary>
const phonetic_pr &phonetic_properties() const;
/// <summary>
/// Sets the phonetic properties of this text to phonetic_props
/// </summary>
void phonetic_properties(const phonetic_pr &phonetic_props);
/// <summary>
/// Copies rich text object from other
/// </summary>
rich_text &operator=(const rich_text &rhs);
/// <summary>
/// Returns true if the runs that make up this text are identical to those in rhs.
/// </summary>
bool operator==(const rich_text &rhs) const;
/// <summary>
/// Returns true if the runs that make up this text are identical to those in rhs.
/// </summary>
bool operator!=(const rich_text &rhs) const;
/// <summary>
/// Returns true if this text has a single unformatted run with text equal to rhs.
/// </summary>
bool operator==(const std::string &rhs) const;
/// <summary>
/// Returns true if this text has a single unformatted run with text equal to rhs.
/// </summary>
bool operator!=(const std::string &rhs) const;
private:
/// <summary>
///
/// The runs that make up this rich text.
/// </summary>
std::vector<rich_text_run> runs_;
std::vector<phonetic_run> phonetic_runs_;
optional<phonetic_pr> phonetic_properties_;
};
class XLNT_API rich_text_hash
{
public:
std::size_t operator()(const rich_text &k) const
{
std::size_t res = 0;
for (auto r : k.runs())
{
res ^= std::hash<std::string>()(r.first);
}
return res;
}
};
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016 Thomas Fussell
// Copyright (c) 2016-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -31,6 +31,18 @@
namespace xlnt {
using rich_text_run = std::pair<std::string, optional<font>>;
/// <summary>
/// Typedef a rich_text_run as a pair of string and optional font.
/// </summary>
struct XLNT_API rich_text_run
{
std::string first;
optional<font> second;
bool preserve_space;
bool operator==(const rich_text_run &other) const;
bool operator!=(const rich_text_run &other) const;
};
} // namespace xlnt

View File

@ -0,0 +1,59 @@
// Copyright (c) 2018
//
// 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <xlnt/xlnt_config.hpp>
#include <string>
#include <vector>
namespace xml {
class parser;
class serializer;
} // namespace xml
namespace xlnt {
class worksheet;
namespace drawing {
/// <summary>
/// The spreadsheet_drawing class encapsulates the information
/// captured from objects within the spreadsheetDrawing schema.
/// </summary>
class XLNT_API spreadsheet_drawing
{
public:
spreadsheet_drawing(xml::parser &parser);
void serialize(xml::serializer &serializer);
std::vector<std::string> get_embed_ids();
private:
std::string serialized_value_;
std::vector<std::string> embed_ids_;
};
} // namespace drawing
} // namespace xlnt

View File

@ -0,0 +1,79 @@
// Copyright (c) 2014-2021 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <xlnt/xlnt_config.hpp>
#include <xlnt/packaging/uri.hpp>
#include <string>
#include <vector>
namespace xml {
class parser;
class serializer;
} // namespace xml
namespace xlnt {
/// <summary>
/// A list of xml extensions that may or may not be understood by the parser
/// preservation is required for round-tripping even if extension is not understood
/// [serialised: extLst]
/// </summary>
class XLNT_API ext_list
{
public:
struct ext
{
ext(xml::parser &parser, const std::string &ns);
ext(const uri &ID, const std::string &serialised);
void serialise(xml::serializer &serialiser, const std::string &ns);
uri extension_ID_;
std::string serialised_value_;
};
ext_list() = default; // default ctor required by xlnt::optional
explicit ext_list(xml::parser &parser, const std::string &ns);
void serialize(xml::serializer &serialiser, const std::string &ns);
void add_extension(const uri &ID, const std::string &element);
bool has_extension(const uri &extension_uri) const;
const ext &extension(const uri &extension_uri) const;
const std::vector<ext> &extensions() const;
bool operator==(const ext_list &rhs) const;
private:
std::vector<ext> extensions_;
};
inline bool operator==(const ext_list::ext &lhs, const ext_list::ext &rhs)
{
return lhs.extension_ID_ == rhs.extension_ID_
&& lhs.serialised_value_ == rhs.serialised_value_;
}
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -92,19 +92,22 @@ public:
path canonicalize(const std::vector<xlnt::relationship> &rels) const;
/// <summary>
///
/// Registers a new relationship by specifying all of the relationship properties explicitly.
/// </summary>
std::string register_relationship(const uri &source, relationship_type type, const uri &target, target_mode mode);
/// <summary>
///
/// Registers a new relationship already constructed elsewhere.
/// </summary>
std::string register_relationship(const class relationship &rel);
/// <summary>
///
/// Delete the relationship with the given id from source part. Returns a mapping
/// of relationship IDs since IDs are shifted down. For example, if there are three
/// relationships for part a.xml like [rId1, rId2, rId3] and rId2 is deleted, the
/// resulting map would look like [rId3->rId2].
/// </summary>
void unregister_relationship(const uri &source, const std::string &rel_id);
std::unordered_map<std::string, std::string> unregister_relationship(const uri &source, const std::string &rel_id);
// Content Types
@ -169,24 +172,26 @@ public:
/// </summary>
void unregister_override_type(const path &part);
bool operator==(const manifest &other) const;
private:
/// <summary>
///
/// Returns the lowest rId for the given part that hasn't already been registered.
/// </summary>
std::string next_relationship_id(const path &part) const;
/// <summary>
///
/// The map of extensions to default content types.
/// </summary>
std::unordered_map<std::string, std::string> default_content_types_;
/// <summary>
///
/// The map of package parts to overriding content types.
/// </summary>
std::unordered_map<path, std::string> override_content_types_;
/// <summary>
///
/// The map of package parts to their registered relationships.
/// </summary>
std::unordered_map<path, std::unordered_map<std::string, xlnt::relationship>> relationships_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -72,7 +72,6 @@ enum class XLNT_API relationship_type
dialogsheet,
drawings,
external_workbook_references,
metadata,
pivot_table,
pivot_table_cache_definition,
pivot_table_cache_records,
@ -89,6 +88,7 @@ enum class XLNT_API relationship_type
vml_drawing,
volatile_dependencies,
worksheet,
vbaproject,
// Worksheet parts
hyperlink,
@ -103,20 +103,20 @@ class XLNT_API relationship
{
public:
/// <summary>
///
/// Constructs a new empty relationship.
/// </summary>
relationship();
/// <summary>
///
/// Constructs a new relationship by specifying all of its properties.
/// </summary>
relationship(
const std::string &id, relationship_type t, const uri &source, const uri &target, xlnt::target_mode mode);
relationship(const std::string &id, relationship_type t, const uri &source,
const uri &target, xlnt::target_mode mode);
/// <summary>
/// Returns a string of the form rId# that identifies the relationship.
/// </summary>
std::string id() const;
const std::string &id() const;
/// <summary>
/// Returns the type of this relationship.
@ -131,12 +131,12 @@ public:
/// <summary>
/// Returns the URI of the package part this relationship points to.
/// </summary>
uri source() const;
const uri &source() const;
/// <summary>
/// Returns the URI of the package part this relationship points to.
/// </summary>
uri target() const;
const uri &target() const;
/// <summary>
/// Returns true if and only if rhs is equal to this relationship.
@ -150,27 +150,27 @@ public:
private:
/// <summary>
///
/// The id of this relationship in the format "rId#"
/// </summary>
std::string id_;
/// <summary>
///
/// The type of this relationship.
/// </summary>
relationship_type type_;
/// <summary>
///
/// The URI of the source of this relationship.
/// </summary>
uri source_;
/// <summary>
///
/// The URI of the target of this relationshp.
/// </summary>
uri target_;
/// <summary>
///
/// Whether the target of this relationship is internal or external.
/// </summary>
xlnt::target_mode mode_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -31,194 +31,207 @@
namespace xlnt {
/// <summary>
///
/// Encapsulates a uniform resource identifier (URI) as described
/// by RFC 3986.
/// </summary>
class XLNT_API uri
{
public:
/// <summary>
///
/// Constructs an empty URI.
/// </summary>
uri();
/// <summary>
///
/// Constructs a URI by combining base with relative.
/// </summary>
uri(const uri &base, const uri &relative);
/// <summary>
///
/// Constructs a URI by combining base with relative path.
/// </summary>
uri(const uri &base, const path &relative);
/// <summary>
///
/// Constructs a URI by parsing the given uri_string.
/// </summary>
uri(const std::string &uri_string);
/// <summary>
///
/// Returns true if this URI is relative.
/// </summary>
bool is_relative() const;
/// <summary>
///
/// Returns true if this URI is not relative (i.e. absolute).
/// </summary>
bool is_absolute() const;
/// <summary>
///
/// Returns the scheme of this URI.
/// E.g. the scheme of http://user:pass@example.com is "http"
/// </summary>
std::string scheme() const;
/// <summary>
///
/// Returns the authority of this URI.
/// E.g. the authority of http://user:pass@example.com:80/document is "user:pass@example.com:80"
/// </summary>
std::string authority() const;
/// <summary>
///
/// Returns true if an authentication section is specified for this URI.
/// </summary>
bool has_authentication() const;
/// <summary>
///
/// Returns the authentication of this URI.
/// E.g. the authentication of http://user:pass@example.com is "user:pass"
/// </summary>
std::string authentication() const;
/// <summary>
///
/// Returns the username of this URI.
/// E.g. the username of http://user:pass@example.com is "user"
/// </summary>
std::string username() const;
/// <summary>
///
/// Returns the password of this URI.
/// E.g. the password of http://user:pass@example.com is "pass"
/// </summary>
std::string password() const;
/// <summary>
///
/// Returns the host of this URI.
/// E.g. the host of http://example.com:80/document is "example.com"
/// </summary>
std::string host() const;
/// <summary>
///
/// Returns true if a non-default port is specified for this URI.
/// </summary>
bool has_port() const;
/// <summary>
///
/// Returns the port of this URI.
/// E.g. the port of https://example.com:443/document is "443"
/// </summary>
std::size_t port() const;
/// <summary>
///
/// Returns the path of this URI.
/// E.g. the path of http://example.com/document is "/document"
/// </summary>
class path path() const;
const class path &path() const;
/// <summary>
///
/// Returns true if this URI has a non-null query string section.
/// </summary>
bool has_query() const;
/// <summary>
///
/// Returns the query string of this URI.
/// E.g. the query of http://example.com/document?v=1&x=3#abc is "v=1&x=3"
/// </summary>
std::string query() const;
/// <summary>
///
/// Returns true if this URI has a non-empty fragment section.
/// </summary>
bool has_fragment() const;
/// <summary>
///
/// Returns the fragment section of this URI.
/// E.g. the fragment of http://example.com/document#abc is "abc"
/// </summary>
std::string fragment() const;
/// <summary>
///
/// Returns a string representation of this URI.
/// </summary>
std::string to_string() const;
/// <summary>
///
/// If this URI is relative, an absolute URI will be returned by appending
/// the path to the given absolute base URI.
/// </summary>
uri make_absolute(const uri &base);
/// <summary>
///
/// If this URI is absolute, a relative URI will be returned by removing the
/// common base path from the given absolute base URI.
/// </summary>
uri make_reference(const uri &base);
/// <summary>
///
/// Returns true if this URI is equivalent to other.
/// </summary>
friend XLNT_API bool operator==(const uri &left, const uri &right);
bool operator==(const uri &other) const;
private:
/// <summary>
///
/// True if this URI is absolute.
/// </summary>
bool absolute_ = false;
/// <summary>
///
/// The scheme, like "http"
/// </summary>
std::string scheme_;
/// <summary>
///
/// True if this URI has an authentication section.
/// </summary>
bool has_authentication_ = false;
/// <summary>
///
/// The username
/// </summary>
std::string username_;
/// <summary>
///
/// The password
/// </summary>
std::string password_;
/// <summary>
///
/// The host
/// </summary>
std::string host_;
/// <summary>
///
/// True if this URI has a non-default port specified
/// </summary>
bool has_port_ = false;
/// <summary>
///
/// The numeric port
/// </summary>
std::size_t port_ = 0;
/// <summary>
///
/// True if this URI has a query section
/// </summary>
bool has_query_ = false;
/// <summary>
///
/// The query section
/// </summary>
std::string query_;
/// <summary>
///
/// True if this URI has a fragment section
/// </summary>
bool has_fragment_ = false;
/// <summary>
///
/// The fragment section
/// </summary>
std::string fragment_;
/// <summary>
///
/// The path section
/// </summary>
class path path_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -25,97 +25,143 @@
#pragma once
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/horizontal_alignment.hpp>
#include <xlnt/styles/vertical_alignment.hpp>
#include <xlnt/utils/optional.hpp>
namespace xlnt {
/// <summary>
/// Alignment options for use in cell formats.
/// Text can be aligned horizontally within a cell in these enumerated ways.
/// </summary>
enum class XLNT_API horizontal_alignment
{
general,
left,
center,
right,
fill,
justify,
center_continuous,
distributed
};
/// <summary>
/// Text can be aligned vertically within a cell in these enumerated ways.
/// </summary>
enum class XLNT_API vertical_alignment
{
top,
center,
bottom,
justify,
distributed
};
/// <summary>
/// Alignment options that determine how text should be displayed within a cell.
/// </summary>
class XLNT_API alignment
{
public:
/// <summary>
///
/// Returns true if shrink-to-fit has been enabled.
/// </summary>
bool shrink() const;
/// <summary>
///
/// Sets whether the font size should be reduced until all of the text fits in a cell without wrapping.
/// </summary>
alignment &shrink(bool shrink_to_fit);
/// <summary>
///
/// Returns true if text-wrapping has been enabled.
/// </summary>
bool wrap() const;
/// <summary>
///
/// Sets whether text in a cell should continue to multiple lines if it doesn't fit in one line.
/// </summary>
alignment &wrap(bool wrap_text);
/// <summary>
///
/// Returns the optional value of indentation width in number of spaces.
/// </summary>
optional<int> indent() const;
/// <summary>
///
/// Sets the indent size in number of spaces from the side of the cell. This will only
/// take effect when left or right horizontal alignment has also been set.
/// </summary>
alignment &indent(int indent_size);
/// <summary>
///
/// Returns the optional value of rotation for text in the cell in degrees.
/// </summary>
optional<int> rotation() const;
/// <summary>
///
/// Sets the rotation for text in the cell in degrees.
/// </summary>
alignment &rotation(int text_rotation);
/// <summary>
///
/// Returns the optional horizontal alignment.
/// </summary>
optional<horizontal_alignment> horizontal() const;
/// <summary>
///
/// Sets the horizontal alignment.
/// </summary>
alignment &horizontal(horizontal_alignment horizontal);
/// <summary>
///
/// Returns the optional vertical alignment.
/// </summary>
optional<vertical_alignment> vertical() const;
/// <summary>
///
/// Sets the vertical alignment.
/// </summary>
alignment &vertical(vertical_alignment vertical);
/// <summary>
/// Returns true if left is exactly equal to right.
/// Returns true if this alignment is equivalent to other.
/// </summary>
XLNT_API friend bool operator==(const alignment &left, const alignment &right);
bool operator==(const alignment &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// Returns true if this alignment is not equivalent to other.
/// </summary>
XLNT_API friend bool operator!=(const alignment &left, const alignment &right)
{
return !(left == right);
}
bool operator!=(const alignment &other) const;
private:
/// <summary>
/// Whether or not to shrink font size until it fits on one line
/// </summary>
bool shrink_to_fit_ = false;
/// <summary>
/// Whether or not to wrap text to the next line
/// </summary>
bool wrap_text_ = false;
/// <summary>
/// The indent in number of spaces from the side
/// </summary>
optional<int> indent_;
/// <summary>
/// The text roation in degrees
/// </summary>
optional<int> text_rotation_;
/// <summary>
/// The horizontal alignment
/// </summary>
optional<horizontal_alignment> horizontal_;
/// <summary>
/// The vertical alignment
/// </summary>
optional<vertical_alignment> vertical_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -30,15 +30,13 @@
#include <vector>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/border_style.hpp>
#include <xlnt/styles/color.hpp>
#include <xlnt/styles/diagonal_direction.hpp>
#include <xlnt/utils/optional.hpp>
namespace xlnt {
/// <summary>
///
/// Enumerates the sides of a cell to which a border style can be applied.
/// </summary>
enum class XLNT_API border_side
{
@ -51,6 +49,40 @@ enum class XLNT_API border_side
horizontal
};
/// <summary>
/// Enumerates the pattern of the border lines on a particular side.
/// </summary>
enum class XLNT_API border_style
{
none,
dashdot,
dashdotdot,
dashed,
dotted,
double_,
hair,
medium,
mediumdashdot,
mediumdashdotdot,
mediumdashed,
slantdashdot,
thick,
thin
};
/// <summary>
/// Cells can have borders that go from the top-left to bottom-right
/// or from the top-right to bottom-left, or both, or neither.
/// Used by style->border.
/// </summary>
enum class XLNT_API diagonal_direction
{
neither,
up,
down,
both
};
} // namespace xlnt
namespace xlnt {
@ -62,139 +94,132 @@ class XLNT_API border
{
public:
/// <summary>
///
/// Each side of a cell can have a border_property applied to it to change
/// how it is displayed.
/// </summary>
class XLNT_API border_property
{
public:
/// <summary>
///
/// Returns the color of the side.
/// </summary>
optional<class color> color() const;
/// <summary>
///
/// Sets the color of the side and returns a reference to the side properties.
/// </summary>
border_property &color(const xlnt::color &c);
/// <summary>
///
/// Returns the style of the side.
/// </summary>
optional<border_style> style() const;
/// <summary>
///
/// Sets the style of the side and returns a reference to the side properties.
/// </summary>
border_property &style(border_style style);
/// <summary>
/// Returns true if left is exactly equal to right.
/// </summary>
friend bool operator==(const border_property &left, const border_property &right);
bool operator==(const border_property &right) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// </summary>
friend bool operator!=(const border_property &left, const border_property &right)
{
return !(left == right);
}
bool operator!=(const border_property &right) const;
private:
/// <summary>
///
/// The color of the side
/// </summary>
optional<class color> color_;
/// <summary>
///
/// The style of the side
/// </summary>
optional<border_style> style_;
};
/// <summary>
///
/// Returns a vector containing all of the border sides to be used for iteration.
/// </summary>
static const std::vector<border_side> &all_sides();
/// <summary>
///
/// Constructs a default border.
/// </summary>
border();
/// <summary>
///
/// Returns the border properties of the given side.
/// </summary>
optional<border_property> side(border_side s) const;
/// <summary>
///
/// Sets the border properties of the side s to prop.
/// </summary>
border &side(border_side s, const border_property &prop);
/// <summary>
///
/// Returns the diagonal direction of this border.
/// </summary>
optional<diagonal_direction> diagonal() const;
/// <summary>
///
/// Sets the diagonal direction of this border to dir.
/// </summary>
border &diagonal(diagonal_direction dir);
/// <summary>
/// Returns true if left is exactly equal to right.
/// </summary>
XLNT_API friend bool operator==(const border &left, const border &right);
bool operator==(const border &right) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// </summary>
XLNT_API friend bool operator!=(const border &left, const border &right)
{
return !(left == right);
}
bool operator!=(const border &right) const;
private:
/// <summary>
///
/// Start side (i.e. left) border properties
/// </summary>
optional<border_property> start_;
/// <summary>
///
/// End side (i.e. right) border properties
/// </summary>
optional<border_property> end_;
/// <summary>
///
/// Top side border properties
/// </summary>
optional<border_property> top_;
/// <summary>
///
/// Bottom side border properties
/// </summary>
optional<border_property> bottom_;
/// <summary>
///
/// Vertical border properties
/// </summary>
optional<border_property> vertical_;
/// <summary>
///
/// Horizontal border properties
/// </summary>
optional<border_property> horizontal_;
/// <summary>
///
/// Diagonal border properties
/// </summary>
optional<border_property> diagonal_;
// bool outline_ = true;
/// <summary>
///
/// Direction of diagonal border properties to be applied
/// </summary>
optional<diagonal_direction> diagonal_direction_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -28,124 +28,122 @@
#include <string>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/optional.hpp>
namespace xlnt {
/// <summary>
///
/// An indexed color encapsulates a simple index to a color in the indexedColors of the stylesheet.
/// </summary>
class XLNT_API indexed_color
{
public:
//TODO: should this be explicit?
/// <summary>
///
/// Constructs an indexed_color from an index.
/// </summary>
indexed_color(std::size_t index);
/// <summary>
///
/// Returns the index this color points to.
/// </summary>
std::size_t index() const;
/// <summary>
///
/// Sets the index to index.
/// </summary>
void index(std::size_t index);
private:
/// <summary>
///
/// The index of this color
/// </summary>
std::size_t index_;
};
/// <summary>
///
/// A theme color encapsulates a color derived from the theme.
/// </summary>
class XLNT_API theme_color
{
public:
/// <summary>
///
/// Constructs a theme_color from an index.
/// </summary>
theme_color(std::size_t index);
/// <summary>
///
/// Returns the index of the color in the theme this points to.
/// </summary>
std::size_t index() const;
/// <summary>
///
/// Sets the index of this color to index.
/// </summary>
void index(std::size_t index);
private:
/// <summary>
///
/// The index of the color
/// </summary>
std::size_t index_;
};
/// <summary>
///
/// An RGB color describes a color in terms of its red, green, blue, and alpha components.
/// </summary>
class XLNT_API rgb_color
{
public:
/// <summary>
///
/// Constructs an RGB color from a string in the form \#[aa]rrggbb
/// </summary>
rgb_color(const std::string &hex_string);
/// <summary>
///
/// Constructs an RGB color from red, green, and blue values in the range 0 to 255
/// plus an optional alpha which defaults to fully opaque.
/// </summary>
rgb_color(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a = 255);
/// <summary>
///
/// Returns a string representation of this color in the form \#aarrggbb
/// </summary>
std::string hex_string() const;
/// <summary>
///
/// Returns a byte representing the red component of this color
/// </summary>
std::uint8_t red() const;
/// <summary>
///
/// Returns a byte representing the red component of this color
/// </summary>
std::uint8_t green() const;
/// <summary>
///
/// Returns a byte representing the blue component of this color
/// </summary>
std::uint8_t blue() const;
/// <summary>
///
/// Returns a byte representing the alpha component of this color
/// </summary>
std::uint8_t alpha() const;
/// <summary>
///
/// Returns the red, green, and blue components of this color separately in an array in that order.
/// </summary>
std::array<std::uint8_t, 3> rgb() const;
/// <summary>
///
/// Returns the red, green, blue, and alpha components of this color separately in an array in that order.
/// </summary>
std::array<std::uint8_t, 4> rgba() const;
private:
/// <summary>
///
/// </summary>
static std::array<std::uint8_t, 4> decode_hex_string(const std::string &hex_string);
/// <summary>
///
/// The four bytes of this color
/// </summary>
std::array<std::uint8_t, 4> rgba_;
};
@ -167,163 +165,186 @@ class XLNT_API color
{
public:
/// <summary>
///
/// Returns the color \#000000
/// </summary>
static const color black();
/// <summary>
///
/// Returns the color \#ffffff
/// </summary>
static const color white();
/// <summary>
///
/// Returns the color \#ff0000
/// </summary>
static const color red();
/// <summary>
///
/// Returns the color \#8b0000
/// </summary>
static const color darkred();
/// <summary>
///
/// Returns the color \#00ff00
/// </summary>
static const color blue();
/// <summary>
///
/// Returns the color \#008b00
/// </summary>
static const color darkblue();
/// <summary>
///
/// Returns the color \#0000ff
/// </summary>
static const color green();
/// <summary>
///
/// Returns the color \#00008b
/// </summary>
static const color darkgreen();
/// <summary>
///
/// Returns the color \#ffff00
/// </summary>
static const color yellow();
/// <summary>
///
/// Returns the color \#cccc00
/// </summary>
static const color darkyellow();
/// <summary>
///
/// Constructs a default color
/// </summary>
color();
/// <summary>
///
/// Constructs a color from a given RGB color
/// </summary>
color(const rgb_color &rgb);
/// <summary>
///
/// Constructs a color from a given indexed color
/// </summary>
color(const indexed_color &indexed);
/// <summary>
///
/// Constructs a color from a given theme color
/// </summary>
color(const theme_color &theme);
/// <summary>
///
/// Returns the type of this color
/// </summary>
color_type type() const;
/// <summary>
///
/// Returns true if this color has been set to auto
/// </summary>
bool is_auto() const;
bool auto_() const;
/// <summary>
///
/// Sets the auto property of this color to value
/// </summary>
void auto_(bool value);
/// <summary>
///
/// Returns the internal indexed color representing this color. If this is not an RGB color,
/// an invalid_attribute exception will be thrown.
/// </summary>
const rgb_color &rgb() const;
/// <summary>
///
/// Returns the internal indexed color representing this color. If this is not an RGB color,
/// an invalid_attribute exception will be thrown.
/// </summary>
rgb_color &rgb();
/// <summary>
/// Returns the internal indexed color representing this color. If this is not an indexed color,
/// an invalid_attribute exception will be thrown.
/// </summary>
const indexed_color &indexed() const;
/// <summary>
///
/// Returns the internal indexed color representing this color. If this is not an indexed color,
/// an invalid_attribute exception will be thrown.
/// </summary>
indexed_color &indexed();
/// <summary>
/// Returns the internal indexed color representing this color. If this is not a theme color,
/// an invalid_attribute exception will be thrown.
/// </summary>
const theme_color &theme() const;
/// <summary>
///
/// Returns the internal indexed color representing this color. If this is not a theme color,
/// an invalid_attribute exception will be thrown.
/// </summary>
theme_color &theme();
/// <summary>
/// Returns true if tint is set
/// </summary>
bool has_tint() const;
/// <summary>
/// Returns the tint of this color.
/// </summary>
double tint() const;
/// <summary>
///
/// Sets the tint of this color to tint. Tints lighten or darken an existing color by multiplying the color with the tint.
/// </summary>
void tint(double tint);
/// <summary>
///
/// Returns true if this color is equivalent to other
/// </summary>
bool operator==(const color &other) const;
/// <summary>
///
/// Returns true if this color is not equivalent to other
/// </summary>
bool operator!=(const color &other) const
{
return !(*this == other);
}
bool operator!=(const color &other) const;
private:
/// <summary>
///
/// Throws an invalid_attribute exception if the given type is different from this color's type
/// </summary>
void assert_type(color_type t) const;
/// <summary>
///
/// The type of this color
/// </summary>
color_type type_;
/// <summary>
///
/// The internal RGB color. Only valid when this color has a type of rgb
/// </summary>
rgb_color rgb_;
/// <summary>
///
/// The internal RGB color. Only valid when this color has a type of indexed
/// </summary>
indexed_color indexed_;
/// <summary>
///
/// The internal RGB color. Only valid when this color has a type of theme
/// </summary>
theme_color theme_;
/// <summary>
///
/// The tint of this color
/// </summary>
double tint_;
optional<double> tint_;
/// <summary>
///
/// Whether or not this is an auto color
/// </summary>
bool auto__;
bool auto_color = false;
};
} // namespace xlnt

View File

@ -0,0 +1,170 @@
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// 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
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>
#include <string>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/optional.hpp>
namespace xlnt {
class border;
class fill;
class font;
namespace detail {
struct conditional_format_impl;
struct stylesheet;
class xlsx_consumer;
class xlsx_producer;
} // namespace detail
class XLNT_API condition
{
public:
static condition text_starts_with(const std::string &start);
static condition text_ends_with(const std::string &end);
static condition text_contains(const std::string &start);
static condition text_does_not_contain(const std::string &start);
bool operator==(const condition &rhs) const
{
return text_comparand_ == rhs.text_comparand_;
}
private:
friend class detail::xlsx_producer;
enum class type
{
contains_text
} type_;
enum class condition_operator
{
starts_with,
ends_with,
contains,
does_not_contain
} operator_;
std::string text_comparand_;
};
/// <summary>
/// Describes a conditional format that will be applied to all cells in the
/// associated range that satisfy the condition. This can only be constructed
/// using methods on worksheet or range.
/// </summary>
class XLNT_API conditional_format
{
public:
/// <summary>
/// Delete zero-argument constructor
/// </summary>
conditional_format() = delete;
/// <summary>
/// Default copy constructor. Constructs a format using the same PIMPL as other.
/// </summary>
conditional_format(const conditional_format &other) = default;
// Formatting (xf) components
/// <summary>
///
/// </summary>
bool has_border() const;
/// <summary>
///
/// </summary>
class border border() const;
/// <summary>
///
/// </summary>
conditional_format border(const xlnt::border &new_border);
/// <summary>
///
/// </summary>
bool has_fill() const;
/// <summary>
///
/// </summary>
class fill fill() const;
/// <summary>
///
/// </summary>
conditional_format fill(const xlnt::fill &new_fill);
/// <summary>
///
/// </summary>
bool has_font() const;
/// <summary>
///
/// </summary>
class font font() const;
/// <summary>
///
/// </summary>
conditional_format font(const xlnt::font &new_font);
/// <summary>
/// Returns true if this format is equivalent to other.
/// </summary>
bool operator==(const conditional_format &other) const;
/// <summary>
/// Returns true if this format is not equivalent to other.
/// </summary>
bool operator!=(const conditional_format &other) const;
private:
friend struct detail::stylesheet;
friend class detail::xlsx_consumer;
/// <summary>
///
/// </summary>
conditional_format(detail::conditional_format_impl *d);
/// <summary>
///
/// </summary>
detail::conditional_format_impl *d_;
};
} // namespace xlnt

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -33,7 +33,7 @@
namespace xlnt {
/// <summary>
///
/// The pattern of pixels upon which the corresponding pattern fill will be displayed
/// </summary>
enum class XLNT_API pattern_fill_type
{
@ -59,78 +59,76 @@ enum class XLNT_API pattern_fill_type
};
/// <summary>
///
/// Represents a fill which colors the cell based on a foreground and
/// background color and a pattern.
/// </summary>
class XLNT_API pattern_fill
{
public:
/// <summary>
///
/// Constructs a default pattern fill with a none pattern and no colors.
/// </summary>
pattern_fill();
/// <summary>
///
/// Returns the pattern used by this fill
/// </summary>
pattern_fill_type type() const;
/// <summary>
///
/// Sets the pattern of this fill and returns a reference to it.
/// </summary>
pattern_fill &type(pattern_fill_type new_type);
/// <summary>
///
/// Returns the optional foreground color of this fill
/// </summary>
optional<color> foreground() const;
/// <summary>
///
/// Sets the foreground color and returns a reference to this pattern.
/// </summary>
pattern_fill &foreground(const color &foreground);
/// <summary>
///
/// Returns the optional background color of this fill
/// </summary>
optional<color> background() const;
/// <summary>
///
/// Sets the foreground color and returns a reference to this pattern.
/// </summary>
pattern_fill &background(const color &background);
/// <summary>
/// Returns true if left is exactly equal to right.
/// Returns true if this pattern fill is equivalent to other.
/// </summary>
XLNT_API friend bool operator==(const pattern_fill &left, const pattern_fill &right);
bool operator==(const pattern_fill &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// Returns true if this pattern fill is not equivalent to other.
/// </summary>
XLNT_API friend bool operator!=(const pattern_fill &left, const pattern_fill &right)
{
return !(left == right);
}
bool operator!=(const pattern_fill &other) const;
private:
/// <summary>
///
/// The type of this pattern_fill
/// </summary>
pattern_fill_type type_ = pattern_fill_type::none;
/// <summary>
///
/// The optional foreground color
/// </summary>
optional<color> foreground_;
/// <summary>
///
/// THe optional background color
/// </summary>
optional<color> background_;
};
/// <summary>
///
/// Enumerates the types of gradient fills
/// </summary>
enum class XLNT_API gradient_fill_type
{
@ -139,157 +137,154 @@ enum class XLNT_API gradient_fill_type
};
/// <summary>
///
/// Encapsulates a fill which transitions between colors at particular "stops".
/// </summary>
class XLNT_API gradient_fill
{
public:
/// <summary>
///
/// Constructs a default linear fill
/// </summary>
gradient_fill();
/// <summary>
///
/// Returns the type of this gradient fill
/// </summary>
gradient_fill_type type() const;
// Type
/// <summary>
///
/// Sets the type of this gradient fill
/// </summary>
gradient_fill &type(gradient_fill_type new_type);
// Degree
/// <summary>
///
/// Sets the angle of the gradient in degrees
/// </summary>
gradient_fill &degree(double degree);
/// <summary>
///
/// Returns the angle of the gradient
/// </summary>
double degree() const;
// Left
/// <summary>
///
/// Returns the distance from the left where the gradient starts.
/// </summary>
double left() const;
/// <summary>
///
/// Sets the distance from the left where the gradient starts.
/// </summary>
gradient_fill &left(double value);
// Right
/// <summary>
///
/// Returns the distance from the right where the gradient starts.
/// </summary>
double right() const;
/// <summary>
///
/// Sets the distance from the right where the gradient starts.
/// </summary>
gradient_fill &right(double value);
// Top
/// <summary>
///
/// Returns the distance from the top where the gradient starts.
/// </summary>
double top() const;
/// <summary>
///
/// Sets the distance from the top where the gradient starts.
/// </summary>
gradient_fill &top(double value);
// Bottom
/// <summary>
///
/// Returns the distance from the bottom where the gradient starts.
/// </summary>
double bottom() const;
/// <summary>
///
/// Sets the distance from the bottom where the gradient starts.
/// </summary>
gradient_fill &bottom(double value);
// Stops
/// <summary>
///
/// Adds a gradient stop at position with the given color.
/// </summary>
gradient_fill &add_stop(double position, color stop_color);
/// <summary>
///
/// Deletes all stops from the gradient.
/// </summary>
gradient_fill &clear_stops();
/// <summary>
///
/// Returns all of the gradient stops.
/// </summary>
std::unordered_map<double, color> stops() const;
/// <summary>
/// Returns true if left is exactly equal to right.
/// Returns true if the gradient is equivalent to other.
/// </summary>
XLNT_API friend bool operator==(const gradient_fill &left, const gradient_fill &right);
bool operator==(const gradient_fill &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// Returns true if the gradient is not equivalent to other.
/// </summary>
XLNT_API friend bool operator!=(const gradient_fill &left, const gradient_fill &right)
{
return !(left == right);
}
bool operator!=(const gradient_fill &right) const;
private:
/// <summary>
///
/// The type of gradient
/// </summary>
gradient_fill_type type_ = gradient_fill_type::linear;
/// <summary>
///
/// The angle of the gradient
/// </summary>
double degree_ = 0;
/// <summary>
///
/// THe left distance
/// </summary>
double left_ = 0;
/// <summary>
///
/// THe right distance
/// </summary>
double right_ = 0;
/// <summary>
///
/// The top distance
/// </summary>
double top_ = 0;
/// <summary>
///
/// The bottom distance
/// </summary>
double bottom_ = 0;
/// <summary>
///
/// The gradient stops and colors
/// </summary>
std::unordered_map<double, color> stops_;
};
/// <summary>
///
/// Enumerates the possible fill types
/// </summary>
enum class XLNT_API fill_type
{
@ -347,29 +342,26 @@ public:
/// <summary>
/// Returns true if left is exactly equal to right.
/// </summary>
XLNT_API friend bool operator==(const fill &left, const fill &right);
bool operator==(const fill &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// </summary>
XLNT_API friend bool operator!=(const fill &left, const fill &right)
{
return !(left == right);
}
bool operator!=(const fill &other) const;
private:
/// <summary>
///
/// The type of this fill
/// </summary>
fill_type type_ = fill_type::pattern;
/// <summary>
///
/// The internal gradient fill if this is a gradient fill type
/// </summary>
xlnt::gradient_fill gradient_;
/// <summary>
///
/// The internal pattern fill if this is a pattern fill type
/// </summary>
xlnt::pattern_fill pattern_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -41,7 +41,7 @@ class XLNT_API font
{
public:
/// <summary>
///
/// Text can be underlined in the enumerated ways
/// </summary>
enum class underline_style
{
@ -53,208 +53,270 @@ public:
};
/// <summary>
///
/// Constructs a default font. Calibri, size 12
/// </summary>
font();
/// <summary>
///
/// Sets the bold state of the font to bold and returns a reference to the font.
/// </summary>
font &bold(bool bold);
/// <summary>
///
/// Returns the bold state of the font.
/// </summary>
bool bold() const;
/// <summary>
///
/// Sets the vertical alignment of the font to subscript and returns a reference to the font.
/// </summary>
font &superscript(bool superscript);
font &subscript(bool value);
/// <summary>
///
/// Returns true if this font has a vertical alignment of subscript.
/// </summary>
bool subscript() const;
/// <summary>
/// Sets the vertical alignment of the font to superscript and returns a reference to the font.
/// </summary>
font &superscript(bool value);
/// <summary>
/// Returns true if this font has a vertical alignment of superscript.
/// </summary>
bool superscript() const;
/// <summary>
///
/// Sets the bold state of the font to bold and returns a reference to the font.
/// </summary>
font &italic(bool italic);
/// <summary>
///
/// Returns true if this font has italics applied.
/// </summary>
bool italic() const;
/// <summary>
///
/// Sets the bold state of the font to bold and returns a reference to the font.
/// </summary>
font &strikethrough(bool strikethrough);
/// <summary>
///
/// Returns true if this font has a strikethrough applied.
/// </summary>
bool strikethrough() const;
/// <summary>
///
/// Sets the bold state of the font to bold and returns a reference to the font.
/// </summary>
font &outline(bool outline);
/// <summary>
/// Returns true if this font has an outline applied.
/// </summary>
bool outline() const;
/// <summary>
/// Sets the shadow state of the font to shadow and returns a reference to the font.
/// </summary>
font &shadow(bool shadow);
/// <summary>
/// Returns true if this font has a shadow applied.
/// </summary>
bool shadow() const;
/// <summary>
/// Sets the underline state of the font to new_underline and returns a reference to the font.
/// </summary>
font &underline(underline_style new_underline);
/// <summary>
///
/// Returns true if this font has any type of underline applied.
/// </summary>
bool underlined() const;
/// <summary>
///
/// Returns the particular style of underline this font has applied.
/// </summary>
underline_style underline() const;
/// <summary>
///
/// Returns true if this font has a defined size.
/// </summary>
bool has_size() const;
/// <summary>
///
/// Sets the size of the font to size and returns a reference to the font.
/// </summary>
font &size(double size);
/// <summary>
///
/// Returns the size of the font.
/// </summary>
double size() const;
/// <summary>
///
/// Returns true if this font has a particular face applied (e.g. "Comic Sans").
/// </summary>
bool has_name() const;
/// <summary>
///
/// Sets the font face to name and returns a reference to the font.
/// </summary>
font &name(const std::string &name);
/// <summary>
///
/// Returns the name of the font face.
/// </summary>
std::string name() const;
const std::string &name() const;
/// <summary>
///
/// Returns true if this font has a color applied.
/// </summary>
bool has_color() const;
/// <summary>
///
/// Sets the color of the font to c and returns a reference to the font.
/// </summary>
font &color(const color &c);
/// <summary>
///
/// Returns the color that this font is using.
/// </summary>
xlnt::color color() const;
/// <summary>
///
/// Returns true if this font has a family defined.
/// </summary>
bool has_family() const;
/// <summary>
///
/// Sets the family index of the font to family and returns a reference to the font.
/// </summary>
font &family(std::size_t family);
/// <summary>
///
/// Returns the family index for the font.
/// </summary>
std::size_t family() const;
/// <summary>
///
/// Returns true if this font has a charset defined.
/// </summary>
bool has_charset() const;
// TODO: charset should be an enum, not a number
/// <summary>
/// Sets the charset of the font to charset and returns a reference to the font.
/// </summary>
font &charset(std::size_t charset);
/// <summary>
/// Returns the charset of the font.
/// </summary>
std::size_t charset() const;
/// <summary>
/// Returns true if this font has a scheme.
/// </summary>
bool has_scheme() const;
/// <summary>
///
/// Sets the scheme of the font to scheme and returns a reference to the font.
/// </summary>
font &scheme(const std::string &scheme);
/// <summary>
///
/// Returns the scheme of this font.
/// </summary>
std::string scheme() const;
const std::string &scheme() const;
/// <summary>
/// Returns true if left is exactly equal to right.
/// </summary>
XLNT_API friend bool operator==(const font &left, const font &right);
bool operator==(const font &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// </summary>
XLNT_API friend bool operator!=(const font &left, const font &right)
bool operator!=(const font &other) const
{
return !(left == right);
return !operator==(other);
}
private:
friend class style;
/// <summary>
///
/// The name of the font
/// </summary>
optional<std::string> name_;
/// <summary>
///
/// size
/// </summary>
optional<double> size_;
/// <summary>
///
/// bold
/// </summary>
bool bold_ = false;
/// <summary>
///
/// italic
/// </summary>
bool italic_ = false;
/// <summary>
///
/// superscript
/// </summary>
bool superscript_ = false;
/// <summary>
///
/// subscript
/// </summary>
bool subscript_ = false;
/// <summary>
///
/// strikethrough
/// </summary>
bool strikethrough_ = false;
/// <summary>
///
/// outline
/// </summary>
bool outline_ = false;
/// <summary>
/// shadow
/// </summary>
bool shadow_ = false;
/// <summary>
/// underline style
/// </summary>
underline_style underline_ = underline_style::none;
/// <summary>
///
/// color
/// </summary>
optional<xlnt::color> color_;
/// <summary>
///
/// family
/// </summary>
optional<std::size_t> family_;
/// <summary>
///
/// charset
/// </summary>
optional<std::size_t> charset_;
/// <summary>
/// scheme
/// </summary>
optional<std::string> scheme_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -39,10 +39,15 @@ class number_format;
class protection;
class style;
template <typename T>
class optional;
namespace detail {
struct format_impl;
struct stylesheet;
class xlsx_producer;
class xlsx_consumer;
} // namespace detail
@ -53,180 +58,176 @@ class XLNT_API format
{
public:
/// <summary>
///
/// Returns the alignment of this format.
/// </summary>
std::size_t id() const;
// Alignment
class alignment alignment() const;
/// <summary>
///
/// Sets the alignment of this format to new_alignment. Applied, which defaults
/// to true, determines whether the alignment should be enabled for cells using
/// this format.
/// </summary>
class alignment &alignment();
format alignment(const xlnt::alignment &new_alignment, xlnt::optional<bool> applied = {});
/// <summary>
///
/// </summary>
const class alignment &alignment() const;
/// <summary>
///
/// </summary>
format alignment(const xlnt::alignment &new_alignment, bool applied);
/// <summary>
///
/// Returns true if the alignment of this format should be applied to cells
/// using it.
/// </summary>
bool alignment_applied() const;
// Border
/// <summary>
///
/// Returns the border of this format.
/// </summary>
class border &border();
class border border() const;
/// <summary>
///
/// Sets the border of this format to new_border. Applied, which defaults
/// to true, determines whether the border should be enabled for cells using
/// this format.
/// </summary>
const class border &border() const;
format border(const xlnt::border &new_border, xlnt::optional<bool> applied = {});
/// <summary>
///
/// </summary>
format border(const xlnt::border &new_border, bool applied);
/// <summary>
///
/// Returns true if the border set for this format should be applied to cells using the format.
/// </summary>
bool border_applied() const;
// Fill
/// <summary>
///
/// Returns the fill of this format.
/// </summary>
class fill &fill();
class fill fill() const;
/// <summary>
///
/// Sets the fill of this format to new_fill. Applied, which defaults
/// to true, determines whether the border should be enabled for cells using
/// this format.
/// </summary>
const class fill &fill() const;
format fill(const xlnt::fill &new_fill, xlnt::optional<bool> applied = {});
/// <summary>
///
/// </summary>
format fill(const xlnt::fill &new_fill, bool applied);
/// <summary>
///
/// Returns true if the fill set for this format should be applied to cells using the format.
/// </summary>
bool fill_applied() const;
// Font
/// <summary>
///
/// Returns the font of this format.
/// </summary>
class font &font();
class font font() const;
/// <summary>
///
/// Sets the font of this format to new_font. Applied, which defaults
/// to true, determines whether the font should be enabled for cells using
/// this format.
/// </summary>
const class font &font() const;
format font(const xlnt::font &new_font, xlnt::optional<bool> applied = {});
/// <summary>
///
/// </summary>
format font(const xlnt::font &new_font, bool applied);
/// <summary>
///
/// Returns true if the font set for this format should be applied to cells using the format.
/// </summary>
bool font_applied() const;
// Number Format
/// <summary>
///
/// Returns the number format of this format.
/// </summary>
class number_format &number_format();
class number_format number_format() const;
/// <summary>
///
/// Sets the number format of this format to new_number_format. Applied, which defaults
/// to true, determines whether the number format should be enabled for cells using
/// this format.
/// </summary>
const class number_format &number_format() const;
format number_format(const xlnt::number_format &new_number_format, xlnt::optional<bool> applied = {});
/// <summary>
///
/// </summary>
format number_format(const xlnt::number_format &new_number_format, bool applied);
/// <summary>
///
/// Returns true if the number_format set for this format should be applied to cells using the format.
/// </summary>
bool number_format_applied() const;
// Protection
/// <summary>
///
/// Returns the protection of this format.
/// </summary>
class protection &protection();
class protection protection() const;
/// <summary>
///
/// </summary>
const class protection &protection() const;
/// <summary>
///
/// </summary>
format protection(const xlnt::protection &new_protection, bool applied);
/// <summary>
///
/// Returns true if the protection set for this format should be applied to cells using the format.
/// </summary>
bool protection_applied() const;
// Style
/// <summary>
/// Sets the protection of this format to new_protection. Applied, which defaults
/// to true, determines whether the protection should be enabled for cells using
/// this format.
/// </summary>
format protection(const xlnt::protection &new_protection, xlnt::optional<bool> applied = {});
/// <summary>
///
/// Returns true if the pivot table interface is enabled for this format.
/// </summary>
bool pivot_button() const;
/// <summary>
/// If show is true, a pivot table interface will be displayed for cells using
/// this format.
/// </summary>
void pivot_button(bool show);
/// <summary>
/// Returns true if this format should add a single-quote prefix for all text values.
/// </summary>
bool quote_prefix() const;
/// <summary>
/// If quote is true, enables a single-quote prefix for all text values in cells
/// using this format (e.g. "abc" will appear as "'abc"). The text will also not
/// be stored in sharedStrings when this is enabled.
/// </summary>
void quote_prefix(bool quote);
/// <summary>
/// Returns true if this format has a corresponding style applied.
/// </summary>
bool has_style() const;
/// <summary>
///
/// Removes the style from this format if it exists.
/// </summary>
void clear_style();
/// <summary>
///
/// Sets the style of this format to a style with the given name.
/// </summary>
format style(const std::string &name);
/// <summary>
///
/// Sets the style of this format to new_style.
/// </summary>
format style(const class style &new_style);
/// <summary>
///
/// Returns the style of this format. If it has no style, an invalid_parameter
/// exception will be thrown.
/// </summary>
class style style();
/// <summary>
/// Returns the style of this format. If it has no style, an invalid_parameters
/// exception will be thrown.
/// </summary>
const class style style() const;
private:
friend struct detail::stylesheet;
friend class detail::xlsx_producer;
friend class detail::xlsx_consumer;
friend class cell;
/// <summary>
///
/// Constructs a format from an impl pointer.
/// </summary>
format(detail::format_impl *d);
/// <summary>
///
/// The internal implementation of this format
/// </summary>
detail::format_impl *d_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -28,6 +28,7 @@
#include <string>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/optional.hpp>
namespace xlnt {
@ -40,236 +41,232 @@ class XLNT_API number_format
{
public:
/// <summary>
///
/// Number format "General"
/// </summary>
static const number_format general();
/// <summary>
///
/// Number format "@"
/// </summary>
static const number_format text();
/// <summary>
///
/// Number format "0"
/// </summary>
static const number_format number();
/// <summary>
///
/// Number format "00"
/// </summary>
static const number_format number_00();
/// <summary>
///
/// Number format "#,##0.00"
/// </summary>
static const number_format number_comma_separated1();
/// <summary>
///
/// Number format "0%"
/// </summary>
static const number_format percentage();
/// <summary>
///
/// Number format "0.00%"
/// </summary>
static const number_format percentage_00();
/// <summary>
///
/// Number format "yyyy-mm-dd"
/// </summary>
static const number_format date_yyyymmdd2();
/// <summary>
///
/// Number format "yy-mm-dd"
/// </summary>
static const number_format date_yymmdd();
/// <summary>
///
/// Number format "dd/mm/yy"
/// </summary>
static const number_format date_ddmmyyyy();
/// <summary>
///
/// Number format "d/m/yy"
/// </summary>
static const number_format date_dmyslash();
/// <summary>
///
/// Number format "d-m-yy"
/// </summary>
static const number_format date_dmyminus();
/// <summary>
///
/// Number format "d-m"
/// </summary>
static const number_format date_dmminus();
/// <summary>
///
/// Number format "m-yy"
/// </summary>
static const number_format date_myminus();
/// <summary>
///
/// Number format "mm-dd-yy"
/// </summary>
static const number_format date_xlsx14();
/// <summary>
///
/// Number format "d-mmm-yy"
/// </summary>
static const number_format date_xlsx15();
/// <summary>
///
/// Number format "d-mmm"
/// </summary>
static const number_format date_xlsx16();
/// <summary>
///
/// Number format "mmm-yy"
/// </summary>
static const number_format date_xlsx17();
/// <summary>
///
/// Number format "m/d/yy h:mm"
/// </summary>
static const number_format date_xlsx22();
/// <summary>
///
/// Number format "yyyy-mm-dd h:mm:ss"
/// </summary>
static const number_format date_datetime();
/// <summary>
///
/// Number format "h:mm AM/PM"
/// </summary>
static const number_format date_time1();
/// <summary>
///
/// Number format "h:mm:ss AM/PM"
/// </summary>
static const number_format date_time2();
/// <summary>
///
/// Number format "h:mm"
/// </summary>
static const number_format date_time3();
/// <summary>
///
/// Number format "h:mm:ss"
/// </summary>
static const number_format date_time4();
/// <summary>
///
/// Number format "mm:ss"
/// </summary>
static const number_format date_time5();
/// <summary>
///
/// Number format "h:mm:ss"
/// </summary>
static const number_format date_time6();
/// <summary>
///
/// Returns true if the given format ID corresponds to a known builtin format.
/// </summary>
static bool is_builtin_format(std::size_t builtin_id);
/// <summary>
///
/// Returns the format with the given ID. Thows an invalid_parameter exception
/// if builtin_id is not a valid ID.
/// </summary>
static const number_format &from_builtin_id(std::size_t builtin_id);
/// <summary>
///
/// Constructs a default number_format equivalent to "General"
/// </summary>
number_format();
/// <summary>
///
/// Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id).
/// </summary>
number_format(std::size_t builtin_id);
/// <summary>
///
/// Constructs a number format from a code string. If the string matches a builtin ID,
/// its ID will also be set to match the builtin ID.
/// </summary>
number_format(const std::string &code);
/// <summary>
///
/// Constructs a number format from a code string and custom ID. Custom ID should generally
/// be >= 164.
/// </summary>
number_format(const std::string &code, std::size_t custom_id);
/// <summary>
///
/// Sets the format code of this number format to format_code.
/// </summary>
void format_string(const std::string &format_code);
/// <summary>
///
/// Sets the format code of this number format to format_code and the ID to custom_id.
/// </summary>
void format_string(const std::string &format_code, std::size_t custom_id);
/// <summary>
///
/// Returns the format code this number format uses.
/// </summary>
std::string format_string() const;
/// <summary>
///
/// Returns true if this number format has an ID.
/// </summary>
bool has_id() const;
/// <summary>
///
/// Sets the ID of this number format to id.
/// </summary>
void id(std::size_t id);
/// <summary>
///
/// Returns the ID of this format.
/// </summary>
std::size_t id() const;
/// <summary>
///
/// Returns text formatted according to this number format's format code.
/// </summary>
std::string format(const std::string &text) const;
/// <summary>
///
/// Returns number formatted according to this number format's format code
/// with the given base date.
/// </summary>
std::string format(long double number, calendar base_date) const;
std::string format(double number, calendar base_date) const;
/// <summary>
///
/// Returns true if this format code returns a number formatted as a date.
/// </summary>
bool is_date_format() const;
/// <summary>
/// Returns true if left is exactly equal to right.
/// Returns true if this format is equivalent to other.
/// </summary>
XLNT_API friend bool operator==(const number_format &left, const number_format &right);
bool operator==(const number_format &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// Returns true if this format is not equivalent to other.
/// </summary>
XLNT_API friend bool operator!=(const number_format &left, const number_format &right)
{
return !(left == right);
}
bool operator!=(const number_format &other) const;
private:
/// <summary>
///
/// The optional ID
/// </summary>
bool id_set_;
optional<std::size_t> id_;
/// <summary>
///
/// </summary>
std::size_t id_;
/// <summary>
///
/// The format code
/// </summary>
std::string format_string_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -38,71 +38,68 @@ class XLNT_API protection
{
public:
/// <summary>
///
/// Returns an unlocked and unhidden protection object.
/// </summary>
static protection unlocked_and_visible();
/// <summary>
///
/// Returns a locked and unhidden protection object.
/// </summary>
static protection locked_and_visible();
/// <summary>
///
/// Returns an unlocked and hidden protection object.
/// </summary>
static protection unlocked_and_hidden();
/// <summary>
///
/// Returns a locked and hidden protection object.
/// </summary>
static protection locked_and_hidden();
/// <summary>
///
/// Constructs a default unlocked unhidden protection object.
/// </summary>
protection();
/// <summary>
///
/// Returns true if cells using this protection should be locked.
/// </summary>
bool locked() const;
/// <summary>
///
/// Sets the locked state of the protection to locked and returns a reference to the protection.
/// </summary>
protection &locked(bool locked);
/// <summary>
///
/// Returns true if cells using this protection should be hidden.
/// </summary>
bool hidden() const;
/// <summary>
///
/// Sets the hidden state of the protection to hidden and returns a reference to the protection.
/// </summary>
protection &hidden(bool hidden);
/// <summary>
/// Returns true if left is exactly equal to right.
/// Returns true if this protections is equivalent to right.
/// </summary>
XLNT_API friend bool operator==(const protection &left, const protection &right);
bool operator==(const protection &other) const;
/// <summary>
/// Returns true if left is not exactly equal to right.
/// Returns true if this protection is not equivalent to right.
/// </summary>
XLNT_API friend bool operator!=(const protection &left, const protection &right)
{
return !(left == right);
}
bool operator!=(const protection &other) const;
private:
/// <summary>
///
/// Whether the cell using this protection is locked or not
/// </summary>
bool locked_;
/// <summary>
///
/// Whether the cell using this protection is hidden or not
/// </summary>
bool hidden_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -15,7 +15,7 @@
// 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,
// 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
//
@ -44,6 +44,7 @@ namespace detail {
struct style_impl;
struct stylesheet;
class xlsx_consumer;
} // namespace detail
@ -60,187 +61,199 @@ public:
style() = delete;
/// <summary>
/// Default copy constructor
/// Default copy constructor. Constructs a style using the same PIMPL as other.
/// </summary>
style(const style &other) = default;
/// <summary>
/// Return the name of this style.
/// Returns the name of this style.
/// </summary>
std::string name() const;
/// <summary>
///
/// Sets the name of this style to name.
/// </summary>
style name(const std::string &name);
/// <summary>
///
/// Returns true if this style is hidden.
/// </summary>
bool hidden() const;
/// <summary>
///
/// Sets the hidden state of this style to value. A hidden style will not
/// be shown in the list of selectable styles in the UI, but will still
/// apply its formatting to cells using it.
/// </summary>
style hidden(bool value);
/// <summary>
///
/// Returns true if this is a builtin style that has been customized and
/// should therefore be persisted in the workbook.
/// </summary>
optional<bool> custom() const;
bool custom_builtin() const;
/// <summary>
///
/// Returns the index of the builtin style that this style is an instance
/// of or is a customized version thereof. If style::builtin() is false,
/// this will throw an invalid_attribute exception.
/// </summary>
style custom(bool value);
std::size_t builtin_id() const;
/// <summary>
///
/// Returns true if this is a builtin style.
/// </summary>
optional<std::size_t> builtin_id() const;
bool builtin() const;
// Formatting (xf) components
/// <summary>
///
/// Returns the alignment of this style.
/// </summary>
style builtin_id(std::size_t builtin_id);
// Formatting components
class alignment alignment() const;
/// <summary>
///
/// </summary>
class alignment &alignment();
/// <summary>
///
/// </summary>
const class alignment &alignment() const;
/// <summary>
///
/// </summary>
style alignment(const xlnt::alignment &new_alignment, bool applied = true);
/// <summary>
///
/// Returns true if the alignment of this style should be applied to cells
/// using it.
/// </summary>
bool alignment_applied() const;
/// <summary>
///
/// Sets the alignment of this style to new_alignment. Applied, which defaults
/// to true, determines whether the alignment should be enabled for cells using
/// this style.
/// </summary>
class border &border();
style alignment(const xlnt::alignment &new_alignment, optional<bool> applied = {});
/// <summary>
///
/// Returns the border of this style.
/// </summary>
const class border &border() const;
class border border() const;
/// <summary>
///
/// </summary>
style border(const xlnt::border &new_border, bool applied = true);
/// <summary>
///
/// Returns true if the border set for this style should be applied to cells using the style.
/// </summary>
bool border_applied() const;
/// <summary>
///
/// Sets the border of this style to new_border. Applied, which defaults
/// to true, determines whether the border should be enabled for cells using
/// this style.
/// </summary>
class fill &fill();
style border(const xlnt::border &new_border, optional<bool> applied = {});
/// <summary>
///
/// Returns the fill of this style.
/// </summary>
const class fill &fill() const;
class fill fill() const;
/// <summary>
///
/// </summary>
style fill(const xlnt::fill &new_fill, bool applied = true);
/// <summary>
///
/// Returns true if the fill set for this style should be applied to cells using the style.
/// </summary>
bool fill_applied() const;
/// <summary>
///
/// Sets the fill of this style to new_fill. Applied, which defaults
/// to true, determines whether the border should be enabled for cells using
/// this style.
/// </summary>
class font &font();
style fill(const xlnt::fill &new_fill, optional<bool> applied = {});
/// <summary>
///
/// Returns the font of this style.
/// </summary>
const class font &font() const;
class font font() const;
/// <summary>
///
/// </summary>
style font(const xlnt::font &new_font, bool applied = true);
/// <summary>
///
/// Returns true if the font set for this style should be applied to cells using the style.
/// </summary>
bool font_applied() const;
/// <summary>
///
/// Sets the font of this style to new_font. Applied, which defaults
/// to true, determines whether the font should be enabled for cells using
/// this style.
/// </summary>
class number_format &number_format();
style font(const xlnt::font &new_font, optional<bool> applied = {});
/// <summary>
///
/// Returns the number_format of this style.
/// </summary>
const class number_format &number_format() const;
class number_format number_format() const;
/// <summary>
///
/// </summary>
style number_format(const xlnt::number_format &new_number_format, bool applied = true);
/// <summary>
///
/// Returns true if the number_format set for this style should be applied to cells using the style.
/// </summary>
bool number_format_applied() const;
/// <summary>
///
/// Sets the number format of this style to new_number_format. Applied, which defaults
/// to true, determines whether the number format should be enabled for cells using
/// this style.
/// </summary>
class protection &protection();
style number_format(const xlnt::number_format &new_number_format, optional<bool> applied = {});
/// <summary>
///
/// Returns the protection of this style.
/// </summary>
const class protection &protection() const;
class protection protection() const;
/// <summary>
///
/// </summary>
style protection(const xlnt::protection &new_protection, bool applied = true);
/// <summary>
///
/// Returns true if the protection set for this style should be applied to cells using the style.
/// </summary>
bool protection_applied() const;
/// <summary>
///
/// Sets the border of this style to new_protection. Applied, which defaults
/// to true, determines whether the protection should be enabled for cells using
/// this style.
/// </summary>
style protection(const xlnt::protection &new_protection, optional<bool> applied = {});
/// <summary>
/// Returns true if the pivot table interface is enabled for this style.
/// </summary>
bool pivot_button() const;
/// <summary>
/// If show is true, a pivot table interface will be displayed for cells using
/// this style.
/// </summary>
void pivot_button(bool show);
/// <summary>
/// Returns true if this style should add a single-quote prefix for all text values.
/// </summary>
bool quote_prefix() const;
/// <summary>
/// If quote is true, enables a single-quote prefix for all text values in cells
/// using this style (e.g. "abc" will appear as "'abc"). The text will also not
/// be stored in sharedStrings when this is enabled.
/// </summary>
void quote_prefix(bool quote);
/// <summary>
/// Returns true if this style is equivalent to other.
/// </summary>
bool operator==(const style &other) const;
/// <summary>
/// Returns true if this style is not equivalent to other.
/// </summary>
bool operator!=(const style &other) const;
private:
friend struct detail::stylesheet;
friend class detail::xlsx_consumer;
/// <summary>
///
/// Constructs a style from an impl pointer.
/// </summary>
style(detail::style_impl *d);
/// <summary>
///
/// The internal implementation of this style
/// </summary>
detail::style_impl *d_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -49,7 +49,7 @@ struct XLNT_API date
static date from_number(int days_since_base_year, calendar base_date);
/// <summary>
///
/// Constructs a data from a given year, month, and day.
/// </summary>
date(int year_, int month_, int day_);
@ -59,7 +59,8 @@ struct XLNT_API date
int to_number(calendar base_date) const;
/// <summary>
///
/// Calculates and returns the day of the week that this date represents in the range
/// 0 to 6 where 0 represents Sunday.
/// </summary>
int weekday() const;
@ -69,17 +70,22 @@ struct XLNT_API date
bool operator==(const date &comparand) const;
/// <summary>
///
/// Return true if this date is equal to comparand.
/// </summary>
bool operator!=(const date &comparand) const;
/// <summary>
/// The year
/// </summary>
int year;
/// <summary>
///
/// The month
/// </summary>
int month;
/// <summary>
///
/// The day
/// </summary>
int day;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2016 Thomas Fussell
// Copyright (c) 2014-2021 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
@ -14,7 +14,7 @@
// 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,
// 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
//
@ -39,95 +39,96 @@ struct time;
struct XLNT_API datetime
{
/// <summary>
/// Return the current date and time according to the system time.
/// Returns the current date and time according to the system time.
/// </summary>
static datetime now();
/// <summary>
/// Return the current date and time according to the system time.
/// Returns the current date and time according to the system time.
/// This is equivalent to datetime::now().
/// </summary>
static datetime today();
/// <summary>
/// Return a datetime from number by converting the integer part into
/// Returns a datetime from number by converting the integer part into
/// a date and the fractional part into a time according to date::from_number
/// and time::from_number.
/// </summary>
static datetime from_number(long double number, calendar base_date);
static datetime from_number(double number, calendar base_date);
/// <summary>
///
/// Returns a datetime equivalent to the ISO-formatted string iso_string.
/// </summary>
static datetime from_iso_string(const std::string &iso_string);
/// <summary>
///
/// Constructs a datetime from a date and a time.
/// </summary>
datetime(const date &d, const time &t);
/// <summary>
///
/// Constructs a datetime from a year, month, and day plus optional hour, minute, second, and microsecond.
/// </summary>
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
/// <summary>
///
/// Returns a string represenation of this date and time.
/// </summary>
std::string to_string() const;
/// <summary>
///
/// Returns an ISO-formatted string representation of this date and time.
/// </summary>
std::string to_iso_string() const;
/// <summary>
///
/// Returns this datetime as a number of seconds since 1900 or 1904 (depending on base_date provided).
/// </summary>
long double to_number(calendar base_date) const;
double to_number(calendar base_date) const;
/// <summary>
///
/// Returns true if this datetime is equivalent to comparand.
/// </summary>
bool operator==(const datetime &comparand) const;
/// <summary>
///
/// Calculates and returns the day of the week that this date represents in the range
/// 0 to 6 where 0 represents Sunday.
/// </summary>
int weekday() const;
/// <summary>
///
/// The year
/// </summary>
int year;
/// <summary>
///
/// The month
/// </summary>
int month;
/// <summary>
///
/// The day
/// </summary>
int day;
/// <summary>
///
/// The hour
/// </summary>
int hour;
/// <summary>
///
/// The minute
/// </summary>
int minute;
/// <summary>
///
/// The second
/// </summary>
int second;
/// <summary>
///
/// The microsecond
/// </summary>
int microsecond;
};

Some files were not shown because too many files have changed in this diff Show More