XlsxWriter 3.3.0__tar.gz → 3.3.2__tar.gz

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 (166) hide show
  1. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/Changes +91 -1
  2. {xlsxwriter-3.3.0/xlsxwriter.egg-info → xlsxwriter-3.3.2}/PKG-INFO +1 -1
  3. xlsxwriter-3.3.2/examples/theme_custom.py +36 -0
  4. xlsxwriter-3.3.2/examples/theme_excel_2023.py +20 -0
  5. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/pyproject.toml +1 -1
  6. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/__init__.py +1 -1
  7. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/core.py +7 -6
  8. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/format.py +1 -0
  9. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/url.py +7 -6
  10. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/utility.py +40 -0
  11. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/workbook.py +68 -45
  12. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/worksheet.py +344 -282
  13. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2/xlsxwriter.egg-info}/PKG-INFO +1 -1
  14. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/SOURCES.txt +2 -0
  15. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/LICENSE.txt +0 -0
  16. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/MANIFEST.in +0 -0
  17. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/README.rst +0 -0
  18. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/array_formula.py +0 -0
  19. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/autofilter.py +0 -0
  20. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/autofilter_data.txt +0 -0
  21. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/autofit.py +0 -0
  22. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/autofit_manually.py +0 -0
  23. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/background.py +0 -0
  24. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/cell_indentation.py +0 -0
  25. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart.py +0 -0
  26. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_area.py +0 -0
  27. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_bar.py +0 -0
  28. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_clustered.py +0 -0
  29. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_column.py +0 -0
  30. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_combined.py +0 -0
  31. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_data_labels.py +0 -0
  32. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_data_table.py +0 -0
  33. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_data_tools.py +0 -0
  34. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_date_axis.py +0 -0
  35. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_doughnut.py +0 -0
  36. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_gauge.py +0 -0
  37. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_gradient.py +0 -0
  38. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_line.py +0 -0
  39. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_pareto.py +0 -0
  40. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_pattern.py +0 -0
  41. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_pie.py +0 -0
  42. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_radar.py +0 -0
  43. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_scatter.py +0 -0
  44. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_secondary_axis.py +0 -0
  45. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_stock.py +0 -0
  46. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chart_styles.py +0 -0
  47. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/chartsheet.py +0 -0
  48. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/check_close.py +0 -0
  49. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/checkbox.py +0 -0
  50. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/colors.py +0 -0
  51. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/comments1.py +0 -0
  52. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/comments2.py +0 -0
  53. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/conditional_format.py +0 -0
  54. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/context_manager.py +0 -0
  55. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/data_validate.py +0 -0
  56. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/datetimes.py +0 -0
  57. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/defined_name.py +0 -0
  58. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/demo.py +0 -0
  59. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/diagonal_border.py +0 -0
  60. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/django_simple.py +0 -0
  61. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/doc_properties.py +0 -0
  62. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/dynamic_arrays.py +0 -0
  63. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/embedded_images.py +0 -0
  64. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/headers_footers.py +0 -0
  65. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/hello_world.py +0 -0
  66. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/hide_row_col.py +0 -0
  67. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/hide_sheet.py +0 -0
  68. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/http_server.py +0 -0
  69. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/hyperlink.py +0 -0
  70. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/ignore_errors.py +0 -0
  71. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/images.py +0 -0
  72. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/images_bytesio.py +0 -0
  73. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/inheritance1.py +0 -0
  74. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/inheritance2.py +0 -0
  75. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/lambda.py +0 -0
  76. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/macros.py +0 -0
  77. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/merge1.py +0 -0
  78. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/merge_rich_string.py +0 -0
  79. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/outline.py +0 -0
  80. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/outline_collapsed.py +0 -0
  81. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_autofilter.py +0 -0
  82. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_chart.py +0 -0
  83. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_chart_columns.py +0 -0
  84. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_chart_line.py +0 -0
  85. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_column_formats.py +0 -0
  86. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_conditional_format.py +0 -0
  87. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_datetime.py +0 -0
  88. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_header_format.py +0 -0
  89. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_multiple.py +0 -0
  90. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_percentage.py +0 -0
  91. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_positioning.py +0 -0
  92. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_simple.py +0 -0
  93. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/pandas_table.py +0 -0
  94. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/panes.py +0 -0
  95. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_chart.py +0 -0
  96. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_checkbox.py +0 -0
  97. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_conditional_format.py +0 -0
  98. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_format_custom.py +0 -0
  99. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_format_default.py +0 -0
  100. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_multiple.py +0 -0
  101. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_positioning.py +0 -0
  102. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_simple.py +0 -0
  103. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_sparklines.py +0 -0
  104. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/polars_xlsxwriter.py +0 -0
  105. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/rich_strings.py +0 -0
  106. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/right_to_left.py +0 -0
  107. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/sensitivity_label.py +0 -0
  108. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/sparklines1.py +0 -0
  109. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/sparklines2.py +0 -0
  110. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/tab_colors.py +0 -0
  111. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/tables.py +0 -0
  112. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/text_indent.py +0 -0
  113. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/textbox.py +0 -0
  114. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/tutorial1.py +0 -0
  115. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/tutorial2.py +0 -0
  116. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/tutorial3.py +0 -0
  117. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/unicode.py +0 -0
  118. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/unicode_polish_utf8.py +0 -0
  119. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/unicode_polish_utf8.txt +0 -0
  120. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/unicode_shift_jis.py +0 -0
  121. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/unicode_shift_jis.txt +0 -0
  122. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/user_types1.py +0 -0
  123. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/user_types2.py +0 -0
  124. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/user_types3.py +0 -0
  125. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/vbaProject.bin +0 -0
  126. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/vba_extract.py +0 -0
  127. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/watermark.py +0 -0
  128. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/examples/worksheet_protection.py +0 -0
  129. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/setup.cfg +0 -0
  130. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/app.py +0 -0
  131. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart.py +0 -0
  132. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_area.py +0 -0
  133. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_bar.py +0 -0
  134. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_column.py +0 -0
  135. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_doughnut.py +0 -0
  136. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_line.py +0 -0
  137. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_pie.py +0 -0
  138. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_radar.py +0 -0
  139. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_scatter.py +0 -0
  140. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_stock.py +0 -0
  141. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chart_title.py +0 -0
  142. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/chartsheet.py +0 -0
  143. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/color.py +0 -0
  144. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/comments.py +0 -0
  145. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/contenttypes.py +0 -0
  146. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/custom.py +0 -0
  147. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/drawing.py +0 -0
  148. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/exceptions.py +0 -0
  149. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/feature_property_bag.py +0 -0
  150. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/image.py +0 -0
  151. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/metadata.py +0 -0
  152. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/packager.py +0 -0
  153. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/relationships.py +0 -0
  154. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/rich_value.py +0 -0
  155. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_rel.py +0 -0
  156. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_structure.py +0 -0
  157. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_types.py +0 -0
  158. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/shape.py +0 -0
  159. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/sharedstrings.py +0 -0
  160. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/styles.py +0 -0
  161. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/table.py +0 -0
  162. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/theme.py +0 -0
  163. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/vml.py +0 -0
  164. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter/xmlwriter.py +0 -0
  165. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/dependency_links.txt +0 -0
  166. {xlsxwriter-3.3.0 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/top_level.txt +0 -0
@@ -1,4 +1,94 @@
1
1
 
2
+ Release 3.3.2 - November 19 2026
3
+ --------------------------------
4
+
5
+ * Added documentation and examples for the ``excel_2023_theme``,
6
+ ``default_format_properties``, ``default_row_height`` and
7
+ ``default_column_width`` Workbook options. See :ref:`ex_theme_excel_2023`
8
+ and :ref:`ex_theme_custom`.
9
+
10
+ :feature:`1163`.
11
+
12
+ * Fixed issue where a ``created`` date in :func:`set_properties` was replaced
13
+ with the current time if it was a ``datetime.date``. Also allow a
14
+ ``datetime.date`` in :func:`set_custom_property`.
15
+
16
+ :issue:`1225`.
17
+
18
+ * Fixed issue where timezone aware datetimes in :func:`set_properties` and
19
+ :func:`set_custom_property` weren't converted to UTC.
20
+
21
+ :issue:`1227`.
22
+
23
+ * Fixed issue where a rejected :func:`add_table`, :func:`merge_range` or
24
+ :func:`autofilter` could leave reserved cells that caused a later
25
+ ``OverlappingRange`` exception.
26
+
27
+ :issue:`1229`.
28
+
29
+ * Improved the performance of :func:`write_formula` and other methods that
30
+ handle formulas.
31
+
32
+ :issue:`1228`.
33
+
34
+ * Fixed issue where function names in formula string literals, and names such
35
+ as ``MYSINGLE()``, were treated as "future" functions.
36
+
37
+
38
+ Release 3.3.1 - October 28 2026
39
+ -------------------------------
40
+
41
+ * Fixed performance issue where positioning objects such as images and comments
42
+ on a worksheet with a custom default row height.
43
+
44
+ :issue:`1210`.
45
+
46
+ * Fixed a (different) performance issue where positioning a large number of
47
+ objects such as comments on a worksheet with custom row heights or column
48
+ widths.
49
+
50
+ :issue:`1217`.
51
+
52
+ * Fixed off by one error in the worksheet :func:`set_first_sheet()` method.
53
+
54
+ :issue:`1187`.
55
+
56
+ * Fixed issue where :func:`autofit()` hid a column that had a user defined
57
+ width narrower than the autofit width.
58
+
59
+ :issue:`1219`.
60
+
61
+ * Fixed issue where :func:`add_table()` didn't detect a duplicate header name
62
+ when a user defined header matched a default ``ColumnN`` header.
63
+
64
+ :issue:`1215`.
65
+
66
+ * Fixed issue where the ``strings_to_formulas`` Workbook option didn't prevent
67
+ :func:`write()` from converting strings like ``{=SUM(A1:B1*A2:B2)}`` to
68
+ array formulas.
69
+
70
+ :issue:`1212`.
71
+
72
+ * Fixed :func:`set_column()` rounding a half-pixel width to the nearest even
73
+ pixel, which made some widths one pixel narrower than in 3.2.9.
74
+
75
+ :issue:`1221`.
76
+
77
+ * Fixed unescaped double quotes, and incorrect string lengths for characters
78
+ such as emojis, in ``text`` type conditional formats.
79
+
80
+ :issue:`1206`.
81
+
82
+ * Fixed issue where "future" functions such as ``ISFORMULA()`` weren't prefixed
83
+ with ``_xlfn.`` in :func:`conditional_format()` and :func:`data_validation()`
84
+ formulas. See :ref:`formula_future`.
85
+
86
+ :issue:`1171`.
87
+
88
+ * Fixed Excel string length limit checks for strings with characters such as
89
+ emojis, which Excel counts as 2 characters.
90
+
91
+
2
92
  Release 3.3.0 - October 22 2026
3
93
  -------------------------------
4
94
 
@@ -38,7 +128,7 @@ Release 3.3.0 - October 22 2026
38
128
  * Fixed the width and height detection for large GIF images and for top-down
39
129
  BMP images, and added extra image dimension validation.
40
130
 
41
- :issue:`1188` and :issue:`1189`.
131
+ :pull:`1188` and :pull:`1189`.
42
132
 
43
133
  * Migrated the packaging configuration from ``setup.py`` to ``pyproject.toml``
44
134
  with the license declared as a PEP 639 SPDX expression.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlsxwriter
3
- Version: 3.3.0
3
+ Version: 3.3.2
4
4
  Summary: A Python module for creating Excel XLSX files.
5
5
  Author-email: John McNamara <jmcnamara@cpan.org>
6
6
  License-Expression: BSD-2-Clause
@@ -0,0 +1,36 @@
1
+ ##############################################################################
2
+ #
3
+ # An example of changing the default theme for a workbook to a user supplied
4
+ # custom theme using XlsxWriter.
5
+ #
6
+ # SPDX-License-Identifier: BSD-2-Clause
7
+ #
8
+ # Copyright (c) 2013-2026, John McNamara, jmcnamara@cpan.org
9
+ #
10
+ import xlsxwriter
11
+
12
+ # Set the default format to match the custom theme. Note, the font scheme is set
13
+ # to "minor" to indicate that the font is part of the theme.
14
+ workbook = xlsxwriter.Workbook(
15
+ "theme_custom.xlsx",
16
+ {
17
+ "default_format_properties": {
18
+ "font_name": "Arial",
19
+ "font_size": 11,
20
+ "font_scheme": "minor",
21
+ },
22
+ "default_row_height": 19,
23
+ "default_column_width": 72,
24
+ },
25
+ )
26
+
27
+ # Add a custom theme to the workbook. This can be a .thmx file, an .xlsx file,
28
+ # or a theme1.xml file extracted from an unzipped xlsx file.
29
+ workbook.use_custom_theme("Technic.thmx")
30
+
31
+ worksheet = workbook.add_worksheet()
32
+
33
+ # Write some text to demonstrate the changed theme.
34
+ worksheet.write("A1", "Hello")
35
+
36
+ workbook.close()
@@ -0,0 +1,20 @@
1
+ ##############################################################################
2
+ #
3
+ # An example of changing the default theme for a workbook to the Excel 2023
4
+ # Office/Aptos theme using XlsxWriter.
5
+ #
6
+ # SPDX-License-Identifier: BSD-2-Clause
7
+ #
8
+ # Copyright (c) 2013-2026, John McNamara, jmcnamara@cpan.org
9
+ #
10
+ import xlsxwriter
11
+
12
+ # Use the Excel 2023 Office/Aptos theme in the workbook.
13
+ workbook = xlsxwriter.Workbook("theme_excel_2023.xlsx", {"excel_2023_theme": True})
14
+
15
+ worksheet = workbook.add_worksheet()
16
+
17
+ # Write some text to demonstrate the changed theme.
18
+ worksheet.write("A1", "Hello")
19
+
20
+ workbook.close()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xlsxwriter"
7
- version = "3.3.0"
7
+ version = "3.3.2"
8
8
  description = "A Python module for creating Excel XLSX files."
9
9
  readme = "README.rst"
10
10
  license = "BSD-2-Clause"
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Copyright (c) 2013-2026, John McNamara, jmcnamara@cpan.org
5
5
  #
6
- __version__ = "3.3.0"
6
+ __version__ = "3.3.2"
7
7
  __VERSION__ = __version__
8
8
  from xlsxwriter.workbook import Workbook
9
9
 
@@ -7,10 +7,11 @@
7
7
  # Copyright (c) 2013-2026, John McNamara, jmcnamara@cpan.org
8
8
  #
9
9
 
10
- from datetime import datetime, timezone
10
+ from datetime import date, datetime, timezone
11
11
  from typing import Dict, Union
12
12
 
13
13
  from xlsxwriter import xmlwriter
14
+ from xlsxwriter.utility import _datetime_to_w3cdtf
14
15
 
15
16
 
16
17
  class Core(xmlwriter.XMLwriter):
@@ -47,11 +48,11 @@ class Core(xmlwriter.XMLwriter):
47
48
  # Assemble and write the XML file.
48
49
 
49
50
  # Set the creation date for the file.
50
- date = self.properties.get("created")
51
- if not isinstance(date, datetime):
52
- date = datetime.now(timezone.utc)
51
+ created = self.properties.get("created")
52
+ if not isinstance(created, date):
53
+ created = datetime.now(timezone.utc)
53
54
 
54
- self.iso_date = date.strftime("%Y-%m-%dT%H:%M:%SZ")
55
+ self.iso_date = _datetime_to_w3cdtf(created)
55
56
 
56
57
  # Write the XML declaration.
57
58
  self._xml_declaration()
@@ -73,7 +74,7 @@ class Core(xmlwriter.XMLwriter):
73
74
  # Close the file.
74
75
  self._xml_close()
75
76
 
76
- def _set_properties(self, properties: Dict[str, Union[str, datetime]]) -> None:
77
+ def _set_properties(self, properties: Dict[str, Union[str, date]]) -> None:
77
78
  # Set the document properties.
78
79
  self.properties = properties
79
80
 
@@ -1210,6 +1210,7 @@ class Format(xmlwriter.XMLwriter):
1210
1210
  self.font_shadow,
1211
1211
  self.font_strikeout,
1212
1212
  self.font_name,
1213
+ self.font_scheme,
1213
1214
  self.italic,
1214
1215
  self.font_size,
1215
1216
  self.underline,
@@ -12,6 +12,8 @@ import re
12
12
  from enum import Enum
13
13
  from typing import Any, Dict, Optional
14
14
 
15
+ from xlsxwriter.utility import _utf16_len
16
+
15
17
 
16
18
  class UrlTypes(Enum):
17
19
  """
@@ -46,15 +48,12 @@ class Url:
46
48
 
47
49
  self._parse_url()
48
50
 
49
- if len(self._link) > self.MAX_URL_LEN:
51
+ if _utf16_len(self._link) > self.MAX_URL_LEN:
50
52
  raise ValueError("URL exceeds Excel's maximum length.")
51
53
 
52
- if len(self._anchor) > self.MAX_URL_LEN:
54
+ if _utf16_len(self._anchor) > self.MAX_URL_LEN:
53
55
  raise ValueError("Anchor segment or url exceeds Excel's maximum length.")
54
56
 
55
- if len(self._tip) > self.MAX_PARAMETER_LEN:
56
- raise ValueError("Hyperlink tool tip exceeds Excel's maximum length.")
57
-
58
57
  self._escape_strings()
59
58
 
60
59
  def __repr__(self) -> str:
@@ -98,7 +97,7 @@ class Url:
98
97
  if isinstance(url, str):
99
98
  url = cls(options["url"])
100
99
  if options.get("tip"):
101
- url._tip = options["tip"]
100
+ url.tip = options["tip"]
102
101
 
103
102
  return url
104
103
 
@@ -120,6 +119,8 @@ class Url:
120
119
  @tip.setter
121
120
  def tip(self, value: str) -> None:
122
121
  """Set the screen tip for the URL."""
122
+ if _utf16_len(value) > self.MAX_PARAMETER_LEN:
123
+ raise ValueError("Hyperlink tool tip exceeds Excel's maximum length.")
123
124
  self._tip = value
124
125
 
125
126
  def _parse_url(self) -> None:
@@ -133,6 +133,10 @@ RE_QUOTE_RULE2 = re.compile(rf"^[\d\.{EMOJIS}]")
133
133
  RE_QUOTE_RULE3 = re.compile(r"^([A-Z]{1,3}\d+)$")
134
134
  RE_QUOTE_RULE4_ROW = re.compile(r"^R(\d+)")
135
135
  RE_QUOTE_RULE4_COLUMN = re.compile(r"^R?C(\d+)")
136
+ RE_INVALID_NAME_CHARS = re.compile(
137
+ r"[ !\"#$%&'()*+,\-/:;<=>@\[\]^`{|}~\x00-\x1f\x7f-\x9f]"
138
+ )
139
+ RE_INVALID_NAME_START = re.compile(r"^[\d.?]")
136
140
 
137
141
 
138
142
  def xl_rowcol_to_cell(
@@ -948,3 +952,39 @@ def _preserve_whitespace(string: str) -> Optional[re.Match]:
948
952
  # Check if a string has leading or trailing whitespace that requires a
949
953
  # "preserve" attribute.
950
954
  return RE_LEADING_WHITESPACE.search(string) or RE_TRAILING_WHITESPACE.search(string)
955
+
956
+
957
+ def _datetime_to_w3cdtf(date: datetime.date) -> str:
958
+ # Convert a date or datetime to the UTC string used in the document
959
+ # properties. Timezone aware datetimes are converted to UTC.
960
+ if isinstance(date, datetime.datetime) and date.tzinfo is not None:
961
+ date = date.astimezone(datetime.timezone.utc)
962
+
963
+ return date.strftime("%Y-%m-%dT%H:%M:%SZ")
964
+
965
+
966
+ def _utf16_len(string: str) -> int:
967
+ # Get the length of a string in UTF-16 units. Excel's string length limits
968
+ # are in UTF-16 units, so characters above U+FFFF, such as emojis, count as 2.
969
+ return len(string.encode("utf-16-le", "surrogatepass")) // 2
970
+
971
+
972
+ def _utf16_truncate(string: str, max_len: int) -> str:
973
+ # Truncate a string to a maximum length in UTF-16 units without splitting
974
+ # a character above U+FFFF.
975
+ length = 0
976
+ for index, char in enumerate(string):
977
+ length += 2 if ord(char) > 0xFFFF else 1
978
+ if length > max_len:
979
+ return string[:index]
980
+
981
+ return string
982
+
983
+
984
+ def _has_invalid_name_chars(name: str) -> bool:
985
+ # Check for characters that Excel doesn't allow in defined and table names.
986
+ return (
987
+ not name
988
+ or bool(RE_INVALID_NAME_CHARS.search(name))
989
+ or bool(RE_INVALID_NAME_START.match(name))
990
+ )
@@ -14,7 +14,7 @@ import re
14
14
  import time
15
15
  import warnings
16
16
  import zipfile
17
- from datetime import datetime
17
+ from datetime import date
18
18
  from decimal import Decimal
19
19
  from fractions import Fraction
20
20
  from io import StringIO
@@ -46,7 +46,12 @@ from xlsxwriter.image import Image
46
46
  from xlsxwriter.packager import Packager
47
47
  from xlsxwriter.sharedstrings import SharedStringTable
48
48
  from xlsxwriter.theme import THEME_XML_2007, THEME_XML_2023
49
- from xlsxwriter.utility import xl_cell_to_rowcol
49
+ from xlsxwriter.utility import (
50
+ _datetime_to_w3cdtf,
51
+ _has_invalid_name_chars,
52
+ _utf16_len,
53
+ xl_cell_to_rowcol,
54
+ )
50
55
  from xlsxwriter.worksheet import Worksheet
51
56
 
52
57
 
@@ -99,6 +104,7 @@ class Workbook(xmlwriter.XMLwriter):
99
104
  self.default_format_properties = options.get(
100
105
  "default_format_properties", {"font_name": "Calibri", "font_size": 11}
101
106
  )
107
+ self.default_format = None
102
108
 
103
109
  self.max_url_length = options.get("max_url_length", 2079)
104
110
  if self.max_url_length < 255:
@@ -172,47 +178,35 @@ class Workbook(xmlwriter.XMLwriter):
172
178
 
173
179
  # Add the default cell format.
174
180
  if self.excel_2023_theme:
181
+ self.default_theme_version = "202300"
182
+ self.theme_xml: str = THEME_XML_2023
183
+
175
184
  format_properties = {
176
185
  "font_name": "Aptos Narrow",
177
186
  "font_size": 11,
178
187
  "font_scheme": "minor",
179
188
  }
180
- self.default_format_properties = format_properties.copy()
181
- self.default_col_width = 64
182
- self.default_row_height = 20
183
- self.default_theme_version = "202300"
184
- self.theme_xml: str = THEME_XML_2023
185
-
186
- format_properties["xf_index"] = 0
187
- self.add_format(format_properties)
189
+ self._set_default_format(format_properties, 20, 64)
188
190
 
189
191
  elif self.excel2003_style:
190
192
  # This is a deprecated workaround for Excel 2003 style default format.
191
193
  format_properties = {
192
194
  "font_name": "Arial",
193
195
  "font_size": 10,
194
- "font_family": 0,
195
196
  "font_scheme": False,
196
197
  "theme": -1,
197
198
  }
198
- format_properties["xf_index"] = 0
199
- self.add_format(format_properties)
199
+ self._set_default_format(
200
+ format_properties, self.default_row_height, self.default_col_width
201
+ )
202
+ self.default_format.set_font_family(0)
200
203
 
201
- self.default_format_properties = {
202
- "font_name": "Arial",
203
- "font_size": 10,
204
- "font_scheme": False,
205
- "theme": -1,
206
- }
207
204
  else:
208
- format_properties = self.default_format_properties.copy()
209
- format_properties["xf_index"] = 0
210
- self.add_format(format_properties)
211
-
212
- # Store the theme font name to cell format properties.
213
- self.default_format_properties["theme_font_name"] = (
214
- self.default_format_properties.get("font_name", "Calibri")
215
- )
205
+ self._set_default_format(
206
+ self.default_format_properties,
207
+ self.default_row_height,
208
+ self.default_col_width,
209
+ )
216
210
 
217
211
  # Add a default URL format.
218
212
  format_properties = self.default_format_properties.copy()
@@ -226,10 +220,6 @@ class Workbook(xmlwriter.XMLwriter):
226
220
  {"num_format": self.default_date_format}
227
221
  )
228
222
 
229
- self.max_digit_width, self.cell_padding, self.max_col_width = (
230
- self._default_column_metrics(self.default_col_width)
231
- )
232
-
233
223
  def __enter__(self):
234
224
  """Return self object to use with "with" statement."""
235
225
  return self
@@ -291,6 +281,11 @@ class Workbook(xmlwriter.XMLwriter):
291
281
  if properties:
292
282
  format_properties.update(properties)
293
283
 
284
+ # Set a user font name after any default font scheme, so that it
285
+ # can turn off the theme scheme.
286
+ if "font_name" in properties and "font_scheme" not in properties:
287
+ format_properties["font_name"] = format_properties.pop("font_name")
288
+
294
289
  xf_format = Format(
295
290
  format_properties, self.xf_format_indices, self.dxf_format_indices
296
291
  )
@@ -554,7 +549,7 @@ class Workbook(xmlwriter.XMLwriter):
554
549
  def set_custom_property(
555
550
  self,
556
551
  name: str,
557
- value: Union[bool, datetime, float, Decimal, Fraction, Any],
552
+ value: Union[bool, date, float, Decimal, Fraction, Any],
558
553
  property_type: Optional[
559
554
  Literal["bool", "date", "number", "number_int", "text"]
560
555
  ] = None,
@@ -582,7 +577,7 @@ class Workbook(xmlwriter.XMLwriter):
582
577
  # Determine the property type from the Python type.
583
578
  if isinstance(value, bool):
584
579
  property_type = "bool"
585
- elif isinstance(value, datetime):
580
+ elif isinstance(value, date):
586
581
  property_type = "date"
587
582
  elif isinstance(value, int):
588
583
  property_type = "number_int"
@@ -596,18 +591,18 @@ class Workbook(xmlwriter.XMLwriter):
596
591
  value = str(value).lower()
597
592
 
598
593
  if property_type == "date":
599
- value = value.strftime("%Y-%m-%dT%H:%M:%SZ")
594
+ value = _datetime_to_w3cdtf(value)
600
595
 
601
596
  if property_type in ("number", "number_int"):
602
597
  value = str(value)
603
598
 
604
- if property_type == "text" and len(value) > 255:
599
+ if property_type == "text" and _utf16_len(value) > 255:
605
600
  warn(
606
601
  f"Length of 'value' parameter exceeds Excel's limit of 255 "
607
602
  f"characters in set_custom_property(): '{value}'"
608
603
  )
609
604
 
610
- if len(name) > 255:
605
+ if _utf16_len(name) > 255:
611
606
  warn(
612
607
  f"Length of 'name' parameter exceeds Excel's limit of 255 "
613
608
  f"characters in set_custom_property(): '{name}'"
@@ -683,12 +678,18 @@ class Workbook(xmlwriter.XMLwriter):
683
678
  sheet_index = -1
684
679
 
685
680
  # Warn if the defined name contains invalid chars as defined by Excel.
686
- if not re.match(r"^[\w\\][\w\\.]*$", name, re.UNICODE) or re.match(
687
- r"^\d", name
688
- ):
681
+ if _has_invalid_name_chars(name):
689
682
  warn(f"Invalid Excel characters in defined_name(): '{name}'")
690
683
  return -1
691
684
 
685
+ # Warn if the defined name exceeds Excel's maximum length.
686
+ if _utf16_len(name) > 255:
687
+ warn(
688
+ f"Name '{name}' in define_name() exceeds Excel's limit of 255 "
689
+ f"characters"
690
+ )
691
+ return -1
692
+
692
693
  # Warn if the defined name looks like a cell name.
693
694
  if re.match(r"^[a-zA-Z][a-zA-Z]?[a-dA-D]?\d+$", name):
694
695
  warn(f"Name looks like a cell name in defined_name(): '{name}'")
@@ -955,6 +956,7 @@ class Workbook(xmlwriter.XMLwriter):
955
956
  "nan_inf_to_errors": self.nan_inf_to_errors,
956
957
  "default_date_format": self.default_date_format,
957
958
  "default_url_format": self.default_url_format,
959
+ "default_format": self.default_format,
958
960
  "workbook_add_format": self.add_format,
959
961
  "excel2003_style": self.excel2003_style,
960
962
  "remove_timezone": self.remove_timezone,
@@ -994,7 +996,7 @@ class Workbook(xmlwriter.XMLwriter):
994
996
  sheetname = self.sheet_name + str(self.sheetname_count)
995
997
 
996
998
  # Check that sheet sheetname is <= 31. Excel limit.
997
- if len(sheetname) > 31:
999
+ if _utf16_len(sheetname) > 31:
998
1000
  raise InvalidWorksheetName(
999
1001
  f"Excel worksheet name '{sheetname}' must be <= 31 chars."
1000
1002
  )
@@ -1692,7 +1694,30 @@ class Workbook(xmlwriter.XMLwriter):
1692
1694
  # This allows the default packager to be over-ridden.
1693
1695
  return Packager()
1694
1696
 
1695
- def _default_column_metrics(self, width: int) -> Tuple[int, int, int]:
1697
+ def _set_default_format(
1698
+ self, properties: Dict[str, Any], row_height: int, col_width: int
1699
+ ) -> None:
1700
+ # Set the default cell format and the row/column dimensions that go
1701
+ # with it.
1702
+ metrics = self._default_column_metrics(col_width)
1703
+ if metrics is None:
1704
+ warn(f"Unsupported default_column_width '{col_width}'. Using 64 pixels.")
1705
+ col_width = 64
1706
+ metrics = self._default_column_metrics(col_width)
1707
+
1708
+ self.max_digit_width, self.cell_padding, self.max_col_width = metrics
1709
+ self.default_col_width = col_width
1710
+ self.default_row_height = row_height
1711
+
1712
+ self.default_format_properties = properties.copy()
1713
+ self.default_format = self.add_format({"xf_index": 0})
1714
+
1715
+ # Store the theme font name to cell format properties.
1716
+ self.default_format_properties["theme_font_name"] = properties.get(
1717
+ "font_name", "Calibri"
1718
+ )
1719
+
1720
+ def _default_column_metrics(self, width: int) -> Optional[Tuple[int, int, int]]:
1696
1721
  # Get default font metrics for a default column width.
1697
1722
  #
1698
1723
  # This function returns the font metrics (max_digit_width, padding,
@@ -1715,8 +1740,7 @@ class Workbook(xmlwriter.XMLwriter):
1715
1740
  elif width == 120:
1716
1741
  metrics = (13, 9, 3323)
1717
1742
  else:
1718
- warn(f"Unsupported default_column_width '{width}'. Using 64 pixels.")
1719
- metrics = (7, 5, 1790)
1743
+ metrics = None
1720
1744
 
1721
1745
  return metrics
1722
1746
 
@@ -1832,8 +1856,7 @@ class Workbook(xmlwriter.XMLwriter):
1832
1856
 
1833
1857
  # Store the firstSheet attribute when it isn't the default.
1834
1858
  if self.worksheet_meta.firstsheet > 0:
1835
- firstsheet = self.worksheet_meta.firstsheet + 1
1836
- attributes.append(("firstSheet", firstsheet))
1859
+ attributes.append(("firstSheet", self.worksheet_meta.firstsheet))
1837
1860
 
1838
1861
  # Store the activeTab attribute when it isn't the first sheet.
1839
1862
  if self.worksheet_meta.activesheet > 0: