react-native-nitro-xlsx 0.1.4 → 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.
Files changed (428) hide show
  1. package/NitroXlsx.podspec +27 -27
  2. package/Package.swift +35 -10
  3. package/README.md +220 -58
  4. package/android/CMakeLists.txt +24 -27
  5. package/android/cpp-adapter.cpp +12 -0
  6. package/android/src/main/java/com/margelo/nitro/xlsx/NitroXlsxPackage.kt +9 -0
  7. package/cpp/HybridNitroXlsx.cpp +25 -179
  8. package/cpp/HybridNitroXlsx.hpp +2 -2
  9. package/cpp/HybridXlsxConditionalFormat.cpp +252 -0
  10. package/cpp/HybridXlsxConditionalFormat.hpp +62 -0
  11. package/cpp/HybridXlsxConditionalFormats.cpp +46 -0
  12. package/cpp/HybridXlsxConditionalFormats.hpp +28 -0
  13. package/cpp/HybridXlsxWorkbook.cpp +159 -196
  14. package/cpp/HybridXlsxWorkbook.hpp +7 -2
  15. package/cpp/HybridXlsxWorksheet.cpp +433 -62
  16. package/cpp/HybridXlsxWorksheet.hpp +73 -26
  17. package/cpp/XlsxCacheDir.cpp +76 -0
  18. package/cpp/XlsxCacheDir.hpp +27 -0
  19. package/cpp/XlsxError.hpp +68 -0
  20. package/cpp/XlsxJson.cpp +185 -0
  21. package/cpp/XlsxJson.hpp +36 -0
  22. package/ios/XlsxCacheDir.mm +60 -0
  23. package/nitrogen/generated/android/NitroXlsx+autolinking.cmake +2 -0
  24. package/nitrogen/generated/shared/c++/HybridNitroXlsxSpec.hpp +5 -3
  25. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.cpp +54 -0
  26. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.hpp +95 -0
  27. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.cpp +24 -0
  28. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.hpp +68 -0
  29. package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.cpp +3 -0
  30. package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.hpp +6 -1
  31. package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.cpp +47 -19
  32. package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.hpp +52 -20
  33. package/package.json +3 -3
  34. package/scripts/run-cpp-tests.sh +14 -0
  35. package/src/__mocks__/react-native-nitro-modules.ts +1 -0
  36. package/src/__tests__/index.test.ts +76 -7
  37. package/src/index.ts +107 -18
  38. package/src/specs/NitroXlsx.nitro.ts +141 -44
  39. package/thirdparty/OpenXLSX/.clang-format +118 -0
  40. package/thirdparty/OpenXLSX/.clang-tidy +28 -0
  41. package/thirdparty/OpenXLSX/.gitignore +130 -0
  42. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
  43. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
  44. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
  45. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
  46. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
  47. package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
  48. package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
  49. package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
  50. package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
  51. package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
  52. package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
  53. package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
  54. package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
  55. package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
  56. package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
  57. package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
  58. package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
  59. package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
  60. package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
  61. package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
  62. package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
  63. package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
  64. package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
  65. package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
  66. package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
  67. package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
  68. package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
  69. package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
  70. package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
  71. package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
  72. package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
  73. package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
  74. package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
  75. package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
  76. package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
  77. package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
  78. package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
  79. package/thirdparty/OpenXLSX/LICENSE.md +29 -0
  80. package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
  81. package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
  82. package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
  83. package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
  84. package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
  85. package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
  86. package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
  87. package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
  88. package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
  89. package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
  90. package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
  91. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
  92. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
  93. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
  94. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
  95. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
  96. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
  97. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
  98. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
  99. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
  100. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
  101. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
  102. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
  103. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
  104. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
  105. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
  106. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
  107. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
  108. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
  109. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
  110. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
  111. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
  112. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
  113. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
  114. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
  115. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
  116. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
  117. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
  118. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
  119. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
  120. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
  121. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
  122. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
  123. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
  124. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
  125. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
  126. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
  127. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
  128. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
  129. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
  130. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
  131. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
  132. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
  133. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
  134. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
  135. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
  136. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
  137. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
  138. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
  139. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
  140. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
  141. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
  142. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
  143. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
  144. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
  145. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
  146. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
  147. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
  148. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
  149. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
  150. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
  151. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
  152. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
  153. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
  154. package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
  155. package/thirdparty/OpenXLSX/README.md +1279 -0
  156. package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
  157. package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
  158. package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
  159. package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
  160. package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
  161. package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
  162. package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
  163. package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
  164. package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
  165. package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
  166. package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
  167. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
  168. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
  169. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
  170. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
  171. package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
  172. package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
  173. package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
  174. package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
  175. package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
  176. package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
  177. package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
  178. package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
  179. package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
  180. package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
  181. package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
  182. package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
  183. package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
  184. package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
  185. package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
  186. package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
  187. package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
  188. package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
  189. package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
  190. package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
  191. package/thirdparty/OpenXLSX/vcpkg.json +24 -0
  192. package/thirdparty/README.md +42 -0
  193. package/thirdparty/miniz/.clang-format +47 -0
  194. package/thirdparty/miniz/.travis.yml +2 -0
  195. package/thirdparty/miniz/CMakeLists.txt +333 -0
  196. package/thirdparty/miniz/CMakePresets.json +31 -0
  197. package/thirdparty/miniz/ChangeLog.md +272 -0
  198. package/thirdparty/miniz/Config.cmake.in +1 -0
  199. package/thirdparty/miniz/LICENSE +22 -0
  200. package/thirdparty/miniz/amalgamate.sh +57 -0
  201. package/thirdparty/miniz/examples/example1.c +105 -0
  202. package/thirdparty/miniz/examples/example2.c +164 -0
  203. package/thirdparty/miniz/examples/example3.c +269 -0
  204. package/thirdparty/miniz/examples/example4.c +102 -0
  205. package/thirdparty/miniz/examples/example5.c +327 -0
  206. package/thirdparty/miniz/examples/example6.c +189 -0
  207. package/thirdparty/miniz/meson.build +21 -0
  208. package/thirdparty/miniz/miniz.c +646 -0
  209. package/thirdparty/miniz/miniz.h +615 -0
  210. package/thirdparty/miniz/miniz.pc.in +13 -0
  211. package/thirdparty/miniz/miniz_common.h +89 -0
  212. package/thirdparty/miniz/miniz_export.h +20 -0
  213. package/thirdparty/miniz/miniz_tdef.c +1602 -0
  214. package/thirdparty/miniz/miniz_tdef.h +199 -0
  215. package/thirdparty/miniz/miniz_tinfl.c +778 -0
  216. package/thirdparty/miniz/miniz_tinfl.h +150 -0
  217. package/thirdparty/miniz/miniz_zip.c +4895 -0
  218. package/thirdparty/miniz/miniz_zip.h +454 -0
  219. package/thirdparty/miniz/readme.md +46 -0
  220. package/thirdparty/miniz/test.sh +36 -0
  221. package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
  222. package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
  223. package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
  224. package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
  225. package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
  226. package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
  227. package/thirdparty/miniz/tests/fuzz_main.c +55 -0
  228. package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
  229. package/thirdparty/miniz/tests/main.cpp +185 -0
  230. package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
  231. package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
  232. package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
  233. package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
  234. package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
  235. package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
  236. package/thirdparty/miniz/tests/timer.cpp +152 -0
  237. package/thirdparty/miniz/tests/timer.h +40 -0
  238. package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
  239. package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
  240. package/thirdparty/miniz/tests/zip.dict +9 -0
  241. package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
  242. package/thirdparty/pugixml/.codecov.yml +7 -0
  243. package/thirdparty/pugixml/.gitattributes +1 -0
  244. package/thirdparty/pugixml/CMakeLists.txt +330 -0
  245. package/thirdparty/pugixml/LICENSE.md +24 -0
  246. package/thirdparty/pugixml/Makefile +98 -0
  247. package/thirdparty/pugixml/README.md +81 -0
  248. package/thirdparty/pugixml/SECURITY.md +9 -0
  249. package/thirdparty/pugixml/appveyor.yml +50 -0
  250. package/thirdparty/pugixml/docs/config.adoc +7 -0
  251. package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
  252. package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
  253. package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
  254. package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
  255. package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
  256. package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
  257. package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
  258. package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
  259. package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
  260. package/thirdparty/pugixml/docs/manual.adoc +3326 -0
  261. package/thirdparty/pugixml/docs/manual.html +6395 -0
  262. package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
  263. package/thirdparty/pugixml/docs/quickstart.html +1107 -0
  264. package/thirdparty/pugixml/docs/samples/character.xml +8 -0
  265. package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
  266. package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
  267. package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
  268. package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
  269. package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
  270. package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
  271. package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
  272. package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
  273. package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
  274. package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
  275. package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
  276. package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
  277. package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
  278. package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
  279. package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
  280. package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
  281. package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
  282. package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
  283. package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
  284. package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
  285. package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
  286. package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
  287. package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
  288. package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
  289. package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
  290. package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
  291. package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
  292. package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
  293. package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
  294. package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
  295. package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
  296. package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
  297. package/thirdparty/pugixml/readme.txt +50 -0
  298. package/thirdparty/pugixml/scripts/archive.py +54 -0
  299. package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
  300. package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
  301. package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
  302. package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
  303. package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
  304. package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
  305. package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
  306. package/thirdparty/pugixml/scripts/premake4.lua +92 -0
  307. package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
  308. package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
  309. package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
  310. package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
  311. package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
  312. package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
  313. package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
  314. package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
  315. package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
  316. package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
  317. package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
  318. package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
  319. package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
  320. package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
  321. package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
  322. package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
  323. package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
  324. package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
  325. package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
  326. package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
  327. package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
  328. package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
  329. package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
  330. package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
  331. package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
  332. package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
  333. package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
  334. package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
  335. package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
  336. package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
  337. package/thirdparty/pugixml/tests/allocator.cpp +175 -0
  338. package/thirdparty/pugixml/tests/allocator.hpp +10 -0
  339. package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
  340. package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
  341. package/thirdparty/pugixml/tests/data/empty.xml +0 -0
  342. package/thirdparty/pugixml/tests/data/large.xml +1 -0
  343. package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
  344. package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
  345. package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
  346. package/thirdparty/pugixml/tests/data/small.xml +1 -0
  347. package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
  348. package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
  349. package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
  350. package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
  351. package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
  352. package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
  353. package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
  354. package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
  355. package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
  356. package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
  357. package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
  358. package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
  359. package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
  360. package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
  361. package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
  362. package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
  363. package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
  364. package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
  365. package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
  366. package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
  367. package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
  368. package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
  369. package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
  370. package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
  371. package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
  372. package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
  373. package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
  374. package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
  375. package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
  376. package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
  377. package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
  378. package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
  379. package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
  380. package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
  381. package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
  382. package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
  383. package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
  384. package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
  385. package/thirdparty/pugixml/tests/helpers.hpp +114 -0
  386. package/thirdparty/pugixml/tests/main.cpp +218 -0
  387. package/thirdparty/pugixml/tests/test.cpp +220 -0
  388. package/thirdparty/pugixml/tests/test.hpp +175 -0
  389. package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
  390. package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
  391. package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
  392. package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
  393. package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
  394. package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
  395. package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
  396. package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
  397. package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
  398. package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
  399. package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
  400. package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
  401. package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
  402. package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
  403. package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
  404. package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
  405. package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
  406. package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
  407. package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
  408. package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
  409. package/thirdparty/pugixml/tests/test_version.cpp +5 -0
  410. package/thirdparty/pugixml/tests/test_write.cpp +757 -0
  411. package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
  412. package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
  413. package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
  414. package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
  415. package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
  416. package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
  417. package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
  418. package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
  419. package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
  420. package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
  421. package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
  422. package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
  423. package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
  424. package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
  425. package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
  426. package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
  427. package/ios/dummy.swift +0 -2
  428. package/scripts/prepare-openxlsx.js +0 -109
