Commit Graph

946 Commits

Author SHA1 Message Date
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
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
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
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
sukoi26
8f4248d9c3
change SheetFormatPr
change "defaultRowHeight" not optional
2018-07-22 18:44:31 +02: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
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
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
11573f45e6 Resolve remaining warnings 2018-07-14 20:25:10 +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
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
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
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
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
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
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
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
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
sukoi26
99f20a014a
error what(): xl/sharedStrings.xml: error: duplicate attribute #290 2018-07-09 18:21:01 +02: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
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
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
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
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
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
467dc860c6 Visual Studio 2015 build files for Win32/x64 configurations. Very first working version. 2018-02-14 06:22:33 +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
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
44a8c8e79e minor reformatting 2017-12-09 16:04:44 -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
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
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
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
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
29abdfa702 Merge branch 'master' into dev 2017-10-30 19:44:32 -04:00
Thomas Fussell
470c655df6 fix empty row height/cell width, #235 2017-10-30 19:36:24 -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
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
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
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
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
Henrique Santiago
ea5c741bfe Parse readingOrder 2017-09-12 17:04:52 -03: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
299fc7d572 Merge branch 'dev' into dev 2017-09-08 23:15:06 -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
fff2feccd2 update licenses 2017-09-08 15:26:47 -04:00