XlsxWriter 3.3.1__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.1 → xlsxwriter-3.3.2}/Changes +36 -0
  2. {xlsxwriter-3.3.1/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.1 → xlsxwriter-3.3.2}/pyproject.toml +1 -1
  6. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/__init__.py +1 -1
  7. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/core.py +7 -6
  8. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/format.py +1 -0
  9. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/utility.py +9 -0
  10. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/workbook.py +55 -37
  11. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/worksheet.py +234 -223
  12. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2/xlsxwriter.egg-info}/PKG-INFO +1 -1
  13. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/SOURCES.txt +2 -0
  14. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/LICENSE.txt +0 -0
  15. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/MANIFEST.in +0 -0
  16. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/README.rst +0 -0
  17. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/array_formula.py +0 -0
  18. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/autofilter.py +0 -0
  19. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/autofilter_data.txt +0 -0
  20. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/autofit.py +0 -0
  21. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/autofit_manually.py +0 -0
  22. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/background.py +0 -0
  23. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/cell_indentation.py +0 -0
  24. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart.py +0 -0
  25. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_area.py +0 -0
  26. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_bar.py +0 -0
  27. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_clustered.py +0 -0
  28. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_column.py +0 -0
  29. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_combined.py +0 -0
  30. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_data_labels.py +0 -0
  31. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_data_table.py +0 -0
  32. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_data_tools.py +0 -0
  33. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_date_axis.py +0 -0
  34. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_doughnut.py +0 -0
  35. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_gauge.py +0 -0
  36. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_gradient.py +0 -0
  37. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_line.py +0 -0
  38. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_pareto.py +0 -0
  39. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_pattern.py +0 -0
  40. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_pie.py +0 -0
  41. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_radar.py +0 -0
  42. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_scatter.py +0 -0
  43. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_secondary_axis.py +0 -0
  44. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_stock.py +0 -0
  45. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chart_styles.py +0 -0
  46. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/chartsheet.py +0 -0
  47. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/check_close.py +0 -0
  48. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/checkbox.py +0 -0
  49. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/colors.py +0 -0
  50. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/comments1.py +0 -0
  51. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/comments2.py +0 -0
  52. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/conditional_format.py +0 -0
  53. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/context_manager.py +0 -0
  54. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/data_validate.py +0 -0
  55. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/datetimes.py +0 -0
  56. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/defined_name.py +0 -0
  57. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/demo.py +0 -0
  58. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/diagonal_border.py +0 -0
  59. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/django_simple.py +0 -0
  60. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/doc_properties.py +0 -0
  61. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/dynamic_arrays.py +0 -0
  62. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/embedded_images.py +0 -0
  63. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/headers_footers.py +0 -0
  64. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/hello_world.py +0 -0
  65. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/hide_row_col.py +0 -0
  66. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/hide_sheet.py +0 -0
  67. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/http_server.py +0 -0
  68. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/hyperlink.py +0 -0
  69. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/ignore_errors.py +0 -0
  70. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/images.py +0 -0
  71. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/images_bytesio.py +0 -0
  72. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/inheritance1.py +0 -0
  73. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/inheritance2.py +0 -0
  74. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/lambda.py +0 -0
  75. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/macros.py +0 -0
  76. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/merge1.py +0 -0
  77. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/merge_rich_string.py +0 -0
  78. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/outline.py +0 -0
  79. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/outline_collapsed.py +0 -0
  80. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_autofilter.py +0 -0
  81. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_chart.py +0 -0
  82. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_chart_columns.py +0 -0
  83. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_chart_line.py +0 -0
  84. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_column_formats.py +0 -0
  85. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_conditional_format.py +0 -0
  86. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_datetime.py +0 -0
  87. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_header_format.py +0 -0
  88. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_multiple.py +0 -0
  89. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_percentage.py +0 -0
  90. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_positioning.py +0 -0
  91. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_simple.py +0 -0
  92. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/pandas_table.py +0 -0
  93. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/panes.py +0 -0
  94. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_chart.py +0 -0
  95. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_checkbox.py +0 -0
  96. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_conditional_format.py +0 -0
  97. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_format_custom.py +0 -0
  98. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_format_default.py +0 -0
  99. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_multiple.py +0 -0
  100. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_positioning.py +0 -0
  101. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_simple.py +0 -0
  102. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_sparklines.py +0 -0
  103. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/polars_xlsxwriter.py +0 -0
  104. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/rich_strings.py +0 -0
  105. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/right_to_left.py +0 -0
  106. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/sensitivity_label.py +0 -0
  107. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/sparklines1.py +0 -0
  108. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/sparklines2.py +0 -0
  109. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/tab_colors.py +0 -0
  110. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/tables.py +0 -0
  111. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/text_indent.py +0 -0
  112. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/textbox.py +0 -0
  113. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/tutorial1.py +0 -0
  114. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/tutorial2.py +0 -0
  115. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/tutorial3.py +0 -0
  116. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/unicode.py +0 -0
  117. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/unicode_polish_utf8.py +0 -0
  118. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/unicode_polish_utf8.txt +0 -0
  119. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/unicode_shift_jis.py +0 -0
  120. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/unicode_shift_jis.txt +0 -0
  121. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/user_types1.py +0 -0
  122. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/user_types2.py +0 -0
  123. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/user_types3.py +0 -0
  124. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/vbaProject.bin +0 -0
  125. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/vba_extract.py +0 -0
  126. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/watermark.py +0 -0
  127. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/examples/worksheet_protection.py +0 -0
  128. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/setup.cfg +0 -0
  129. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/app.py +0 -0
  130. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart.py +0 -0
  131. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_area.py +0 -0
  132. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_bar.py +0 -0
  133. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_column.py +0 -0
  134. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_doughnut.py +0 -0
  135. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_line.py +0 -0
  136. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_pie.py +0 -0
  137. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_radar.py +0 -0
  138. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_scatter.py +0 -0
  139. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_stock.py +0 -0
  140. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chart_title.py +0 -0
  141. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/chartsheet.py +0 -0
  142. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/color.py +0 -0
  143. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/comments.py +0 -0
  144. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/contenttypes.py +0 -0
  145. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/custom.py +0 -0
  146. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/drawing.py +0 -0
  147. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/exceptions.py +0 -0
  148. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/feature_property_bag.py +0 -0
  149. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/image.py +0 -0
  150. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/metadata.py +0 -0
  151. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/packager.py +0 -0
  152. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/relationships.py +0 -0
  153. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/rich_value.py +0 -0
  154. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_rel.py +0 -0
  155. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_structure.py +0 -0
  156. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/rich_value_types.py +0 -0
  157. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/shape.py +0 -0
  158. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/sharedstrings.py +0 -0
  159. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/styles.py +0 -0
  160. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/table.py +0 -0
  161. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/theme.py +0 -0
  162. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/url.py +0 -0
  163. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/vml.py +0 -0
  164. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter/xmlwriter.py +0 -0
  165. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/dependency_links.txt +0 -0
  166. {xlsxwriter-3.3.1 → xlsxwriter-3.3.2}/xlsxwriter.egg-info/top_level.txt +0 -0