@@ -0,0 +1,137 @@
1
+ #include <OpenXLSX.hpp>
2
+ #include <iostream>
3
+
4
+ #include "external/CustomZip/CustomZip.hpp"
5
+
6
+ using namespace std;
7
+ using namespace OpenXLSX;
8
+
9
+ int main()
10
+ {
11
+ cout << "********************************************************************************\n";
12
+ cout << "DEMO PROGRAM #01A: Basic Usage\n";
13
+ cout << "********************************************************************************\n";
14
+
15
+ // The only difference between this demo program and demo program #01 is that this one uses a different zip library.
16
+ // In this example, libzip is wrapped inside a thin wrapper called CustomZip, that has the interface described
17
+ // in the IZipArchive class. This enables the use of any zip library, as long it has the correct interface (no inheritance required).
18
+
19
+ // This example program illustrates basic usage of OpenXLSX, for example creation of a new workbook, and read/write
20
+ // of cell values.
21
+
22
+ // First, create a new document and access the sheet named 'Sheet1'.
23
+ // New documents contain a single worksheet named 'Sheet1'
24
+ XLDocument doc(CustomZip{});
25
+ doc.create("./Demo01A.xlsx", XLForceOverwrite);
26
+ auto wks = doc.workbook().worksheet("Sheet1");
27
+
28
+ // The individual cells can be accessed by using the .cell() method on the worksheet object.
29
+ // The .cell() method can take the cell address as a string, or alternatively take a XLCellReference
30
+ // object. By using an XLCellReference object, the cells can be accessed by row/column coordinates.
31
+ // The .cell() method returns an XLCell object.
32
+
33
+ // The .value() method of an XLCell object can be used for both getting and setting the cell value.
34
+ // Setting the value of a cell can be done by using the assignment operator on the .value() method
35
+ // as shown below. Alternatively, a .set() can be used. The cell values can be floating point numbers,
36
+ // integers, strings, and booleans. It can also accept XLDateTime objects, but this requires special
37
+ // handling (see later).
38
+ wks.cell("A1").value() = 3.14159265358979323846;
39
+ wks.cell("B1").value() = 42;
40
+ wks.cell("C1").value() = " Hello OpenXLSX! ";
41
+ wks.cell("D1").value() = true;
42
+ wks.cell("E1").value() = std::sqrt(-2); // Result is NAN, resulting in an error value in the Excel spreadsheet.
43
+
44
+ // As mentioned, the .value() method can also be used for getting tha value of a cell.
45
+ // The .value() method returns a proxy object that cannot be copied or assigned, but
46
+ // it can be implicitly converted to an XLCellValue object, as shown below.
47
+ // Unfortunately, it is not possible to use the 'auto' keyword, so the XLCellValue
48
+ // type has to be explicitly stated.
49
+ XLCellValue A1 = wks.cell("A1").value();
50
+ XLCellValue B1 = wks.cell("B1").value();
51
+ XLCellValue C1 = wks.cell("C1").value();
52
+ XLCellValue D1 = wks.cell("D1").value();
53
+ XLCellValue E1 = wks.cell("E1").value();
54
+
55
+ // The cell value can be implicitly converted to a basic c++ type. However, if the type does not
56
+ // match the type contained in the XLCellValue object (if, for example, floating point value is
57
+ // assigned to a std::string), then an XLValueTypeError exception will be thrown.
58
+ // To check which type is contained, use the .type() method, which will return a XLValueType enum
59
+ // representing the type. As a convenience, the .typeAsString() method returns the type as a string,
60
+ // which can be useful when printing to console.
61
+ double vA1 = wks.cell("A1").value();
62
+ int vB1 = wks.cell("B1").value();
63
+ std::string vC1 = wks.cell("C1").value();
64
+ bool vD1 = wks.cell("D1").value();
65
+ double vE1 = wks.cell("E1").value();
66
+
67
+ cout << "Cell A1: (" << A1.typeAsString() << ") " << vA1 << endl;
68
+ cout << "Cell B1: (" << B1.typeAsString() << ") " << vB1 << endl;
69
+ cout << "Cell C1: (" << C1.typeAsString() << ") " << vC1 << endl;
70
+ cout << "Cell D1: (" << D1.typeAsString() << ") " << vD1 << endl;
71
+ cout << "Cell E1: (" << E1.typeAsString() << ") " << vE1 << endl << endl;
72
+
73
+ // Instead of using implicit (or explicit) conversion, the underlying value can also be retrieved
74
+ // using the .get() method. This is a templated member function, which takes the desired type
75
+ // as a template argument.
76
+ cout << "Cell A1: (" << A1.typeAsString() << ") " << A1.get<double>() << endl;
77
+ cout << "Cell B1: (" << B1.typeAsString() << ") " << B1.get<int64_t>() << endl;
78
+ cout << "Cell C1: (" << C1.typeAsString() << ") " << C1.get<std::string>() << endl;
79
+ cout << "Cell D1: (" << D1.typeAsString() << ") " << D1.get<bool>() << endl;
80
+ cout << "Cell E1: (" << E1.typeAsString() << ") " << E1.get<double>() << endl << endl;
81
+
82
+ // XLCellValue objects can also be copied and assigned to other cells. This following line
83
+ // will copy and assign the value of cell C1 to cell E1. Note that only the value is copied;
84
+ // other cell properties of the target cell remain unchanged.
85
+
86
+ wks.cell("F1").value() = wks.cell(XLCellReference("C1")).value();
87
+
88
+ XLCellValue F1 = wks.cell("F1").value();
89
+ cout << "Cell F1: (" << F1.typeAsString() << ") " << F1.get<std::string_view>() << endl << endl;
90
+
91
+ // Date/time values is a special case. In Excel, date/time values are essentially just a
92
+ // 64-bit floating point value, that is rendered as a date/time string using special
93
+ // formatting. When retrieving the cell value, it is just a floating point value,
94
+ // and there is no way to identify it as a date/time value.
95
+ // If, however, you know it to be a date time value, or if you want to assign a date/time
96
+ // value to a cell, you can use the XLDateTime class, which falilitates conversion between
97
+ // Excel date/time serial numbers, and the std::tm struct, that is used to store
98
+ // date/time data. See https://en.cppreference.com/w/cpp/chrono/c/tm for more information.
99
+
100
+ // An XLDateTime object can be created from a std::tm object:
101
+ std::tm tm;
102
+ tm.tm_year = 121;
103
+ tm.tm_mon = 8;
104
+ tm.tm_mday = 1;
105
+ tm.tm_hour = 12;
106
+ tm.tm_min = 0;
107
+ tm.tm_sec = 0;
108
+ XLDateTime dt (tm);
109
+ // XLDateTime dt (43791.583333333299);
110
+
111
+ // The std::tm object can be assigned to a cell value in the same way as shown previously.
112
+ wks.cell("G1").value() = dt;
113
+
114
+ // And as seen previously, an XLCellValue object can be retrieved. However, the object
115
+ // will just contain a floating point value; there is no way to identify it as a date/time value.
116
+ XLCellValue G1 = wks.cell("G1").value();
117
+ cout << "Cell G1: (" << G1.typeAsString() << ") " << G1.get<double>() << endl;
118
+
119
+ // If it is known to be a date/time value, the cell value can be converted to an XLDateTime object.
120
+ auto result = G1.get<XLDateTime>();
121
+
122
+ // The Excel date/time serial number can be retrieved using the .serial() method.
123
+ cout << "Cell G1: (" << G1.typeAsString() << ") " << result.serial() << endl;
124
+
125
+ // Using the .tm() method, the corresponding std::tm object can be retrieved.
126
+ auto tmo = result.tm();
127
+ cout << "Cell G1: (" << G1.typeAsString() << ") " << std::asctime(&tmo);
128
+
129
+ // Setting and deleting formula nodes
130
+ wks.cell("D2").formula().set("=A1+B1");
131
+ wks.cell("E2").formula().set(""); // setting an empty (zero-length) formula string will delete the formula node
132
+
133
+ doc.save();
134
+ doc.close();
135
+
136
+ return 0;
137
+ }
@@ -0,0 +1,65 @@
1
+
2
+ #include <OpenXLSX.hpp>
3
+ #include <iostream>
4
+
5
+ using namespace std;
6
+ using namespace OpenXLSX;
7
+
8
+ int main()
9
+ {
10
+ cout << "********************************************************************************\n";
11
+ cout << "DEMO PROGRAM #02: Formulas\n";
12
+ cout << "********************************************************************************\n";
13
+
14
+ XLDocument doc;
15
+ doc.create("./Demo02.xlsx", XLForceOverwrite);
16
+ auto wks = doc.workbook().worksheet("Sheet1");
17
+
18
+ // Similar cell values, which are represented by XLCellValue objects, formulas are represented
19
+ // by XLFormula objects. They can be accessed through the XLCell interface using the .formula()
20
+ // member function. It should be noted, however, that the functionality of XLFormula is somewhat
21
+ // limited. Excel often uses 'shared' formulas, where the same formula is applied to several
22
+ // cells. XLFormula cannot handle shared formulas. Also, it cannot handle array formulas. This,
23
+ // in effect, means that XLFormula is not very useful for reading formulas from existing spread-
24
+ // sheets, but should rather be used to add or overwrite formulas to spreadsheets.
25
+
26
+ wks.cell("A1").value() = "Number:";
27
+ wks.cell("B1").value() = 1;
28
+ wks.cell("C1").value() = 2;
29
+ wks.cell("D1").value() = 3;
30
+
31
+ // Formulas can be added to a cell using the .formula() method on an XLCell object. The formula can
32
+ // be added by creating a separate XLFormula object, or (as shown below) by assigning a string
33
+ // holding the formula;
34
+ // Nota that OpenXLSX does not calculate the results of a formula. If you add a formula
35
+ // to a spreadsheet using OpenXLSX, you have to open the spreadsheet in the Excel application
36
+ // in order to see the results of the calculation.
37
+ wks.cell("A2").value() = "Calculation:";
38
+ wks.cell("B2").formula() = "SQRT(B1)";
39
+ wks.cell("C2").formula() = "EXP(C1)";
40
+ wks.cell("D2").formula() = "LN(D1)";
41
+
42
+ // The XLFormula object can be retrieved using the .formula() member function.
43
+ // The XLFormula .get() method can be used to get the formula string.
44
+ XLFormula B2 = wks.cell("B2").formula();
45
+ XLFormula C2 = wks.cell("C2").formula();
46
+ XLFormula D2 = wks.cell("D2").formula();
47
+
48
+ cout << "Formula in B2: " << B2.get() << endl;
49
+ cout << "Formula in C2: " << C2.get() << endl;
50
+ cout << "Formula in D2: " << D2.get() << endl << endl;
51
+
52
+ // Alternatively, the XLFormula object can be implicitly converted to a string object.
53
+ std::string B2string = wks.cell("B2").formula();
54
+ std::string C2string = wks.cell("C2").formula();
55
+ std::string D2string = wks.cell("D2").formula();
56
+
57
+ cout << "Formula in B2: " << B2string << endl;
58
+ cout << "Formula in C2: " << C2string << endl;
59
+ cout << "Formula in D2: " << D2string << endl << endl;
60
+
61
+ doc.save();
62
+ doc.close();
63
+
64
+ return 0;
65
+ }
@@ -0,0 +1,89 @@
1
+ #include <OpenXLSX.hpp>
2
+ #include <iostream>
3
+
4
+ using namespace std;
5
+ using namespace OpenXLSX;
6
+
7
+ void printWorkbook(const XLWorkbook& wb) {
8
+ cout << "\nSheets in workbook:\n";
9
+ for (const auto& name : wb.worksheetNames()) cout << wb.indexOfSheet(name) << " : " << name << "\n";
10
+ }
11
+
12
+ int main()
13
+ {
14
+ cout << "********************************************************************************\n";
15
+ cout << "DEMO PROGRAM #03: Sheet Handling\n";
16
+ cout << "********************************************************************************\n";
17
+
18
+ // OpenXLSX can be used to create and delete sheets in a workbook, as well as re-ordering of sheets.
19
+ // This example illustrates how this can be done. Please note that at the moment, chartsheets can only
20
+ // be renamed and deleted, not created or manipulated.
21
+
22
+ // First, create a new document and store the workbook object in a variable. Print the sheet names.
23
+ XLDocument doc;
24
+ doc.create("./Demo03.xlsx", XLForceOverwrite);
25
+ auto wbk = doc.workbook();
26
+ printWorkbook(wbk);
27
+
28
+ // Add two new worksheets. The 'addWorksheet' method takes the name of the new sheet as an argument,
29
+ // and appends the new workdheet at the end.
30
+ // Only worksheets can be added; there is no 'addChartsheet' method.
31
+ wbk.addWorksheet("Sheet2");
32
+ wbk.addWorksheet("Sheet3");
33
+ printWorkbook(wbk);
34
+
35
+ cout << "Sheet1 active: " << (wbk.worksheet("Sheet1").isActive() ? "true" : "false") << endl;
36
+ cout << "Sheet2 active: " << (wbk.worksheet("Sheet2").isActive() ? "true" : "false") << endl;
37
+ cout << "Sheet3 active: " << (wbk.worksheet("Sheet3").isActive() ? "true" : "false") << endl;
38
+
39
+ wbk.worksheet("Sheet3").setActive();
40
+
41
+ cout << "Sheet1 active: " << (wbk.worksheet("Sheet1").isActive() ? "true" : "false") << endl;
42
+ cout << "Sheet2 active: " << (wbk.worksheet("Sheet2").isActive() ? "true" : "false") << endl;
43
+ cout << "Sheet3 active: " << (wbk.worksheet("Sheet3").isActive() ? "true" : "false") << endl;
44
+
45
+ // OpenXLSX provides three different classes to handle workbook sheets: XLSheet, XLWorksheet, and
46
+ // XLChartsheet. As you might have guessed, XLWorksheet and XLChartsheet represents worksheets
47
+ // and chartsheets, respectively. XLChartsheet only has a limited set of functionality.
48
+ // XLSheet, on the other hand, is basically a std::variant that can hold either an XLWorksheet,
49
+ // or an XLChartsheet object. XLSheet has a limited set of functions that are common to
50
+ // both XLWorksheet and XLChartsheet objects, such as 'clone()' or 'setIndex()'. XLSheet is
51
+ // not a parent class to either XLWorksheet or XLChartsheet, and therefore cannot be used
52
+ // polymorphically.
53
+
54
+ // From an XLSheet object you can retrieve the contained XLWorksheet or XLChartsheet object by
55
+ // using the 'get<>()' function:
56
+ auto s1 = wbk.sheet("Sheet2").get<XLWorksheet>();
57
+
58
+ // Alternatively, you can retrieve the contained object, by using implicit conversion:
59
+ XLWorksheet s2 = wbk.sheet("Sheet2");
60
+
61
+ // Existing sheets can be cloned by calling the 'clone' method on the individual sheet,
62
+ // or by calling the 'cloneSheet' method from the XLWorkbook object. If the latter is
63
+ // chosen, both the name of the sheet to be cloned, as well as the name of the new
64
+ // sheet must be provided.
65
+ // In principle, chartsheets can also be cloned, but the results may not be as expected.
66
+ wbk.sheet("Sheet1").clone("Sheet4");
67
+ wbk.cloneSheet("Sheet2", "Sheet5");
68
+ printWorkbook(wbk);
69
+
70
+ // The sheets in the workbook can be reordered by calling the 'setIndex' method on the
71
+ // individual sheets (or worksheets/chartsheets).
72
+ wbk.deleteSheet("Sheet1");
73
+ wbk.worksheet("Sheet5").setIndex(1);
74
+ wbk.worksheet("Sheet4").setIndex(2);
75
+ wbk.worksheet("Sheet3").setIndex(3);
76
+ wbk.worksheet("Sheet2").setIndex(4);
77
+ printWorkbook(wbk);
78
+
79
+ // The color of each sheet tab can be set using the 'setColor' method for a
80
+ // sheet, and passing an XLColor object as an argument.
81
+ wbk.sheet("Sheet2").setColor(XLColor(0, 0, 0));
82
+ wbk.sheet("Sheet3").setColor(XLColor(255, 0, 0));
83
+ wbk.sheet("Sheet4").setColor(XLColor(0, 255, 0));
84
+ wbk.sheet("Sheet5").setColor(XLColor(0, 0, 255));
85
+
86
+ doc.save();
87
+
88
+ return 0;
89
+ }
@@ -0,0 +1,86 @@
1
+ #include <OpenXLSX.hpp>
2
+
3
+ #ifdef ENABLE_NOWIDE
4
+ #include <nowide/iostream.hpp>
5
+ namespace boost {} // ensure that namespace exists, even if boost doesn't define it
6
+ using namespace boost; // depending on library version, nowide namespace is hidden in boost::nowide
7
+ using nowide::cout;
8
+ #else
9
+ #include <iostream>
10
+ using std::cout;
11
+ #endif
12
+
13
+ bool nowide_status()
14
+ {
15
+ #ifdef ENABLE_NOWIDE
16
+ return true;
17
+ #else
18
+ return false;
19
+ #endif
20
+ }
21
+
22
+ using namespace OpenXLSX;
23
+
24
+ int main()
25
+ {
26
+ cout << "********************************************************************************\n";
27
+ cout << "DEMO PROGRAM #04: Unicode\n";
28
+ cout << "********************************************************************************\n";
29
+ cout << "nowide is " << ( nowide_status() ? "enabled" : "disabled" ) << "\n";
30
+
31
+ // Unicode can be a real pain in the neck. While UTF-8 encoding has become the de facto standard
32
+ // encoding on Linux, macOS and the internet, some systems use other encodings, most notably
33
+ // Windows which use UTF-16.
34
+ // OpenXLSX is based on UTF-8. That means that all text input and output MUST be in UTF-8 format.
35
+ // On Linux and MacOS, this will work out of the box because UTF-8 is baked into those systems.
36
+ // On Windows, on the other hand, input and output must be converted to UTF-8 first. This includes
37
+ // input strings that are hard-coded into your program. To stay sane, it is recommended that
38
+ // all your source code files are in UTF-8 encoding. All major compilers and IDEs on windows
39
+ // support UTF-8 encoded source files.
40
+ // To convert input/output manually, you can use the Windows API, or 3rd party libraries, such
41
+ // as Boost.NoWide.
42
+ // In this example Boost.NoWide is used, as it provides some handy functionality that enables
43
+ // console input/output with implicit conversion to/from UTF-8 on Windows.
44
+
45
+ // First, create a new document and access the sheet named 'Sheet1'.
46
+ // Then rename the worksheet to 'Простыня'.
47
+ XLDocument doc1;
48
+ doc1.create("./Demo04.xlsx", XLForceOverwrite);
49
+ auto wks1 = doc1.workbook().worksheet("Sheet1");
50
+ wks1.setName("Простыня");
51
+
52
+ // Cell values can be set to any Unicode string using the normal value assignment methods.
53
+ wks1.cell(XLCellReference("A1")).value() = "안녕하세요 세계!";
54
+ wks1.cell(XLCellReference("A2")).value() = "你好,世界!";
55
+ wks1.cell(XLCellReference("A3")).value() = "こんにちは 世界";
56
+ wks1.cell(XLCellReference("A4")).value() = "नमस्ते दुनिया!";
57
+ wks1.cell(XLCellReference("A5")).value() = "Привет, мир!";
58
+ wks1.cell(XLCellReference("A6")).value() = "Γειά σου Κόσμε!";
59
+
60
+ // Workbooks can also be saved and loaded with Unicode names
61
+ doc1.save();
62
+ doc1.saveAs("./スプレッドシート.xlsx", XLForceOverwrite);
63
+ doc1.close();
64
+
65
+ doc1.open("./スプレッドシート.xlsx");
66
+ wks1 = doc1.workbook().worksheet("Простыня");
67
+
68
+ // The nowide::cout object is a drop-in replacement of the std::cout that enables console output of UTF-8, even on Windows.
69
+ cout << "Cell A1 (Korean) : " << wks1.cell(XLCellReference("A1")).value().get<std::string>() << '\n';
70
+ cout << "Cell A2 (Chinese) : " << wks1.cell(XLCellReference("A2")).value().get<std::string>() << '\n';
71
+ cout << "Cell A3 (Japanese): " << wks1.cell(XLCellReference("A3")).value().get<std::string>() << '\n';
72
+ cout << "Cell A4 (Hindi) : " << wks1.cell(XLCellReference("A4")).value().get<std::string>() << '\n';
73
+ cout << "Cell A5 (Russian) : " << wks1.cell(XLCellReference("A5")).value().get<std::string>() << '\n';
74
+ cout << "Cell A6 (Greek) : " << wks1.cell(XLCellReference("A6")).value().get<std::string>() << '\n';
75
+
76
+
77
+ cout << "\nNOTE: If you are using a Windows terminal, the above output may look like gibberish,\n"
78
+ "because the Windows terminal does not support UTF-8 at the moment. To view to output,\n"
79
+ "you can use the overloaded 'cout' in the boost::nowide library (as in this sample program).\n"
80
+ "This will require a UTF-8 enabled font in the terminal. Lucinda Console supports some\n"
81
+ "non-ASCII scripts, such as Cyrillic and Greek. NSimSun supports some asian scripts.\n\n";
82
+
83
+ doc1.close();
84
+
85
+ return 0;
86
+ }
@@ -0,0 +1,77 @@
1
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
2
+ # pragma warning(push)
3
+ # pragma warning(disable : 4244)
4
+ #endif // _MSC_VER
5
+
6
+ #include <OpenXLSX.hpp>
7
+ #include <iostream>
8
+ #include <numeric>
9
+ #include <random>
10
+
11
+ using namespace std;
12
+ using namespace OpenXLSX;
13
+
14
+ int main()
15
+ {
16
+ cout << "********************************************************************************\n";
17
+ cout << "DEMO PROGRAM #05: Ranges and Iterators\n";
18
+ cout << "********************************************************************************\n";
19
+
20
+ // With OpenXLSX, a range of cells can be defined, in order to iterate through the
21
+ // cells in the range. A range is a quadratic region of cells in a worksheet.
22
+ // A range can be defined using the 'range()' method on an XLWorksheet object. This function
23
+ // takes two XLCellReferences: the cell in the upper left corner of the range, and the cell
24
+ // in the lower right corner.
25
+ // The resulting XLCellRange objects provides 'begin()' and 'end()' (returning iterators),
26
+ // so that the object can be used in a range-based for-loop.
27
+
28
+ // First, create a new document and access the sheet named 'Sheet1'.
29
+ cout << "\nGenerating spreadsheet ..." << endl;
30
+ XLDocument doc;
31
+ doc.create("./Demo05.xlsx", XLForceOverwrite);
32
+ auto wks = doc.workbook().worksheet("Sheet1");
33
+
34
+ // Create a random-number generator (to be used later)
35
+ std::random_device rand_dev;
36
+ std::mt19937 generator(rand_dev());
37
+ std::uniform_int_distribution<int> distr(0, 99);
38
+
39
+ // Create a cell range using the 'range()' method of the XLWorksheet class.
40
+ // The 'range()' method takes two XLCellReference objects; one for the cell
41
+ // in the upper left corner, and one for the cell in the lower right corner.
42
+ // OpenXLSX defines two constants: MAX_ROWS which is the maximum number of
43
+ // rows in a worksheet, and MAX_COLS which is the maximum number of columns.
44
+ auto rng = wks.range(XLCellReference("A1"), XLCellReference(OpenXLSX::MAX_ROWS, 8));
45
+
46
+ // An XLCellRange object provides begin and end iterators, and can be used in
47
+ // range-based for-loops. The next line iterates through all the cells in the
48
+ // range and assigns a random number to each cell:
49
+ for (auto& cell : rng) cell.value() = distr(generator);
50
+
51
+ // Saving a large spreadsheet can take a while...
52
+ cout << "Saving spreadsheet ..." << endl;
53
+ doc.save();
54
+ doc.close();
55
+
56
+ // Reopen the spreadsheet..
57
+ cout << "Re-opening spreadsheet ..." << endl;
58
+ doc.open("./Demo05.xlsx");
59
+ wks = doc.workbook().worksheet("Sheet1");
60
+
61
+ // Create the range, count the cells in the range, and sum the numbers assigned
62
+ // to the cells in the range.
63
+ cout << "Reading data from spreadsheet ..." << endl;
64
+ rng = wks.range(XLCellReference("A1"), XLCellReference(OpenXLSX::MAX_ROWS, 8));
65
+ cout << "Cell count: " << std::distance(rng.begin(), rng.end()) << endl;
66
+ cout << "Sum of cell values: "
67
+ << accumulate(rng.begin(), rng.end(), 0, [](uint64_t a, XLCell& b) { return a + b.value().get<int64_t>(); });
68
+ cout << endl;
69
+
70
+ doc.close();
71
+
72
+ return 0;
73
+ }
74
+
75
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
76
+ # pragma warning(pop)
77
+ #endif // _MSC_VER
@@ -0,0 +1,103 @@
1
+ #include <OpenXLSX.hpp>
2
+ #include <iostream>
3
+ #include <random>
4
+ #include <deque>
5
+ #include <numeric>
6
+
7
+ using namespace std;
8
+ using namespace OpenXLSX;
9
+
10
+
11
+ int main()
12
+ {
13
+ cout << "********************************************************************************\n";
14
+ cout << "DEMO PROGRAM #06: Row Handling (using containers)\n";
15
+ cout << "********************************************************************************\n";
16
+
17
+ // As an alternative to using cell ranges, you can use row ranges.
18
+ // This can be significantly faster (up to twice as fast for both reading and
19
+ // writing).
20
+
21
+ // First, create a new document and access the sheet named 'Sheet1'.
22
+ cout << "\nGenerating spreadsheet ..." << endl;
23
+ XLDocument doc;
24
+ std::string path = "./Demo06.xlsx";
25
+ doc.create(path, XLForceOverwrite);
26
+ auto wks = doc.workbook().worksheet("Sheet1");
27
+
28
+ // Create a random-number generator (to be used later)
29
+ std::random_device rand_dev;
30
+ std::mt19937 generator(rand_dev());
31
+ std::uniform_int_distribution<int> distr(0, 99);
32
+
33
+ // The XLWorksheet class has a 'rows()' method, that returns a XLRowRange
34
+ // object. Similar to XLCellRange, XLRowRange provides begin and end iterators,
35
+ // enabeling iteration through the individual XLRow objects.
36
+ std::vector<XLCellValue> writeValues;
37
+ for (auto& row : wks.rows(OpenXLSX::MAX_ROWS)) {
38
+
39
+ writeValues.clear();
40
+ for (int i = 0; i < 8; ++i) writeValues.emplace_back(distr(generator));
41
+
42
+ // The XLRow class provides a 'values()' method. Similar to the 'value()'
43
+ // method of the XLCell class, the 'values()' method returns a reference
44
+ // to a proxy object that facilitates implicit conversions etc.
45
+ // Using the 'values()' method, containers can be assigned to each row.
46
+ // In this case, a std::vector is used, but any container supporting
47
+ // bi-directional iterators (such as std::deque or std::list) can be
48
+ // used.
49
+ // In this example a vector of XLCellValue objects is used. This is
50
+ // useful if you heterogeneous data (such as doubles, ints and strings)
51
+ // in the same dataset. However, if you have homogeneous data, e.g. all
52
+ // doubles, you don't have to use XLCellValue objects. You can, for
53
+ // examlpe, assigne a std::vector of doubles directly to the row.
54
+ row.values() = writeValues;
55
+ }
56
+
57
+ // Saving a large spreadsheet can take a while...
58
+ cout << "Saving spreadsheet ..." << endl;
59
+ doc.save();
60
+ doc.close();
61
+
62
+ // Reopen the spreadsheet...
63
+ cout << "Re-opening spreadsheet ..." << endl;
64
+ doc.open(path);
65
+ wks = doc.workbook().worksheet("Sheet1");
66
+
67
+ // Prepare for reading...
68
+ uint64_t sum = 0;
69
+ uint64_t count = 0;
70
+ std::vector<XLCellValue> readValues;
71
+ cout << "Reading data from spreadsheet ..." << endl;
72
+
73
+ // The 'values()' member function can be used for both reading and writing
74
+ // of data. In this case the 'readValues' variable is a std::vector of
75
+ // XLCellValues, and the 'values()' method will perform implicit conversion
76
+ // to the correct type. Again, all containers supporting bi-directional
77
+ // iterators are supported. Also, if you have a vector of doubles, the values
78
+ // will be converted, if possible. Note, however, that if conversion is not
79
+ // possible, an exception will be thrown. For that reason, it is often best
80
+ // to use a container of XLCellValue objects, and then later determine the
81
+ // data type for each object.
82
+ for (auto& row : XLReverseRange(wks.rows())) { // use XLReverseRange to reverse-iterate over a range of rows
83
+ readValues = row.values();
84
+
85
+ // Count the number of cell values
86
+ count += std::count_if(readValues.begin(), readValues.end(), [](const XLCellValue& v) {
87
+ return v.type() != XLValueType::Empty;
88
+ });
89
+
90
+ // Sum the numbers in each cell.
91
+ sum += std::accumulate(readValues.begin(),
92
+ readValues.end(),
93
+ 0,
94
+ [](uint64_t a, XLCellValue& b) {return a + b.get<uint64_t>(); });
95
+ }
96
+
97
+ cout << "Cell count: " << count << endl;
98
+ cout << "Sum of cell values: " << sum << endl;
99
+
100
+ doc.close();
101
+
102
+ return 0;
103
+ }
@@ -0,0 +1,79 @@
1
+ #include <OpenXLSX.hpp>
2
+ #include <iostream>
3
+ #include <random>
4
+ #include <deque>
5
+ #include <numeric>
6
+
7
+ using namespace std;
8
+ using namespace OpenXLSX;
9
+
10
+ int main()
11
+ {
12
+ cout << "********************************************************************************\n";
13
+ cout << "DEMO PROGRAM #07: Row Handling (using iterators)\n";
14
+ cout << "********************************************************************************\n";
15
+
16
+ // As an alternative to using cell ranges, you can use row ranges.
17
+ // This can be significantly faster (up to twice as fast for both reading and
18
+ // writing).
19
+
20
+ // First, create a new document and access the sheet named 'Sheet1'.
21
+ cout << "\nGenerating spreadsheet ..." << endl;
22
+ XLDocument doc;
23
+ std::string path = "./Demo07.xlsx";
24
+ doc.create(path, XLForceOverwrite);
25
+ auto wks = doc.workbook().worksheet("Sheet1");
26
+
27
+ // Create a random-number generator (to be used later)
28
+ std::random_device rand_dev;
29
+ std::mt19937 generator(rand_dev());
30
+ std::uniform_int_distribution<int> distr(0, 99);
31
+
32
+ // The XLWorksheet class has a 'rows()' method, that returns a XLRowRange
33
+ // object. Similar to XLCellRange, XLRowRange provides begin and end iterators,
34
+ // enabeling iteration through the individual XLRow objects.
35
+ for (auto& row : wks.rows(OpenXLSX::MAX_ROWS)) {
36
+ for (auto cell: row.cells(8)) cell.value() = distr(generator);
37
+
38
+ // The XLRow class provides a 'cells()' method. This provides begin and end
39
+ // iterators to the cells, or range of cells, in the row. Iterating through
40
+ // the cells works in the usual manner and values can be read and written.
41
+ }
42
+
43
+ // Saving a large spreadsheet can take a while...
44
+ cout << "Saving spreadsheet ..." << endl;
45
+ doc.save();
46
+ doc.close();
47
+
48
+ // Reopen the spreadsheet...
49
+ cout << "Re-opening spreadsheet ..." << endl;
50
+ doc.open(path);
51
+ wks = doc.workbook().worksheet("Sheet1");
52
+
53
+ // Prepare for reading...
54
+ uint64_t sum = 0;
55
+ uint64_t count = 0;
56
+ cout << "Reading data from spreadsheet ..." << endl;
57
+
58
+ // The 'cells()' member function can be used in the usual algorithm in the
59
+ // STL, such as count_if and accumulate.
60
+ for (auto& row : wks.rows()) {
61
+ // Count the number of cell values
62
+ count += std::count_if(row.cells().begin(), row.cells().end(), [](const XLCell& c) {
63
+ return c.value().type() != XLValueType::Empty;
64
+ });
65
+
66
+ // Sum the numbers in each cell.
67
+ sum += std::accumulate(row.cells().begin(),
68
+ row.cells().end(),
69
+ 0,
70
+ [](uint64_t a, XLCell& b) {return a + b.value().get<uint64_t>(); });
71
+ }
72
+
73
+ cout << "Cell count: " << count << endl;
74
+ cout << "Sum of cell values: " << sum << endl;
75
+
76
+ doc.close();
77
+
78
+ return 0;
79
+ }