react-native-nitro-xlsx 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroXlsx.podspec +26 -27
- package/Package.swift +31 -10
- package/README.md +1 -1
- package/android/CMakeLists.txt +20 -27
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +42 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/scripts/prepare-openxlsx.js +0 -126
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Kenneth Balslev on 24/08/2020.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef OPENXLSX_XLUTILITIES_HPP
|
|
6
|
+
#define OPENXLSX_XLUTILITIES_HPP
|
|
7
|
+
|
|
8
|
+
#include <fstream>
|
|
9
|
+
#include <string> // 2024-04-25 needed for xml_node_type_string
|
|
10
|
+
#include <string_view> // std::string_view
|
|
11
|
+
#include <vector> // std::vector< std::string_view >
|
|
12
|
+
|
|
13
|
+
#include "XLConstants.hpp" // 2024-05-28 OpenXLSX::MAX_ROWS
|
|
14
|
+
#include "XLCellReference.hpp"
|
|
15
|
+
#include "XLCellValue.hpp" // OpenXLSX::XLValueType
|
|
16
|
+
#include "XLContentTypes.hpp" // OpenXLSX::XLContentType
|
|
17
|
+
#include "XLRelationships.hpp" // OpenXLSX::XLRelationshipType
|
|
18
|
+
#include "XLStyles.hpp" // OpenXLSX::XLStyleIndex
|
|
19
|
+
#include "XLXmlParser.hpp" // pugixml wrapper
|
|
20
|
+
|
|
21
|
+
namespace OpenXLSX
|
|
22
|
+
{
|
|
23
|
+
constexpr const bool XLRemoveAttributes = true; // helper variables for appendAndSetNodeAttribute, parameter removeAttributes
|
|
24
|
+
constexpr const bool XLKeepAttributes = false; //
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @brief Get rid of compiler warnings about unused variables (-Wunused-variable) or unused parameters (-Wunusued-parameter)
|
|
28
|
+
* @param (unnamed) the variable / parameter which is intentionally unused (e.g. for function stubs)
|
|
29
|
+
*/
|
|
30
|
+
template<class T> void ignore( const T& ) {}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @brief Get a string representation of pugi::xml_node_type
|
|
34
|
+
* @param t the pugi::xml_node_type of a node
|
|
35
|
+
* @return a std::string containing the descriptive name of the node type
|
|
36
|
+
*/
|
|
37
|
+
inline std::string XLValueTypeString( XLValueType t )
|
|
38
|
+
{
|
|
39
|
+
using namespace std::literals::string_literals;
|
|
40
|
+
switch( t ) {
|
|
41
|
+
case XLValueType::Empty : return "Empty"s;
|
|
42
|
+
case XLValueType::Boolean : return "Boolean"s;
|
|
43
|
+
case XLValueType::Integer : return "Integer"s;
|
|
44
|
+
case XLValueType::Float : return "Float"s;
|
|
45
|
+
case XLValueType::Error : return "Error"s;
|
|
46
|
+
case XLValueType::String : return "String"s;
|
|
47
|
+
}
|
|
48
|
+
throw XLInternalError(__func__ + "Invalid XLValueType."s);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @brief Get a string representation of pugi::xml_node_type
|
|
53
|
+
* @param t the pugi::xml_node_type of a node
|
|
54
|
+
* @return a std::string containing the descriptive name of the node type
|
|
55
|
+
*/
|
|
56
|
+
inline std::string xml_node_type_string( pugi::xml_node_type t )
|
|
57
|
+
{
|
|
58
|
+
using namespace std::literals::string_literals;
|
|
59
|
+
switch( t ) {
|
|
60
|
+
case pugi::node_null : return "node_null"s;
|
|
61
|
+
case pugi::node_document : return "node_document"s;
|
|
62
|
+
case pugi::node_element : return "node_element"s;
|
|
63
|
+
case pugi::node_pcdata : return "node_pcdata"s;
|
|
64
|
+
case pugi::node_cdata : return "node_cdata"s;
|
|
65
|
+
case pugi::node_comment : return "node_comment"s;
|
|
66
|
+
case pugi::node_pi : return "node_pi"s;
|
|
67
|
+
case pugi::node_declaration : return "node_declaration"s;
|
|
68
|
+
case pugi::node_doctype : return "node_doctype"s;
|
|
69
|
+
}
|
|
70
|
+
throw XLInternalError("Invalid XML node type.");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @brief Get a string representation of OpenXLSX::XLContentType
|
|
75
|
+
* @param t an OpenXLSX::XLContentType value
|
|
76
|
+
* @return a std::string containing the descriptive name of the content type
|
|
77
|
+
*/
|
|
78
|
+
inline std::string XLContentTypeString( OpenXLSX::XLContentType const & t )
|
|
79
|
+
{
|
|
80
|
+
using namespace OpenXLSX;
|
|
81
|
+
switch (t) {
|
|
82
|
+
case XLContentType::Workbook: return "Workbook";
|
|
83
|
+
case XLContentType::Relationships: return "Relationships";
|
|
84
|
+
case XLContentType::WorkbookMacroEnabled: return "WorkbookMacroEnabled";
|
|
85
|
+
case XLContentType::Worksheet: return "Worksheet";
|
|
86
|
+
case XLContentType::Chartsheet: return "Chartsheet";
|
|
87
|
+
case XLContentType::ExternalLink: return "ExternalLink";
|
|
88
|
+
case XLContentType::Theme: return "Theme";
|
|
89
|
+
case XLContentType::Styles: return "Styles";
|
|
90
|
+
case XLContentType::SharedStrings: return "SharedStrings";
|
|
91
|
+
case XLContentType::Drawing: return "Drawing";
|
|
92
|
+
case XLContentType::Chart: return "Chart";
|
|
93
|
+
case XLContentType::ChartStyle: return "ChartStyle";
|
|
94
|
+
case XLContentType::ChartColorStyle: return "ChartColorStyle";
|
|
95
|
+
case XLContentType::ControlProperties: return "ControlProperties";
|
|
96
|
+
case XLContentType::CalculationChain: return "CalculationChain";
|
|
97
|
+
case XLContentType::VBAProject: return "VBAProject";
|
|
98
|
+
case XLContentType::CoreProperties: return "CoreProperties";
|
|
99
|
+
case XLContentType::ExtendedProperties: return "ExtendedProperties";
|
|
100
|
+
case XLContentType::CustomProperties: return "CustomProperties";
|
|
101
|
+
case XLContentType::VMLDrawing: return "VMLDrawing";
|
|
102
|
+
case XLContentType::Comments: return "Comments";
|
|
103
|
+
case XLContentType::Table: return "Table";
|
|
104
|
+
case XLContentType::Unknown: return "Unknown";
|
|
105
|
+
}
|
|
106
|
+
return "invalid";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @brief Get a string representation of OpenXLSX::XLRelationshipType
|
|
111
|
+
* @param t an OpenXLSX::XLRelationshipType value
|
|
112
|
+
* @return std::string containing the descriptive name of the relationship type
|
|
113
|
+
*/
|
|
114
|
+
inline std::string XLRelationshipTypeString( OpenXLSX::XLRelationshipType const & t )
|
|
115
|
+
{
|
|
116
|
+
using namespace OpenXLSX;
|
|
117
|
+
switch (t) {
|
|
118
|
+
case XLRelationshipType::CoreProperties: return "CoreProperties";
|
|
119
|
+
case XLRelationshipType::ExtendedProperties: return "ExtendedProperties";
|
|
120
|
+
case XLRelationshipType::CustomProperties: return "CustomProperties";
|
|
121
|
+
case XLRelationshipType::Workbook: return "Workbook";
|
|
122
|
+
case XLRelationshipType::Worksheet: return "Worksheet";
|
|
123
|
+
case XLRelationshipType::Chartsheet: return "Chartsheet";
|
|
124
|
+
case XLRelationshipType::Dialogsheet: return "Dialogsheet";
|
|
125
|
+
case XLRelationshipType::Macrosheet: return "Macrosheet";
|
|
126
|
+
case XLRelationshipType::CalculationChain: return "CalculationChain";
|
|
127
|
+
case XLRelationshipType::ExternalLink: return "ExternalLink";
|
|
128
|
+
case XLRelationshipType::ExternalLinkPath: return "ExternalLinkPath";
|
|
129
|
+
case XLRelationshipType::Theme: return "Theme";
|
|
130
|
+
case XLRelationshipType::Styles: return "Styles";
|
|
131
|
+
case XLRelationshipType::Chart: return "Chart";
|
|
132
|
+
case XLRelationshipType::ChartStyle: return "ChartStyle";
|
|
133
|
+
case XLRelationshipType::ChartColorStyle: return "ChartColorStyle";
|
|
134
|
+
case XLRelationshipType::Image: return "Image";
|
|
135
|
+
case XLRelationshipType::Drawing: return "Drawing";
|
|
136
|
+
case XLRelationshipType::VMLDrawing: return "VMLDrawing";
|
|
137
|
+
case XLRelationshipType::SharedStrings: return "SharedStrings";
|
|
138
|
+
case XLRelationshipType::PrinterSettings: return "PrinterSettings";
|
|
139
|
+
case XLRelationshipType::VBAProject: return "VBAProject";
|
|
140
|
+
case XLRelationshipType::ControlProperties: return "ControlProperties";
|
|
141
|
+
case XLRelationshipType::Comments: return "Comments";
|
|
142
|
+
case XLRelationshipType::Table: return "Table";
|
|
143
|
+
case XLRelationshipType::Unknown: return "Unknown";
|
|
144
|
+
}
|
|
145
|
+
return "invalid";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @details
|
|
150
|
+
*/
|
|
151
|
+
inline XMLNode getRowNode(XMLNode sheetDataNode, uint32_t rowNumber)
|
|
152
|
+
{
|
|
153
|
+
if (rowNumber < 1 || rowNumber > OpenXLSX::MAX_ROWS) { // 2024-05-28: added range check
|
|
154
|
+
using namespace std::literals::string_literals;
|
|
155
|
+
throw XLCellAddressError("rowNumber "s + std::to_string( rowNumber ) + " is outside valid range [1;"s + std::to_string(OpenXLSX::MAX_ROWS) + "]"s);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ===== Get the last child of sheetDataNode that is of type node_element.
|
|
159
|
+
XMLNode result = sheetDataNode.last_child_of_type(pugi::node_element);
|
|
160
|
+
|
|
161
|
+
// ===== If there are now rows in the worksheet, or the requested row is beyond the current max row, append a new row to the end.
|
|
162
|
+
if (result.empty() || (rowNumber > result.attribute("r").as_ullong())) {
|
|
163
|
+
result = sheetDataNode.append_child("row");
|
|
164
|
+
result.append_attribute("r") = rowNumber;
|
|
165
|
+
// result.append_attribute("x14ac:dyDescent") = "0.2";
|
|
166
|
+
// result.append_attribute("spans") = "1:1";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ===== If the requested node is closest to the end, start from the end and search backwards.
|
|
170
|
+
else if (result.attribute("r").as_ullong() - rowNumber < rowNumber) {
|
|
171
|
+
while (not result.empty() && (result.attribute("r").as_ullong() > rowNumber)) result = result.previous_sibling_of_type(pugi::node_element);
|
|
172
|
+
// ===== If the backwards search failed to locate the requested row
|
|
173
|
+
if (result.empty() || (result.attribute("r").as_ullong() != rowNumber)) {
|
|
174
|
+
if (result.empty())
|
|
175
|
+
result = sheetDataNode.prepend_child("row"); // insert a new row node at datasheet begin. When saving, this will keep whitespace formatting towards next row node
|
|
176
|
+
else
|
|
177
|
+
result = sheetDataNode.insert_child_after("row", result);
|
|
178
|
+
result.append_attribute("r") = rowNumber;
|
|
179
|
+
// result.append_attribute("x14ac:dyDescent") = "0.2";
|
|
180
|
+
// result.append_attribute("spans") = "1:1";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ===== Otherwise, start from the beginning
|
|
185
|
+
else {
|
|
186
|
+
// ===== At this point, it is guaranteed that there is at least one node_element in the row that is not empty.
|
|
187
|
+
result = sheetDataNode.first_child_of_type(pugi::node_element);
|
|
188
|
+
|
|
189
|
+
// ===== It has been verified above that the requested rowNumber is <= the row number of the last node_element, therefore this loop will halt.
|
|
190
|
+
while (result.attribute("r").as_ullong() < rowNumber) result = result.next_sibling_of_type(pugi::node_element);
|
|
191
|
+
// ===== If the forwards search failed to locate the requested row
|
|
192
|
+
if (result.attribute("r").as_ullong() > rowNumber) {
|
|
193
|
+
result = sheetDataNode.insert_child_before("row", result);
|
|
194
|
+
|
|
195
|
+
result.append_attribute("r") = rowNumber;
|
|
196
|
+
// result.append_attribute("x14ac:dyDescent") = "0.2";
|
|
197
|
+
// result.append_attribute("spans") = "1:1";
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @brief get the style attribute s for the indicated column, if any is set
|
|
206
|
+
* @param rowNode the row node from which to obtain the parent that should hold the <cols> node
|
|
207
|
+
* @param colNo the column for which to obtain the style
|
|
208
|
+
* @return the XLStyleIndex stored for the column, or XLDefaultCellFormat if none
|
|
209
|
+
*/
|
|
210
|
+
inline XLStyleIndex getColumnStyle(XMLNode rowNode, uint16_t colNo)
|
|
211
|
+
{
|
|
212
|
+
XMLNode cols = rowNode.parent().parent().child("cols");
|
|
213
|
+
if (not cols.empty()) {
|
|
214
|
+
XMLNode col = cols.first_child_of_type(pugi::node_element);
|
|
215
|
+
while (not col.empty()) {
|
|
216
|
+
if (col.attribute("min").as_int(MAX_COLS+1) <= colNo && col.attribute("max").as_int(0) >= colNo) // found
|
|
217
|
+
return col.attribute("style").as_uint(XLDefaultCellFormat);
|
|
218
|
+
col = col.next_sibling_of_type(pugi::node_element);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return XLDefaultCellFormat; // if no col style was found
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @brief set the cell reference, and a default cell style attribute if and only if row or column style is != XLDefaultCellFormat
|
|
226
|
+
* @note row style takes precedence over column style
|
|
227
|
+
* @param cellNode the cell XML node
|
|
228
|
+
* @param cellRef the cell reference (attribute r) to set
|
|
229
|
+
* @param rowNode the row node for the cell
|
|
230
|
+
* @param colNo the column number for this cell (to try and fetch a column style)
|
|
231
|
+
* @param colStyles an optional std::vector<XLStyleIndex> that contains all pre-evaluated column styles,
|
|
232
|
+
* and can be used to avoid performance impact from lookup
|
|
233
|
+
*/
|
|
234
|
+
inline void setDefaultCellAttributes(XMLNode cellNode, const std::string & cellRef, XMLNode rowNode, uint16_t colNo,
|
|
235
|
+
/**/ std::vector<XLStyleIndex> const & colStyles = {})
|
|
236
|
+
{
|
|
237
|
+
cellNode.append_attribute("r").set_value(cellRef.c_str());
|
|
238
|
+
XMLAttribute rowStyle = rowNode.attribute("s");
|
|
239
|
+
XLStyleIndex cellStyle; // scope declaration
|
|
240
|
+
if (rowStyle.empty()) { // if no explicit row style is set
|
|
241
|
+
if (colStyles.size() > 0) // if colStyles were provided
|
|
242
|
+
cellStyle = (colNo > colStyles.size() ? XLDefaultCellFormat : colStyles[ colNo - 1 ]); // determine cellStyle from colStyles
|
|
243
|
+
else // else: no colStyles provided
|
|
244
|
+
cellStyle = getColumnStyle(rowNode, colNo); // so perform a lookup
|
|
245
|
+
}
|
|
246
|
+
else // else: an explicit row style is set
|
|
247
|
+
cellStyle = rowStyle.as_uint(XLDefaultCellFormat); // use the row style
|
|
248
|
+
|
|
249
|
+
if (cellStyle != XLDefaultCellFormat) // if cellStyle was determined as not the default style (no point in setting that)
|
|
250
|
+
cellNode.append_attribute("s").set_value(cellStyle);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @brief Retrieve the xml node representing the cell at the given row and column. If the node doesn't
|
|
255
|
+
* exist, it will be created.
|
|
256
|
+
* @param rowNode The row node under which to find the cell.
|
|
257
|
+
* @param columnNumber The column at which to find the cell.
|
|
258
|
+
* @param rowNumber (optional) row number of the row node, if already known, defaults to 0
|
|
259
|
+
* @param colStyles an optional std::vector<XLStyleIndex> that contains all pre-evaluated column styles,
|
|
260
|
+
* and can be used to avoid performance impact from lookup
|
|
261
|
+
* @return The xml node representing the requested cell.
|
|
262
|
+
*/
|
|
263
|
+
inline XMLNode getCellNode(XMLNode rowNode, uint16_t columnNumber, uint32_t rowNumber = 0,
|
|
264
|
+
/**/ std::vector<XLStyleIndex> const & colStyles = {})
|
|
265
|
+
{
|
|
266
|
+
if (columnNumber < 1 || columnNumber > OpenXLSX::MAX_COLS) { // 2024-08-05: added range check
|
|
267
|
+
using namespace std::literals::string_literals;
|
|
268
|
+
throw XLException("XLWorksheet::column: columnNumber "s + std::to_string(columnNumber) + " is outside allowed range [1;"s + std::to_string(MAX_COLS) + "]"s);
|
|
269
|
+
}
|
|
270
|
+
if (rowNode.empty()) return XMLNode{}; // 2024-05-28: return an empty node in case of empty rowNode
|
|
271
|
+
|
|
272
|
+
XMLNode cellNode = rowNode.last_child_of_type(pugi::node_element);
|
|
273
|
+
if (!rowNumber) rowNumber = rowNode.attribute("r").as_uint(); // if not provided, determine from rowNode
|
|
274
|
+
auto cellRef = XLCellReference(rowNumber, columnNumber);
|
|
275
|
+
|
|
276
|
+
// ===== If there are no cells in the current row, or the requested cell is beyond the last cell in the row...
|
|
277
|
+
if (cellNode.empty() || (XLCellReference(cellNode.attribute("r").value()).column() < columnNumber)) {
|
|
278
|
+
// ===== append a new node to the end.
|
|
279
|
+
cellNode = rowNode.append_child("c");
|
|
280
|
+
setDefaultCellAttributes(cellNode, cellRef.address(), rowNode, columnNumber, colStyles);
|
|
281
|
+
}
|
|
282
|
+
// ===== If the requested node is closest to the end, start from the end and search backwards...
|
|
283
|
+
else if (XLCellReference(cellNode.attribute("r").value()).column() - columnNumber < columnNumber) {
|
|
284
|
+
while (not cellNode.empty() && (XLCellReference(cellNode.attribute("r").value()).column() > columnNumber))
|
|
285
|
+
cellNode = cellNode.previous_sibling_of_type(pugi::node_element);
|
|
286
|
+
// ===== If the backwards search failed to locate the requested cell
|
|
287
|
+
if (cellNode.empty() || (XLCellReference(cellNode.attribute("r").value()).column() < columnNumber)) {
|
|
288
|
+
if (cellNode.empty()) // If between row begin and higher column number, only non-element nodes exist
|
|
289
|
+
cellNode = rowNode.prepend_child("c"); // insert a new cell node at row begin. When saving, this will keep whitespace formatting towards next cell node
|
|
290
|
+
else
|
|
291
|
+
cellNode = rowNode.insert_child_after("c", cellNode);
|
|
292
|
+
setDefaultCellAttributes(cellNode, cellRef.address(), rowNode, columnNumber, colStyles);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// ===== Otherwise, start from the beginning
|
|
296
|
+
else {
|
|
297
|
+
// ===== At this point, it is guaranteed that there is at least one node_element in the row that is not empty.
|
|
298
|
+
cellNode = rowNode.first_child_of_type(pugi::node_element);
|
|
299
|
+
|
|
300
|
+
// ===== It has been verified above that the requested columnNumber is <= the column number of the last node_element, therefore this loop will halt:
|
|
301
|
+
while (XLCellReference(cellNode.attribute("r").value()).column() < columnNumber)
|
|
302
|
+
cellNode = cellNode.next_sibling_of_type(pugi::node_element);
|
|
303
|
+
// ===== If the forwards search failed to locate the requested cell
|
|
304
|
+
if (XLCellReference(cellNode.attribute("r").value()).column() > columnNumber) {
|
|
305
|
+
cellNode = rowNode.insert_child_before("c", cellNode);
|
|
306
|
+
setDefaultCellAttributes(cellNode, cellRef.address(), rowNode, columnNumber, colStyles);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return cellNode;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @brief find the index of nodeName in nodeOrder
|
|
315
|
+
* @param nodeName search this
|
|
316
|
+
* @param nodeOrder in this
|
|
317
|
+
* @return index of nodeName in nodeOrder
|
|
318
|
+
* @return -1 if nodeName is not an element of nodeOrder
|
|
319
|
+
* @note this function uses a vector of std::string_view because std::string is not constexpr-capable, and in
|
|
320
|
+
* a future c++20 build, a std::span could be used to have the node order in any OpenXLSX class be a constexpr
|
|
321
|
+
*/
|
|
322
|
+
constexpr const int SORT_INDEX_NOT_FOUND = -1;
|
|
323
|
+
inline int findStringInVector( std::string const & nodeName, std::vector< std::string_view > const & nodeOrder )
|
|
324
|
+
{
|
|
325
|
+
for (int i = 0; static_cast< size_t >( i ) < nodeOrder.size(); ++i)
|
|
326
|
+
if (nodeName == nodeOrder[ i ]) return i;
|
|
327
|
+
return SORT_INDEX_NOT_FOUND;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @brief copy all leading pc_data nodes from fromNode to toNode
|
|
332
|
+
* @param parent parent node that can perform sibling insertions
|
|
333
|
+
* @param fromNode node whose preceeding whitespaces shall be duplicated
|
|
334
|
+
* @param toNode node before which the duplicated whitespaces shall be inserted
|
|
335
|
+
* @return N/A
|
|
336
|
+
*/
|
|
337
|
+
inline void copyLeadingWhitespaces( XMLNode & parent, XMLNode fromNode, XMLNode toNode )
|
|
338
|
+
{
|
|
339
|
+
fromNode = fromNode.previous_sibling(); // move to preceeding whitespace node, if any
|
|
340
|
+
// loop from back to front, inserting in the same order before toNode
|
|
341
|
+
while (fromNode.type() == pugi::node_pcdata) { // loop ends on pugi::node_element or node_null
|
|
342
|
+
toNode = parent.insert_child_before(pugi::node_pcdata, toNode); // prepend as toNode a new pcdata node
|
|
343
|
+
toNode.set_value(fromNode.value()); // with the value of fromNode
|
|
344
|
+
fromNode = fromNode.previous_sibling();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @brief ensure that node with nodeName exists in parent and return it
|
|
350
|
+
* @param parent parent node that can perform sibling insertions
|
|
351
|
+
* @param nodename name of the node to be (created &) returned
|
|
352
|
+
* @param nodeOrder optional vector of a predefined element node sequence required by MS Office
|
|
353
|
+
* @param force_ns optional force nodeName namespace
|
|
354
|
+
* @return the requested XMLNode or an empty node if the insert operation failed
|
|
355
|
+
* @note 2024-12-19: appendAndGetNode will attempt to perform an ordered insert per nodeOrder if provided
|
|
356
|
+
* Once sufficiently tested, this functionality might be generalized (e.g. in XLXmlParser OpenXLSX_xml_node)
|
|
357
|
+
*/
|
|
358
|
+
inline XMLNode appendAndGetNode(XMLNode & parent, std::string const & nodeName, std::vector< std::string_view > const & nodeOrder = {}, bool force_ns = false )
|
|
359
|
+
{
|
|
360
|
+
if (parent.empty()) return XMLNode{};
|
|
361
|
+
|
|
362
|
+
XMLNode nextNode = parent.first_child_of_type(pugi::node_element);
|
|
363
|
+
if (nextNode.empty()) return parent.prepend_child(nodeName.c_str(), force_ns); // nothing to sort, whitespaces "belong" to parent closing tag
|
|
364
|
+
|
|
365
|
+
XMLNode node{}; // empty until successfully created;
|
|
366
|
+
|
|
367
|
+
int nodeSortIndex = (nodeOrder.size() > 1 ? findStringInVector(nodeName, nodeOrder) : SORT_INDEX_NOT_FOUND);
|
|
368
|
+
if (nodeSortIndex != SORT_INDEX_NOT_FOUND) { // can't sort anything if nodeOrder contains less than 2 entries or does not contain nodeName
|
|
369
|
+
// ===== Find first node to follow nodeName per nodeOrder
|
|
370
|
+
while (not nextNode.empty() && findStringInVector(nextNode.name(), nodeOrder) < nodeSortIndex)
|
|
371
|
+
nextNode = nextNode.next_sibling_of_type(pugi::node_element);
|
|
372
|
+
// ===== Evaluate search result
|
|
373
|
+
if (not nextNode.empty()) { // found nodeName or a node before which nodeName should be inserted
|
|
374
|
+
if( nextNode.name() == nodeName ) // if nodeName was found
|
|
375
|
+
node = nextNode; // use existing node
|
|
376
|
+
else { // else: a node was found before which nodeName must be inserted
|
|
377
|
+
node = parent.insert_child_before(nodeName.c_str(), nextNode, force_ns); // insert before nextNode without whitespaces
|
|
378
|
+
copyLeadingWhitespaces(parent, node, nextNode);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// else: no node was found before which nodeName should be inserted: proceed as usual
|
|
382
|
+
}
|
|
383
|
+
else // no possibility to perform ordered insert - attempt to locate existing node:
|
|
384
|
+
node = parent.child(nodeName.c_str());
|
|
385
|
+
|
|
386
|
+
if( node.empty() ) { // neither nodeName, nor a node following per nodeOrder was found
|
|
387
|
+
// ===== There is no reference to perform an ordered insert for nodeName
|
|
388
|
+
nextNode = parent.last_child_of_type(pugi::node_element); // at least one element node must exist, tested at begin of function
|
|
389
|
+
node = parent.insert_child_after(nodeName.c_str(), nextNode, force_ns); // append as the last element node, but before final whitespaces
|
|
390
|
+
copyLeadingWhitespaces( parent, nextNode, node ); // duplicate the prefix whitespaces of nextNode to node
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return node;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
inline XMLAttribute appendAndGetAttribute(XMLNode & node, std::string const & attrName, std::string const & attrDefaultVal)
|
|
397
|
+
{
|
|
398
|
+
if (node.empty()) return XMLAttribute{};
|
|
399
|
+
XMLAttribute attr = node.attribute(attrName.c_str());
|
|
400
|
+
if (attr.empty()) {
|
|
401
|
+
attr = node.append_attribute(attrName.c_str());
|
|
402
|
+
attr.set_value(attrDefaultVal.c_str());
|
|
403
|
+
}
|
|
404
|
+
return attr;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
inline XMLAttribute appendAndSetAttribute(XMLNode & node, std::string const & attrName, std::string const & attrVal)
|
|
408
|
+
{
|
|
409
|
+
if (node.empty()) return XMLAttribute{};
|
|
410
|
+
XMLAttribute attr = node.attribute(attrName.c_str());
|
|
411
|
+
if (attr.empty())
|
|
412
|
+
attr = node.append_attribute(attrName.c_str());
|
|
413
|
+
attr.set_value(attrVal.c_str()); // silently fails on empty attribute, which is intended here
|
|
414
|
+
return attr;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @brief ensure that node with nodeName exists in parent, has an attribute with attrName and return that attribute
|
|
419
|
+
* @param parent parent node that can perform sibling insertions
|
|
420
|
+
* @param nodename name of the node under which attribute attrName shall exist
|
|
421
|
+
* @param attrName name of the attribute to get for node nodeName
|
|
422
|
+
* @param attrDefaultVal value to assign to the attribute if it has to be created
|
|
423
|
+
* @param nodeOrder optional vector of a predefined element node sequence required by MS Office, passed through to appendAndGetNode
|
|
424
|
+
* @returns the requested XMLAttribute or an empty node if the operation failed
|
|
425
|
+
*/
|
|
426
|
+
inline XMLAttribute appendAndGetNodeAttribute(XMLNode & parent, std::string const & nodeName, std::string const & attrName, std::string const & attrDefaultVal,
|
|
427
|
+
/**/ std::vector< std::string_view > const & nodeOrder = {})
|
|
428
|
+
{
|
|
429
|
+
if (parent.empty()) return XMLAttribute{};
|
|
430
|
+
XMLNode node = appendAndGetNode(parent, nodeName, nodeOrder);
|
|
431
|
+
return appendAndGetAttribute(node, attrName, attrDefaultVal);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* @brief ensure that node with nodeName exists in parent, has an attribute with attrName, set attribute value and return that attribute
|
|
436
|
+
* @param parent parent node that can perform sibling insertions
|
|
437
|
+
* @param nodename name of the node under which attribute attrName shall exist
|
|
438
|
+
* @param attrName name of the attribute to set for node nodeName
|
|
439
|
+
* @param attrVal value to assign to the attribute
|
|
440
|
+
* @param removeAttributes if true, all other attributes of the node with nodeName will be deleted
|
|
441
|
+
* @param nodeOrder optional vector of a predefined element node sequence required by MS Office, passed through to appendAndGetNode
|
|
442
|
+
* @returns the XMLAttribute that was modified or an empty node if the operation failed
|
|
443
|
+
*/
|
|
444
|
+
inline XMLAttribute appendAndSetNodeAttribute(XMLNode & parent, std::string const & nodeName, std::string const & attrName, std::string const & attrVal,
|
|
445
|
+
/**/ bool removeAttributes = XLKeepAttributes, std::vector< std::string_view > const & nodeOrder = {})
|
|
446
|
+
{
|
|
447
|
+
if (parent.empty()) return XMLAttribute{};
|
|
448
|
+
XMLNode node = appendAndGetNode(parent, nodeName, nodeOrder);
|
|
449
|
+
if (removeAttributes) node.remove_attributes();
|
|
450
|
+
return appendAndSetAttribute(node, attrName, attrVal);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* @brief special bool attribute getter function for tags that should have a val="true" or val="false" attribute,
|
|
455
|
+
* but when omitted shall default to "true"
|
|
456
|
+
* @param parent node under which tagName shall be found
|
|
457
|
+
* @param tagName name of the boolean tag to evaluate
|
|
458
|
+
* @param attrName (default: "val") name of boolean attribute that shall default to true
|
|
459
|
+
* @returns true if parent & tagName exist, and attribute with attrName is either omitted or as_bool() returns true. Otherwise return false
|
|
460
|
+
* @note this will create and explicitly set attrName if omitted
|
|
461
|
+
*/
|
|
462
|
+
inline bool getBoolAttributeWhenOmittedMeansTrue( XMLNode & parent, std::string const & tagName, std::string const & attrName = "val" )
|
|
463
|
+
{
|
|
464
|
+
if (parent.empty()) return false; // can't do anything
|
|
465
|
+
XMLNode tagNode = parent.child(tagName.c_str());
|
|
466
|
+
if( tagNode.empty() ) return false; // if tag does not exist: return false
|
|
467
|
+
XMLAttribute valAttr = tagNode.attribute(attrName.c_str());
|
|
468
|
+
if( valAttr.empty() ) { // if no attribute with attrName exists: default to true
|
|
469
|
+
appendAndSetAttribute(tagNode, attrName, "true" ); // explicitly create & set attribute
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
// if execution gets here: attribute with attrName exists
|
|
473
|
+
return valAttr.as_bool(); // return attribute value
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
} // namespace OpenXLSX
|
|
477
|
+
|
|
478
|
+
#endif // OPENXLSX_XLUTILITIES_HPP
|