@@ -1,4 +1,40 @@
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
+
2
38
  Release 3.3.1 - October 28 2026
3
39
  -------------------------------
4
40
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlsxwriter
3
- Version: 3.3.1
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.1"
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.1"
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,
@@ -954,6 +954,15 @@ def _preserve_whitespace(string: str) -> Optional[re.Match]:
954
954
  return RE_LEADING_WHITESPACE.search(string) or RE_TRAILING_WHITESPACE.search(string)
955
955
 
956
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
+
957
966
  def _utf16_len(string: str) -> int:
958
967
  # Get the length of a string in UTF-16 units. Excel's string length limits
959
968
  # are in UTF-16 units, so characters above U+FFFF, such as emojis, count as 2.
@@ -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 _has_invalid_name_chars, _utf16_len, 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,7 +591,7 @@ 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)
@@ -961,6 +956,7 @@ class Workbook(xmlwriter.XMLwriter):
961
956
  "nan_inf_to_errors": self.nan_inf_to_errors,
962
957
  "default_date_format": self.default_date_format,
963
958
  "default_url_format": self.default_url_format,
959
+ "default_format": self.default_format,
964
960
  "workbook_add_format": self.add_format,
965
961
  "excel2003_style": self.excel2003_style,
966
962
  "remove_timezone": self.remove_timezone,
@@ -1698,7 +1694,30 @@ class Workbook(xmlwriter.XMLwriter):
1698
1694
  # This allows the default packager to be over-ridden.
1699
1695
  return Packager()
1700
1696
 
1701
- 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]]:
1702
1721
  # Get default font metrics for a default column width.
1703
1722
  #
1704
1723
  # This function returns the font metrics (max_digit_width, padding,
@@ -1721,8 +1740,7 @@ class Workbook(xmlwriter.XMLwriter):
1721
1740
  elif width == 120:
1722
1741
  metrics = (13, 9, 3323)
1723
1742
  else:
1724
- warn(f"Unsupported default_column_width '{width}'. Using 64 pixels.")
1725
- metrics = (7, 5, 1790)
1743
+ metrics = None
1726
1744
 
1727
1745
  return metrics
1728
1746