react-native-nitro-xlsx 0.2.5 → 0.2.7
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 +21 -9
- package/android/CMakeLists.txt +20 -27
- package/cpp/HybridNitroXlsx.cpp +25 -1
- package/cpp/HybridXlsxCellFormat.cpp +46 -146
- package/cpp/HybridXlsxCellFormat.hpp +9 -41
- package/cpp/HybridXlsxConditionalFormat.cpp +4 -1
- package/cpp/HybridXlsxConditionalFormats.cpp +5 -1
- package/cpp/HybridXlsxWorkbook.cpp +38 -8
- package/cpp/HybridXlsxWorkbook.hpp +10 -1
- package/cpp/HybridXlsxWorksheet.cpp +422 -141
- package/cpp/HybridXlsxWorksheet.hpp +4 -1
- package/cpp/XlsxCacheDir.cpp +25 -2
- package/cpp/XlsxCacheDir.hpp +3 -1
- package/cpp/XlsxCellStyle.hpp +360 -0
- package/cpp/XlsxJson.cpp +29 -8
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/scripts/sync-openxlsx-headers.sh +34 -0
- package/src/__mocks__/react-native-nitro-modules.ts +523 -20
- package/src/__tests__/index.test.ts +124 -16
- package/src/index.ts +13 -13
- 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/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/Zippy.hpp +1375 -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 +46 -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,545 @@
|
|
|
1
|
+
#include <cmath>
|
|
2
|
+
#include <iostream>
|
|
3
|
+
#include <string>
|
|
4
|
+
|
|
5
|
+
#include <OpenXLSX.hpp>
|
|
6
|
+
|
|
7
|
+
bool nowide_status()
|
|
8
|
+
{
|
|
9
|
+
#ifdef ENABLE_NOWIDE
|
|
10
|
+
return true;
|
|
11
|
+
#else
|
|
12
|
+
return false;
|
|
13
|
+
#endif
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
using namespace std;
|
|
17
|
+
using namespace OpenXLSX;
|
|
18
|
+
|
|
19
|
+
int main()
|
|
20
|
+
{
|
|
21
|
+
cout << "********************************************************************************\n";
|
|
22
|
+
cout << "DEMO PROGRAM #10: XLStyles Usage and XLSheet conditional formatting\n";
|
|
23
|
+
cout << "********************************************************************************\n";
|
|
24
|
+
|
|
25
|
+
std::cout << "nowide is " << ( nowide_status() ? "enabled" : "disabled" ) << std::endl;
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* TODO: align XLStyles.cpp with known documentation of xl/styles.xml as far as support is desired
|
|
29
|
+
* * XLAlignmentStyle: check / throw if vertical alignments are used as horizontal and vice versa
|
|
30
|
+
* * XLStyles ::create functions: implement good default style properties for all styles
|
|
31
|
+
* * support "colors"
|
|
32
|
+
* * support "dxfs"
|
|
33
|
+
* * support "tableStyles"
|
|
34
|
+
* TODO TBD: permit setting a format reference for shared strings
|
|
35
|
+
*
|
|
36
|
+
* DONE: XLFills: support patternFill patternType (XLFillPattern)
|
|
37
|
+
* DONE: XLFonts: support scheme major/minor/none (<font><scheme val="major"/></font>)
|
|
38
|
+
* DONE: XLFonts: support vertical align run style (<font><vertAlign val="subscript"/></font>)
|
|
39
|
+
* DONE: XLFills: support gradientFill
|
|
40
|
+
* DONE: support complete for: "borders", "cellStyles", "cellStyleXfs", "cellXfs", "numFmts"
|
|
41
|
+
* DONE: support nearly complete (exceptions above) for: "fonts"
|
|
42
|
+
* DONE: support for xfId / setXfId in XLStyles::cellFormats, but not(!) in XLStyles::cellStyleFormats
|
|
43
|
+
* DONE: format support for XLCells (cellFormat / setCellFormat)
|
|
44
|
+
* DONE: format support for XLRows: <row> attributes s (same as cell attribute) and customFormat (=true/false)
|
|
45
|
+
* XLWorksheet::setRowFormat overwrites existing cell formats, and
|
|
46
|
+
* row format is then used by OpenXLSX for new cells created in that row
|
|
47
|
+
* DONE: format support for XLColumns: <col> attributes style (same as cell attribute s)
|
|
48
|
+
* XLWorksheet::setColumnFormat overwrites existing cell formats, and
|
|
49
|
+
* column format is then used by OpenXLSX as default for new cells created in that column when they do not have a row style
|
|
50
|
+
* DONE: update style elements "count" attribute for all arrays when saving
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
// create new workbook
|
|
54
|
+
XLDocument doc{};
|
|
55
|
+
doc.create("./Demo10.xlsx", XLForceOverwrite);
|
|
56
|
+
// doc.open("./Demo10.xlsx");
|
|
57
|
+
|
|
58
|
+
std::cout << "doc.name() is " << doc.name() << std::endl;
|
|
59
|
+
|
|
60
|
+
XLNumberFormats & numberFormats = doc.styles().numberFormats();
|
|
61
|
+
XLFonts & fonts = doc.styles().fonts();
|
|
62
|
+
XLFills & fills = doc.styles().fills();
|
|
63
|
+
XLBorders & borders = doc.styles().borders();
|
|
64
|
+
XLCellFormats & cellStyleFormats = doc.styles().cellStyleFormats();
|
|
65
|
+
XLCellFormats & cellFormats = doc.styles().cellFormats();
|
|
66
|
+
XLCellStyles & cellStyles = doc.styles().cellStyles();
|
|
67
|
+
|
|
68
|
+
XLWorksheet wks = doc.workbook().worksheet(1);
|
|
69
|
+
XLStyleIndex cellFormatIndexA2 = wks.cell("A2").cellFormat(); // get index of cell format
|
|
70
|
+
XLStyleIndex fontIndexA2 = cellFormats[ cellFormatIndexA2 ].fontIndex(); // get index of used font
|
|
71
|
+
|
|
72
|
+
XLStyleIndex newFontIndex = fonts.create( fonts[ fontIndexA2 ] ); // create a new font based on used font
|
|
73
|
+
XLStyleIndex newCellFormatIndex // create a new cell format
|
|
74
|
+
= cellFormats.create( cellFormats[ cellFormatIndexA2 ] ); // based on used format
|
|
75
|
+
|
|
76
|
+
cellFormats[ newCellFormatIndex ].setFontIndex( newFontIndex ); // assign the new font to the new cell format
|
|
77
|
+
wks.cell("A2").setCellFormat( newCellFormatIndex ); // assign the new cell format to the cell
|
|
78
|
+
|
|
79
|
+
// // change the new font style:
|
|
80
|
+
fonts[ newFontIndex ].setFontName("Arial");
|
|
81
|
+
// fonts[ newFontIndex ].setFontFamily(4); // info for font substitution on a system where a font with that name is not available
|
|
82
|
+
// fonts[ newFontIndex ].setFontCharset(0xa1); // set Greek character set (example)
|
|
83
|
+
fonts[ newFontIndex ].setFontSize(14);
|
|
84
|
+
fonts[ newFontIndex ].setScheme( XLFontSchemeNone ); // unset any potential font scheme - this is important to prevent application of a different
|
|
85
|
+
/**/ // font formatting which might override the new setting - not yet fully understood where the scheme formatting is coming from
|
|
86
|
+
/**/ // NOTE: not yet fully understood where the scheme formatting would be coming from
|
|
87
|
+
XLColor red ( "ffff0000" );
|
|
88
|
+
XLColor green ( "ff00ff00" );
|
|
89
|
+
XLColor blue ( "ff0000ff" );
|
|
90
|
+
XLColor yellow( "ffffff00" );
|
|
91
|
+
fonts[ newFontIndex ].setFontColor( green );
|
|
92
|
+
fonts[ newFontIndex ].setBold(); // bold
|
|
93
|
+
fonts[ newFontIndex ].setItalic(); // italic
|
|
94
|
+
fonts[ newFontIndex ].setStrikethrough(); // strikethrough
|
|
95
|
+
fonts[ newFontIndex ].setUnderline(XLUnderlineDouble); // underline: XLUnderlineSingle, XLUnderlineDouble, XLUnderlineNone
|
|
96
|
+
fonts[ newFontIndex ].setUnderline(XLUnderlineNone); // TEST: un-set the underline status
|
|
97
|
+
|
|
98
|
+
cellFormats[ newCellFormatIndex ].setApplyFont( true ); // apply the font (seems to do nothing)
|
|
99
|
+
|
|
100
|
+
wks.cell("A25" ) = "42"; // NEW functionality: XLCellAssignable now has a direct value assignment overload
|
|
101
|
+
std::cout << "wks A25 value is " << wks.cell("A25" ) << std::endl;
|
|
102
|
+
|
|
103
|
+
XLCellRange cellRange = wks.range("A3", "Z10"); // NEW functionality: range based on cell reference strings
|
|
104
|
+
std::cout << "range " << cellRange.address() // NEW: cell range address
|
|
105
|
+
<< " with top left " << cellRange.topLeft().address() // NEW: cell range topLeft cell reference
|
|
106
|
+
<< " and bottom right " << cellRange.bottomRight().address() // NEW: cell range bottomRight cell reference
|
|
107
|
+
<< " contains " << cellRange.numRows() << " rows, " << cellRange.numColumns() << " columns" << std::endl;
|
|
108
|
+
|
|
109
|
+
cellRange = wks.range("A1:XFD100"); // NEW functionality: range based on range reference
|
|
110
|
+
std::cout << "range " << cellRange.address() << " contains " << cellRange.numRows() << " rows, " << cellRange.numColumns() << " columns" << std::endl;
|
|
111
|
+
|
|
112
|
+
XLStyleIndex fontBold = fonts.create();
|
|
113
|
+
fonts[ fontBold ].setBold();
|
|
114
|
+
XLStyleIndex boldDefault = cellFormats.create();
|
|
115
|
+
cellFormats[ boldDefault ].setFontIndex( fontBold );
|
|
116
|
+
|
|
117
|
+
cellRange = wks.range("A5:Z5");
|
|
118
|
+
cellRange = "this is a bold range"; // NEW functionality: XLCellRange now has a direct value assignment overload
|
|
119
|
+
cellRange.setFormat( boldDefault ); // NEW functionality: XLCellRange supports setting format for all cells in the range
|
|
120
|
+
|
|
121
|
+
XLStyleIndex fontItalic = fonts.create();
|
|
122
|
+
fonts[ fontItalic ].setItalic();
|
|
123
|
+
XLStyleIndex italicDefault = cellFormats.create();
|
|
124
|
+
cellFormats[ italicDefault ].setFontIndex( fontItalic );
|
|
125
|
+
|
|
126
|
+
cellRange = wks.range("E1:E100");
|
|
127
|
+
cellRange = "this is an italic range";
|
|
128
|
+
cellRange.setFormat( italicDefault );
|
|
129
|
+
|
|
130
|
+
cellRange = wks.range("A10:Z11");
|
|
131
|
+
cellRange = "lalala"; // create cells if they do not exist by assigning values to them
|
|
132
|
+
XLRow row = wks.row(10);
|
|
133
|
+
row.cells() = "this is an italic row"; // NEW functionality: overwrite value for all *existing* cells in row
|
|
134
|
+
wks.setRowFormat( row.rowNumber(), italicDefault ); // NEW functionality: set format for all (existing) cells in row, and row format to be used as default for future cells
|
|
135
|
+
|
|
136
|
+
cellRange = wks.range("J1:J100");
|
|
137
|
+
cellRange = "this is a bold column";
|
|
138
|
+
XLColumn col = wks.column("J"); // NEW functionality: XLWorksheet::column now supports getting a column from a column reference
|
|
139
|
+
wks.setColumnFormat( XLCellReference::columnAsNumber("J"), boldDefault ); // NEW functionality: set format for all (existing) cells in column, and column format to be used as default for future cells
|
|
140
|
+
|
|
141
|
+
wks.setRowFormat( 11, newCellFormatIndex ); // set row 11 to bold italic underline strikethrough font with color as formatted above
|
|
142
|
+
XLStyleIndex redFormat = cellFormats.create( cellFormats[ newCellFormatIndex ] );
|
|
143
|
+
XLStyleIndex redFont = fonts.create();
|
|
144
|
+
fonts[ redFont ].setFontColor( red );
|
|
145
|
+
cellFormats[ redFormat ].setFontIndex( redFont );
|
|
146
|
+
cellRange = wks.range("B2:P5");
|
|
147
|
+
cellRange = "red range";
|
|
148
|
+
wks.cell(cellRange.topLeft()).value() = "red range " + cellRange.address() + " top left cell";
|
|
149
|
+
wks.cell(cellRange.bottomRight()).value() = "red range " + cellRange.address() + " bottom right cell";
|
|
150
|
+
cellRange.setFormat( redFormat );
|
|
151
|
+
|
|
152
|
+
// // get the relevant style objects for easy access
|
|
153
|
+
// XLCellFormats & cellFormats = doc.styles().cellFormats();
|
|
154
|
+
// XLFonts & fonts = doc.styles().fonts();
|
|
155
|
+
// XLFills & fills = doc.styles().fills();
|
|
156
|
+
|
|
157
|
+
XLCellRange myCellRange = wks.range("B20:P25"); // create a new range for formatting
|
|
158
|
+
myCellRange = "TEST COLORS"; // write some values to the cells so we can see format changes
|
|
159
|
+
XLStyleIndex baseFormat = wks.cell("B20").cellFormat(); // determine the style used in B20
|
|
160
|
+
XLStyleIndex newCellStyle = cellFormats.create( cellFormats[ baseFormat ] ); // create a new style based on the style in B20
|
|
161
|
+
XLStyleIndex newFontStyle = fonts.create(fonts[ cellFormats[ baseFormat ].fontIndex() ]); // create a new font style based on the used font
|
|
162
|
+
XLStyleIndex newFillStyle = fills.create(fills[ cellFormats[ baseFormat ].fillIndex() ]); // create a new fill style based on the used fill
|
|
163
|
+
|
|
164
|
+
fonts[ newFontStyle ].setFontColor( green );
|
|
165
|
+
cellFormats[ newCellStyle ].setFontIndex( newFontStyle );
|
|
166
|
+
|
|
167
|
+
fills[ newFillStyle ].setPatternType ( XLPatternNone );
|
|
168
|
+
fills[ newFillStyle ].setPatternType ( XLPatternSolid );
|
|
169
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternMediumGray );
|
|
170
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkGray );
|
|
171
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightGray );
|
|
172
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkHorizontal );
|
|
173
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkVertical );
|
|
174
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkDown );
|
|
175
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkUp );
|
|
176
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkGrid );
|
|
177
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternDarkTrellis );
|
|
178
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightHorizontal );
|
|
179
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightVertical );
|
|
180
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightDown );
|
|
181
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightUp );
|
|
182
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightGrid );
|
|
183
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternLightTrellis );
|
|
184
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternGray125 );
|
|
185
|
+
// fills[ newFillStyle ].setPatternType ( XLPatternGray0625 );
|
|
186
|
+
fills[ newFillStyle ].setColor ( yellow );
|
|
187
|
+
fills[ newFillStyle ].setBackgroundColor( blue ); // blue, setBackgroundColor only makes sense with gradient fills
|
|
188
|
+
cellFormats[ newCellStyle ].setFillIndex( newFillStyle );
|
|
189
|
+
|
|
190
|
+
myCellRange.setFormat( newCellStyle ); // assign the new format to the full range of cells
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
// XLFill -> XLGradientFill test:
|
|
194
|
+
myCellRange = wks.range("B30:P35"); // create a new range for formatting
|
|
195
|
+
myCellRange = "TEST GRADIENT"; // write some values to the cells so we can see format changes
|
|
196
|
+
baseFormat = wks.cell("B30").cellFormat(); // determine the style used in B20
|
|
197
|
+
newCellStyle = cellFormats.create( cellFormats[ baseFormat ] ); // create a new style based on the style in B20
|
|
198
|
+
XLStyleIndex testGradientIndex = fills.create(fills[ cellFormats[ baseFormat ].fillIndex() ]); // create a new fill style based on the used fill
|
|
199
|
+
|
|
200
|
+
fills[ testGradientIndex ].setFillType( XLPatternFill ); // set the "wrong" fill type
|
|
201
|
+
fills[ testGradientIndex ].setFillType( XLGradientFill, XLForceFillType ); // override that with a gradientFill
|
|
202
|
+
fills[ testGradientIndex ].setGradientType( XLGradientLinear ); // the gradient type
|
|
203
|
+
|
|
204
|
+
// configure the gradient stops
|
|
205
|
+
XLGradientStops stops = fills[ testGradientIndex ].stops();
|
|
206
|
+
|
|
207
|
+
// first XLGradientStop
|
|
208
|
+
XLStyleIndex stopIndex = stops.create();
|
|
209
|
+
XLDataBarColor stopColor = stops[ stopIndex ].color();
|
|
210
|
+
stops[ stopIndex ].setPosition(0.1);
|
|
211
|
+
stopColor.setRgb( green );
|
|
212
|
+
// stopColor.setTint( 1.01 );
|
|
213
|
+
// stopColor.setAutomatic();
|
|
214
|
+
// stopColor.setIndexed( 77 );
|
|
215
|
+
// stopColor.setTheme( 79 );
|
|
216
|
+
|
|
217
|
+
// second XLGradientStop
|
|
218
|
+
stopIndex = stops.create(stops[stopIndex]); // create another stop using previous stop as template
|
|
219
|
+
stopColor.set( yellow );
|
|
220
|
+
stops[ stopIndex ].setPosition(0.5);
|
|
221
|
+
|
|
222
|
+
cellFormats[ newCellStyle ].setFillIndex( testGradientIndex );
|
|
223
|
+
|
|
224
|
+
myCellRange.setFormat( newCellStyle ); // assign the new format to the full range of cells
|
|
225
|
+
|
|
226
|
+
// ===== BEGIN cell borders demo
|
|
227
|
+
XLStyleIndex borderFormat = 0; // scope declaration
|
|
228
|
+
{
|
|
229
|
+
// create a new cell format based on the current C3 format & assign it back to C3
|
|
230
|
+
XLStyleIndex borderedCellFormat = cellFormats.create( cellFormats[ wks.cell("C7").cellFormat() ] );
|
|
231
|
+
wks.cell("C7").setCellFormat( borderedCellFormat );
|
|
232
|
+
wks.cell("C7") = "borders demo";
|
|
233
|
+
|
|
234
|
+
// ===== Create a new border format style & assign it to the new cell format
|
|
235
|
+
borderFormat = borders.create();
|
|
236
|
+
// NOTE: the new border format uses a default (empty) borders object to demonstrate OpenXLSX ordered inserts.
|
|
237
|
+
// Using an existing border style as a template would copy the OpenXLSX default border style which
|
|
238
|
+
// already contains elements in the correct sequence, so that inserts could not be demonstrated.
|
|
239
|
+
cellFormats[ borderedCellFormat ].setBorderIndex( borderFormat );
|
|
240
|
+
|
|
241
|
+
borders[ borderFormat ].setDiagonalUp( false ); // setting this to true will apply the diagonal line style
|
|
242
|
+
borders[ borderFormat ].setDiagonalDown( true ); // - both diagonals can be applied simultaneously, but only with the same style
|
|
243
|
+
borders[ borderFormat ].setOutline( true ); // not sure if this is needed at all
|
|
244
|
+
|
|
245
|
+
// ===== Insert lines in a "wrong" sequence that MS Office would refuse to accept, to demonstrate XLStyles ordered inserting capability
|
|
246
|
+
borders[ borderFormat ].setHorizontal( XLLineStyleHair, XLColor( "ff446688" ) );
|
|
247
|
+
borders[ borderFormat ].setVertical ( XLLineStyleDouble, XLColor( "ff443322" ) );
|
|
248
|
+
borders[ borderFormat ].setDiagonal ( XLLineStyleThick, XLColor( "ff332222" ), -0.25 );
|
|
249
|
+
borders[ borderFormat ].setBottom ( XLLineStyleDotted, XLColor( "ff222222" ), 0.25 );
|
|
250
|
+
borders[ borderFormat ].setTop ( XLLineStyleDashed, XLColor( "ff114444" ) );
|
|
251
|
+
borders[ borderFormat ].setRight ( XLLineStyleMedium, XLColor( "ff113333" ) );
|
|
252
|
+
borders[ borderFormat ].setLeft ( XLLineStyleThin, XLColor( "ff112222" ) );
|
|
253
|
+
std::cout << "#1 borders[ " << borderFormat << " ] summary: " << borders[ borderFormat ].summary() << std::endl;
|
|
254
|
+
|
|
255
|
+
// test additional line styles with setter function:
|
|
256
|
+
borders[ borderFormat ].setLine ( XLLineVertical, XLLineStyleSlantDashDot, XLColor( XLDefaultFontColor ) );
|
|
257
|
+
borders[ borderFormat ].setLine ( XLLineDiagonal, XLLineStyleMediumDashDotDot, XLColor( XLDefaultFontColor ), -1.0 );
|
|
258
|
+
borders[ borderFormat ].setLine ( XLLineBottom, XLLineStyleDashDotDot, XLColor( XLDefaultFontColor ), -0.1 );
|
|
259
|
+
borders[ borderFormat ].setLine ( XLLineTop, XLLineStyleMediumDashDot, green );
|
|
260
|
+
borders[ borderFormat ].setLine ( XLLineRight, XLLineStyleDashDot, XLColor( XLDefaultFontColor ), 1.0 );
|
|
261
|
+
borders[ borderFormat ].setLine ( XLLineLeft, XLLineStyleMediumDashed, XLColor( XLDefaultFontColor ) );
|
|
262
|
+
std::cout << "#2 borders[ " << borderFormat << " ] summary: " << borders[ borderFormat ].summary() << std::endl;
|
|
263
|
+
|
|
264
|
+
// test direct access to line properties (read: the XLDataBarColor)
|
|
265
|
+
XLLine leftLine = borders[ borderFormat ].left();
|
|
266
|
+
XLDataBarColor leftLineColor = leftLine.color();
|
|
267
|
+
leftLineColor.setRgb( blue );
|
|
268
|
+
leftLineColor.setTint( -0.2 );
|
|
269
|
+
leftLineColor.setAutomatic();
|
|
270
|
+
leftLineColor.setIndexed( 606 );
|
|
271
|
+
leftLineColor.setTheme( 707 );
|
|
272
|
+
std::cout << "#2 borders, leftLine summary: " << leftLine.summary() << std::endl;
|
|
273
|
+
// unset some properties
|
|
274
|
+
leftLineColor.setTint( -0.1 );
|
|
275
|
+
leftLineColor.setAutomatic( false );
|
|
276
|
+
leftLineColor.setIndexed( 0 );
|
|
277
|
+
leftLineColor.setTheme( XLDeleteProperty );
|
|
278
|
+
// NOTE: XLDeleteProperty can be used to remove a property from XML where a value of 0 would not accomplish the same
|
|
279
|
+
// formatting. Currently, only XLDataBarColor::setTheme supports this functionality. More can be added as properties
|
|
280
|
+
// are discovered that have the same problem (theme="" still overrides e.g. the line color)
|
|
281
|
+
std::cout << "#2 borders, leftLineColor summary: " << leftLineColor.summary() << std::endl;
|
|
282
|
+
}
|
|
283
|
+
// ===== END cell borders demo ===== //
|
|
284
|
+
|
|
285
|
+
// enable testBasics = true to create/modify at least one entry in each known styles array
|
|
286
|
+
// disable testBasics = false to stop the demo execution here and save the document
|
|
287
|
+
bool testBasics = false;
|
|
288
|
+
// CAUTION: setting testBasics = true will cause MS Excel to complain about document errors
|
|
289
|
+
// the purpose of this scope is to prove desired modification of the underlying XML
|
|
290
|
+
// tags for direct inspection with unzip + xmllint + text editor.
|
|
291
|
+
// The testBasics scope makes no attempt to generate meaningful or consistent style information.
|
|
292
|
+
|
|
293
|
+
if( testBasics ) {
|
|
294
|
+
std::cout << " numberFormats.count() is " << numberFormats.count() << std::endl;
|
|
295
|
+
std::cout << " fonts.count() is " << fonts.count() << std::endl;
|
|
296
|
+
std::cout << " fills.count() is " << fills.count() << std::endl;
|
|
297
|
+
std::cout << " borders.count() is " << borders.count() << std::endl;
|
|
298
|
+
std::cout << "cellStyleFormats.count() is " << cellStyleFormats.count() << std::endl;
|
|
299
|
+
std::cout << " cellFormats.count() is " << cellFormats.count() << std::endl;
|
|
300
|
+
std::cout << " cellStyles.count() is " << cellStyles.count() << std::endl;
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
// enable createAll = true to create a new entry in each known styles array and modify that
|
|
304
|
+
// disable createAll = false to modify the last entry in each styles array instead
|
|
305
|
+
bool createAll = true;
|
|
306
|
+
|
|
307
|
+
XLStyleIndex nodeIndex;
|
|
308
|
+
|
|
309
|
+
nodeIndex = ( createAll ? numberFormats.create() : numberFormats.count() - 1 );
|
|
310
|
+
numberFormats[ nodeIndex ].setNumberFormatId( 15 );
|
|
311
|
+
numberFormats[ nodeIndex ].setFormatCode( "fifteen" );
|
|
312
|
+
std::cout << "numberFormats[ " << nodeIndex << " ] summary: " << numberFormats[ nodeIndex ].summary() << std::endl;
|
|
313
|
+
|
|
314
|
+
nodeIndex = ( createAll ? fonts.create() : fonts.count() - 1 );
|
|
315
|
+
fonts[ nodeIndex ].setFontName( "Twelve" );
|
|
316
|
+
fonts[ nodeIndex ].setFontCharset( 13 );
|
|
317
|
+
fonts[ nodeIndex ].setFontFamily( 14 );
|
|
318
|
+
fonts[ nodeIndex ].setFontSize( 15 );
|
|
319
|
+
fonts[ nodeIndex ].setFontColor( XLColor( XLDefaultFontColor ) );
|
|
320
|
+
fonts[ nodeIndex ].setBold(); // bold
|
|
321
|
+
fonts[ nodeIndex ].setItalic(); // italic
|
|
322
|
+
fonts[ nodeIndex ].setStrikethrough(); // strikethrough
|
|
323
|
+
fonts[ nodeIndex ].setUnderline(XLUnderlineDouble); // underline: XLUnderlineSingle, XLUnderlineDouble, XLUnderlineNone
|
|
324
|
+
fonts[ nodeIndex ].setScheme(XLFontSchemeMajor);
|
|
325
|
+
// fonts[ nodeIndex ].setScheme(XLFontSchemeMinor);
|
|
326
|
+
// fonts[ nodeIndex ].setScheme(XLFontSchemeNone);
|
|
327
|
+
// fonts[ nodeIndex ].setScheme(XLFontSchemeInvalid);
|
|
328
|
+
fonts[ nodeIndex ].setVertAlign(XLSubscript);
|
|
329
|
+
// fonts[ nodeIndex ].setVertAlign(XLBaseline);
|
|
330
|
+
// fonts[ nodeIndex ].setVertAlign(XLSuperscript);
|
|
331
|
+
// fonts[ nodeIndex ].setVertAlign(XLVerticalAlignRunInvalid);
|
|
332
|
+
fonts[ nodeIndex ].setOutline();
|
|
333
|
+
fonts[ nodeIndex ].setShadow();
|
|
334
|
+
fonts[ nodeIndex ].setCondense();
|
|
335
|
+
fonts[ nodeIndex ].setExtend();
|
|
336
|
+
std::cout << "fonts[ " << nodeIndex << " ] summary: " << fonts[ nodeIndex ].summary() << std::endl;
|
|
337
|
+
|
|
338
|
+
// XLFill -> XLPatternFill test:
|
|
339
|
+
nodeIndex = ( createAll ? fills.create() : fills.count() - 1 );
|
|
340
|
+
fills[ nodeIndex ].setFillType( XLPatternFill );
|
|
341
|
+
fills[ nodeIndex ].setPatternType( XLPatternSolid );
|
|
342
|
+
// fills[ nodeIndex ].setPatternType( XLPatternTypeInvalid );
|
|
343
|
+
fills[ nodeIndex ].setColor ( XLColor( XLDefaultPatternFgColor ) );
|
|
344
|
+
fills[ nodeIndex ].setBackgroundColor( XLColor( XLDefaultPatternBgColor ) );
|
|
345
|
+
|
|
346
|
+
// output summary of previously created style with a gradient fill
|
|
347
|
+
std::cout << "fills[ " << testGradientIndex << " ] summary: " << fills[ testGradientIndex ].summary() << std::endl;
|
|
348
|
+
|
|
349
|
+
// output summary of newly created style
|
|
350
|
+
std::cout << "fills[ " << nodeIndex << " ] summary: " << fills[ nodeIndex ].summary() << std::endl;
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
nodeIndex = ( createAll ? cellStyleFormats.create() : cellStyleFormats.count() - 1 );
|
|
354
|
+
cellStyleFormats[ nodeIndex ].setNumberFormatId( 5 );
|
|
355
|
+
cellStyleFormats[ nodeIndex ].setFontIndex( 6 );
|
|
356
|
+
cellStyleFormats[ nodeIndex ].setFillIndex( 7 );
|
|
357
|
+
cellStyleFormats[ nodeIndex ].setBorderIndex( 8 );
|
|
358
|
+
cellStyleFormats[ nodeIndex ].setApplyFont(true);
|
|
359
|
+
cellStyleFormats[ nodeIndex ].setApplyFill(false);
|
|
360
|
+
cellStyleFormats[ nodeIndex ].setApplyBorder(false);
|
|
361
|
+
cellStyleFormats[ nodeIndex ].setApplyAlignment(true);
|
|
362
|
+
cellStyleFormats[ nodeIndex ].setApplyProtection(false);
|
|
363
|
+
cellStyleFormats[ nodeIndex ].setLocked(true);
|
|
364
|
+
cellStyleFormats[ nodeIndex ].setHidden(false);
|
|
365
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setHorizontal(XLAlignRight);
|
|
366
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setVertical(XLAlignCenter);
|
|
367
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setTextRotation(255);
|
|
368
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setWrapText(true);
|
|
369
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setIndent(256);
|
|
370
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setRelativeIndent(-255);
|
|
371
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setJustifyLastLine(true);
|
|
372
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setShrinkToFit(false);
|
|
373
|
+
cellStyleFormats[ nodeIndex ].alignment(XLCreateIfMissing).setReadingOrder(XLReadingOrderLeftToRight);
|
|
374
|
+
|
|
375
|
+
try { cellStyleFormats[ nodeIndex ].setXfId(9); } // TEST: this should throw
|
|
376
|
+
catch (XLException const & e) {
|
|
377
|
+
std::cout << "cellStyleFormats NOMINAL EXCEPTION: " << e.what() << std::endl;
|
|
378
|
+
}
|
|
379
|
+
try { (void) cellStyleFormats[ nodeIndex ].xfId(); } // TEST: this should throw
|
|
380
|
+
catch (XLException const & e) {
|
|
381
|
+
std::cout << "cellStyleFormats NOMINAL EXCEPTION: " << e.what() << std::endl;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
std::cout << "cellStyleFormats[ " << nodeIndex << " ] summary: " << cellStyleFormats[ nodeIndex ].summary() << std::endl;
|
|
385
|
+
|
|
386
|
+
nodeIndex = ( createAll ? cellFormats.create() : cellFormats.count() - 1 );
|
|
387
|
+
cellFormats[ nodeIndex ].setNumberFormatId( 22 );
|
|
388
|
+
cellFormats[ nodeIndex ].setFontIndex( 23 );
|
|
389
|
+
cellFormats[ nodeIndex ].setFillIndex( 24 );
|
|
390
|
+
cellFormats[ nodeIndex ].setBorderIndex( 25 );
|
|
391
|
+
cellFormats[ nodeIndex ].setApplyNumberFormat(true);
|
|
392
|
+
cellFormats[ nodeIndex ].setApplyFont(false);
|
|
393
|
+
cellFormats[ nodeIndex ].setApplyFill(true);
|
|
394
|
+
cellFormats[ nodeIndex ].setApplyBorder(true);
|
|
395
|
+
cellFormats[ nodeIndex ].setApplyAlignment(false);
|
|
396
|
+
cellFormats[ nodeIndex ].setApplyProtection(true);
|
|
397
|
+
cellFormats[ nodeIndex ].setQuotePrefix(true);
|
|
398
|
+
cellFormats[ nodeIndex ].setPivotButton(true);
|
|
399
|
+
cellFormats[ nodeIndex ].setLocked(false);
|
|
400
|
+
cellFormats[ nodeIndex ].setHidden(true);
|
|
401
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setHorizontal(XLAlignGeneral);
|
|
402
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setVertical(XLAlignTop);
|
|
403
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setTextRotation(370);
|
|
404
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setWrapText(false);
|
|
405
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setIndent(37);
|
|
406
|
+
cellFormats[ nodeIndex ].alignment(XLCreateIfMissing).setShrinkToFit(true);
|
|
407
|
+
cellFormats[ nodeIndex ].setXfId(26);
|
|
408
|
+
std::cout << "cellFormats[ " << nodeIndex << " ] summary: " << cellFormats[ nodeIndex ].summary() << std::endl;
|
|
409
|
+
|
|
410
|
+
nodeIndex = ( createAll ? cellStyles.create() : cellStyles.count() - 1 );
|
|
411
|
+
cellStyles[ nodeIndex ].setName( "test cellStyle" );
|
|
412
|
+
cellStyles[ nodeIndex ].setXfId( 77 );
|
|
413
|
+
cellStyles[ nodeIndex ].setBuiltinId( 7 );
|
|
414
|
+
cellStyles[ nodeIndex ].setOutlineStyle( 8 );
|
|
415
|
+
cellStyles[ nodeIndex ].setHidden( true );
|
|
416
|
+
cellStyles[ nodeIndex ].setCustomBuiltin( true );
|
|
417
|
+
std::cout << "cellStyles[ " << nodeIndex << " ] summary: " << cellStyles[ nodeIndex ].summary() << std::endl;
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
std::cout << " numberFormats.count() is " << numberFormats.count() << std::endl;
|
|
421
|
+
std::cout << " fonts.count() is " << fonts.count() << std::endl;
|
|
422
|
+
std::cout << " fills.count() is " << fills.count() << std::endl;
|
|
423
|
+
std::cout << " borders.count() is " << borders.count() << std::endl;
|
|
424
|
+
std::cout << "cellStyleFormats.count() is " << cellStyleFormats.count() << std::endl;
|
|
425
|
+
std::cout << " cellFormats.count() is " << cellFormats.count() << std::endl;
|
|
426
|
+
std::cout << " cellStyles.count() is " << cellStyles.count() << std::endl;
|
|
427
|
+
} // end if( testBasics )
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
XLStyleIndex mergedCellFormat = cellFormats.create( cellFormats[ wks.cell("E4").cellFormat() ] );
|
|
431
|
+
cellFormats[ mergedCellFormat ].alignment(XLCreateIfMissing).setHorizontal(XLAlignCenter);
|
|
432
|
+
cellFormats[ mergedCellFormat ].alignment(XLCreateIfMissing).setVertical(XLAlignTop);
|
|
433
|
+
cellFormats[ mergedCellFormat ].alignment(XLCreateIfMissing).setTextRotation(5);
|
|
434
|
+
cellFormats[ mergedCellFormat ].alignment(XLCreateIfMissing).setWrapText(true);
|
|
435
|
+
|
|
436
|
+
wks.cell("E4") = "merged red range #1\n - hidden cell values are intact!";
|
|
437
|
+
wks.mergeCells("E4:G7"); // merge cells without deletion of contents
|
|
438
|
+
|
|
439
|
+
// How to get the value of a merged range that a cell is a part of (by getting the top left cell first)
|
|
440
|
+
std::cout << "value of cell F6 is " << wks.cell("F6") << std::endl; // empty
|
|
441
|
+
XLMergeCells merges = wks.merges(); // get the worksheet's collection of merged ranges
|
|
442
|
+
int32_t mergeIndexForF6 = merges.findMergeByCell("F6"); // determine if F6 is contained within any merge
|
|
443
|
+
if( mergeIndexForF6 != -1 ) { // if cell is found at mergeIndexForF6
|
|
444
|
+
std::string mergeRef = merges[ mergeIndexForF6 ]; // get the actual merge reference
|
|
445
|
+
size_t pos = mergeRef.find_first_of(':'); //
|
|
446
|
+
XLCellReference topLeftRef(mergeRef.substr(0, pos)); // extract from the merge the top left cell
|
|
447
|
+
|
|
448
|
+
// output information about the merge
|
|
449
|
+
std::cout << "mergeIndexForF6 is " << mergeIndexForF6 << " , this merge reference is " << mergeRef << " and the top left cell is " << topLeftRef.address() << std::endl;
|
|
450
|
+
// output the value of the merge's top left cell
|
|
451
|
+
std::cout << "value of cell F6 by merge is \"" << wks.cell(topLeftRef) << "\"" << std::endl;
|
|
452
|
+
}
|
|
453
|
+
XLStyleIndex mergedCellFormatWithBorder = cellFormats.create( cellFormats[ mergedCellFormat ] );
|
|
454
|
+
if( false ) // enable this if you want to experiment with the borderFormat
|
|
455
|
+
cellFormats[ mergedCellFormatWithBorder ].setBorderIndex( borderFormat );
|
|
456
|
+
wks.cell("E4").setCellFormat( mergedCellFormatWithBorder );
|
|
457
|
+
wks.cell("J5") = "merged red range #2\n - hidden cell contents have been deleted!";
|
|
458
|
+
wks.mergeCells("J5:L8", XLEmptyHiddenCells); // merge cells with deletion of contents
|
|
459
|
+
wks.cell("J5").setCellFormat( mergedCellFormat );
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
// ===== BEGIN conditional formatting demo
|
|
463
|
+
{
|
|
464
|
+
XLDiffCellFormats & diffCellFormats = doc.styles().diffCellFormats(); // get a handle on differential cell formats
|
|
465
|
+
|
|
466
|
+
// Create some differential cell formats that can be used for conditional formatting
|
|
467
|
+
XLStyleIndex lowStyle = diffCellFormats.create();
|
|
468
|
+
XLStyleIndex justRightStyle = diffCellFormats.create();
|
|
469
|
+
XLStyleIndex highStyle = diffCellFormats.create();
|
|
470
|
+
|
|
471
|
+
XLColor gray( "dddddddd" );
|
|
472
|
+
XLColor orange( "00ffcc00" );
|
|
473
|
+
|
|
474
|
+
diffCellFormats[ lowStyle ].font().setFontColor( blue );
|
|
475
|
+
diffCellFormats[ lowStyle ].fill().setPatternType( XLPatternSolid );
|
|
476
|
+
diffCellFormats[ lowStyle ].fill().setColor( gray );
|
|
477
|
+
diffCellFormats[ lowStyle ].fill().setBackgroundColor( gray );
|
|
478
|
+
|
|
479
|
+
diffCellFormats[ justRightStyle ].font().setFontColor( green );
|
|
480
|
+
diffCellFormats[ justRightStyle ].fill().setPatternType( XLPatternNone );
|
|
481
|
+
// diffCellFormats[ justRightStyle ].fill().setColor( yellow );
|
|
482
|
+
|
|
483
|
+
diffCellFormats[ highStyle ].font().setFontColor( red );
|
|
484
|
+
diffCellFormats[ highStyle ].fill().setPatternType( XLPatternSolid );
|
|
485
|
+
diffCellFormats[ highStyle ].fill().setColor( orange );
|
|
486
|
+
|
|
487
|
+
// Now create some rules applying conditional formatting to a range
|
|
488
|
+
XLConditionalFormats fmts = wks.conditionalFormats();
|
|
489
|
+
size_t newFmtIndex = fmts.create(); // will be 0 for this demo
|
|
490
|
+
XLConditionalFormat fmt = fmts[ newFmtIndex ];
|
|
491
|
+
fmt.setSqref("B13:B19");
|
|
492
|
+
XLCfRules fmtRules = fmt.cfRules();
|
|
493
|
+
// make 3 cfRule entries
|
|
494
|
+
fmtRules.create();
|
|
495
|
+
fmtRules.create();
|
|
496
|
+
fmtRules.create();
|
|
497
|
+
fmtRules[ 0 ].setType( XLCfType::CellIs );
|
|
498
|
+
fmtRules[ 0 ].setOperator( XLCfOperator::LessThanOrEqual );
|
|
499
|
+
fmtRules[ 0 ].setFormula("4");
|
|
500
|
+
fmtRules[ 0 ].setDxfId(lowStyle);
|
|
501
|
+
fmtRules[ 1 ].setType( XLCfType::CellIs );
|
|
502
|
+
fmtRules[ 1 ].setOperator( XLCfOperator::Equal );
|
|
503
|
+
fmtRules[ 1 ].setFormula("5");
|
|
504
|
+
fmtRules[ 1 ].setDxfId(justRightStyle);
|
|
505
|
+
fmtRules[ 2 ].setType( XLCfType::CellIs );
|
|
506
|
+
fmtRules[ 2 ].setOperator( XLCfOperator::GreaterThanOrEqual );
|
|
507
|
+
fmtRules[ 2 ].setFormula("6");
|
|
508
|
+
fmtRules[ 2 ].setDxfId(highStyle);
|
|
509
|
+
|
|
510
|
+
// Manipulating rule priorities manually:
|
|
511
|
+
// priorities: 1, 2, 3
|
|
512
|
+
fmtRules.setPriority(1, 1); // 2, 1, 4 // "mess up" the sequence
|
|
513
|
+
fmtRules.setPriority(0, 1); // 1, 2, 5 // insert an existing priority at index 0
|
|
514
|
+
fmtRules.setPriority(2, 3); // 1, 2, 3 // re-assign the priority 3
|
|
515
|
+
fmtRules.setPriority(1, 1); // 2, 1, 4 // "mess up" the sequence
|
|
516
|
+
fmtRules.setPriority(2, 3); // 2, 1, 3 // re-assign the priority 3
|
|
517
|
+
fmtRules.setPriority(1, 4); // 2, 4, 3 // temp-assign priority 4 to index 1
|
|
518
|
+
fmtRules.setPriority(0, 1); // 1, 4, 3 // re-assign priority 1 to index 0
|
|
519
|
+
fmtRules.setPriority(1, 2); // 1, 2, 3 // re-assign priority 2 to index 1
|
|
520
|
+
fmtRules.setPriority(1, 1); // 2, 1, 4 // "mess up" the sequence
|
|
521
|
+
|
|
522
|
+
// renumber priorities while retaining the sequence:
|
|
523
|
+
fmtRules.renumberPriorities(10); // 20, 10, 30 // renumber priorities with higher increment
|
|
524
|
+
fmtRules.renumberPriorities(21845); // 21845, 43690, 65535 - max possible priority value used
|
|
525
|
+
// not allowed:
|
|
526
|
+
// fmtRules.create(); // triggers an error because no priority value can be assigned anymore
|
|
527
|
+
// fmtRules.renumberPriorities(21846); // triggers an error because 3*21846 exceeds uint16_t range
|
|
528
|
+
fmtRules.renumberPriorities(); // 2, 1, 3 // renumber priorities while retaining the sequence
|
|
529
|
+
|
|
530
|
+
std::cout << std::endl << "conditionalFormatting entries summary: " << wks.conditionalFormats().summary() << std::endl;
|
|
531
|
+
|
|
532
|
+
// Finally, set some exemplary values in the range
|
|
533
|
+
wks.cell("B12") = "conditional formatting example";
|
|
534
|
+
wks.cell("B12").setCellFormat( boldDefault );
|
|
535
|
+
int cellValue = 1;
|
|
536
|
+
for( XLCellAssignable c : wks.range("B13:B19") ) c = cellValue++;
|
|
537
|
+
}
|
|
538
|
+
// ===== END conditional formatting demo
|
|
539
|
+
|
|
540
|
+
wks.setDimension(); // establish worksheet XML dimension tag
|
|
541
|
+
doc.saveAs("./Demo10.xlsx", XLForceOverwrite);
|
|
542
|
+
doc.close();
|
|
543
|
+
|
|
544
|
+
return 0;
|
|
545
|
+
}
|