XlsxWriter 3.2.2__tar.gz → 3.2.3__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 (162) hide show
  1. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/Changes +29 -0
  2. {xlsxwriter-3.2.2/XlsxWriter.egg-info → xlsxwriter-3.2.3}/PKG-INFO +1 -3
  3. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3/XlsxWriter.egg-info}/PKG-INFO +1 -3
  4. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/XlsxWriter.egg-info/SOURCES.txt +2 -0
  5. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/setup.py +3 -5
  6. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/__init__.py +1 -1
  7. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/app.py +7 -6
  8. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart.py +8 -8
  9. xlsxwriter-3.2.3/xlsxwriter/comments.py +397 -0
  10. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/contenttypes.py +18 -17
  11. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/core.py +14 -38
  12. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/custom.py +9 -13
  13. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/drawing.py +116 -151
  14. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/format.py +22 -6
  15. xlsxwriter-3.2.3/xlsxwriter/image.py +399 -0
  16. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/packager.py +12 -14
  17. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/rich_value.py +8 -7
  18. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/shape.py +0 -2
  19. xlsxwriter-3.2.3/xlsxwriter/url.py +267 -0
  20. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/utility.py +73 -290
  21. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/vml.py +127 -51
  22. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/workbook.py +71 -132
  23. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/worksheet.py +251 -598
  24. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/xmlwriter.py +1 -1
  25. xlsxwriter-3.2.2/xlsxwriter/comments.py +0 -212
  26. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/LICENSE.txt +0 -0
  27. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/MANIFEST.in +0 -0
  28. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/README.rst +0 -0
  29. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/XlsxWriter.egg-info/dependency_links.txt +0 -0
  30. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/XlsxWriter.egg-info/top_level.txt +0 -0
  31. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/array_formula.py +0 -0
  32. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/autofilter.py +0 -0
  33. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/autofilter_data.txt +0 -0
  34. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/autofit.py +0 -0
  35. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/autofit_manually.py +0 -0
  36. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/background.py +0 -0
  37. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/cell_indentation.py +0 -0
  38. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart.py +0 -0
  39. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_area.py +0 -0
  40. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_bar.py +0 -0
  41. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_clustered.py +0 -0
  42. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_column.py +0 -0
  43. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_combined.py +0 -0
  44. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_data_labels.py +0 -0
  45. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_data_table.py +0 -0
  46. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_data_tools.py +0 -0
  47. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_date_axis.py +0 -0
  48. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_doughnut.py +0 -0
  49. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_gauge.py +0 -0
  50. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_gradient.py +0 -0
  51. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_line.py +0 -0
  52. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_pareto.py +0 -0
  53. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_pattern.py +0 -0
  54. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_pie.py +0 -0
  55. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_radar.py +0 -0
  56. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_scatter.py +0 -0
  57. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_secondary_axis.py +0 -0
  58. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_stock.py +0 -0
  59. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chart_styles.py +0 -0
  60. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/chartsheet.py +0 -0
  61. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/check_close.py +0 -0
  62. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/checkbox.py +0 -0
  63. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/comments1.py +0 -0
  64. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/comments2.py +0 -0
  65. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/conditional_format.py +0 -0
  66. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/context_manager.py +0 -0
  67. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/data_validate.py +0 -0
  68. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/datetimes.py +0 -0
  69. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/defined_name.py +0 -0
  70. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/demo.py +0 -0
  71. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/diagonal_border.py +0 -0
  72. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/django_simple.py +0 -0
  73. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/doc_properties.py +0 -0
  74. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/dynamic_arrays.py +0 -0
  75. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/embedded_images.py +0 -0
  76. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/headers_footers.py +0 -0
  77. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/hello_world.py +0 -0
  78. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/hide_row_col.py +0 -0
  79. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/hide_sheet.py +0 -0
  80. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/http_server.py +0 -0
  81. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/hyperlink.py +0 -0
  82. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/ignore_errors.py +0 -0
  83. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/images.py +0 -0
  84. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/images_bytesio.py +0 -0
  85. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/inheritance1.py +0 -0
  86. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/inheritance2.py +0 -0
  87. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/lambda.py +0 -0
  88. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/macros.py +0 -0
  89. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/merge1.py +0 -0
  90. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/merge_rich_string.py +0 -0
  91. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/outline.py +0 -0
  92. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/outline_collapsed.py +0 -0
  93. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_autofilter.py +0 -0
  94. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_chart.py +0 -0
  95. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_chart_columns.py +0 -0
  96. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_chart_line.py +0 -0
  97. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_column_formats.py +0 -0
  98. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_conditional_format.py +0 -0
  99. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_datetime.py +0 -0
  100. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_header_format.py +0 -0
  101. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_multiple.py +0 -0
  102. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_percentage.py +0 -0
  103. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_positioning.py +0 -0
  104. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_simple.py +0 -0
  105. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/pandas_table.py +0 -0
  106. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/panes.py +0 -0
  107. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_chart.py +0 -0
  108. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_checkbox.py +0 -0
  109. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_conditional_format.py +0 -0
  110. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_format_custom.py +0 -0
  111. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_format_default.py +0 -0
  112. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_multiple.py +0 -0
  113. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_positioning.py +0 -0
  114. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_simple.py +0 -0
  115. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_sparklines.py +0 -0
  116. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/polars_xlsxwriter.py +0 -0
  117. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/rich_strings.py +0 -0
  118. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/right_to_left.py +0 -0
  119. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/sensitivity_label.py +0 -0
  120. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/sparklines1.py +0 -0
  121. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/sparklines2.py +0 -0
  122. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/tab_colors.py +0 -0
  123. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/tables.py +0 -0
  124. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/text_indent.py +0 -0
  125. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/textbox.py +0 -0
  126. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/tutorial1.py +0 -0
  127. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/tutorial2.py +0 -0
  128. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/tutorial3.py +0 -0
  129. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/unicode.py +0 -0
  130. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/unicode_polish_utf8.py +0 -0
  131. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/unicode_polish_utf8.txt +0 -0
  132. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/unicode_shift_jis.py +0 -0
  133. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/unicode_shift_jis.txt +0 -0
  134. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/user_types1.py +0 -0
  135. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/user_types2.py +0 -0
  136. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/user_types3.py +0 -0
  137. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/vbaProject.bin +0 -0
  138. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/vba_extract.py +0 -0
  139. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/watermark.py +0 -0
  140. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/examples/worksheet_protection.py +0 -0
  141. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/setup.cfg +0 -0
  142. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_area.py +0 -0
  143. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_bar.py +0 -0
  144. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_column.py +0 -0
  145. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_doughnut.py +0 -0
  146. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_line.py +0 -0
  147. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_pie.py +0 -0
  148. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_radar.py +0 -0
  149. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_scatter.py +0 -0
  150. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chart_stock.py +0 -0
  151. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/chartsheet.py +0 -0
  152. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/exceptions.py +0 -0
  153. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/feature_property_bag.py +0 -0
  154. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/metadata.py +0 -0
  155. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/relationships.py +0 -0
  156. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/rich_value_rel.py +0 -0
  157. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/rich_value_structure.py +0 -0
  158. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/rich_value_types.py +0 -0
  159. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/sharedstrings.py +0 -0
  160. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/styles.py +0 -0
  161. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/table.py +0 -0
  162. {xlsxwriter-3.2.2 → xlsxwriter-3.2.3}/xlsxwriter/theme.py +0 -0
@@ -1,3 +1,32 @@
1
+ Release 3.2.3 - April 17 2025
2
+ -----------------------------
3
+
4
+ * Fix for a breaking change in v3.2.1.
5
+
6
+ The Format class contained methods called ``set_font()``, ``set_size()`` and
7
+ ``set_color()`` which were old internal testing alternatives for
8
+ ``set_font_name()``, ``set_font_size()`` and ``set_font_color()``. Since they
9
+ were intentionally internal methods they were removed as part of a general
10
+ refactoring in v3.2.1. However, the alternative method names had leaked out
11
+ into production code and the removal caused breaks in dependent code. These
12
+ methods have been reinstated to prevent inadvertent breakages but may be
13
+ removed in the future after an orderly deprecation. Users should update to the
14
+ documented method names.
15
+
16
+ * This release drops support for Python 3.6 and 3.7, which are both EOL, in
17
+ order to simplify the additions of type annotations. The minimum supported
18
+ version of Python is now Python 3.8.
19
+
20
+ * This release contains code with initial type annotations as part of an overall
21
+ effort to add type annotations to the entire code base. It also contains
22
+ internal refactoring of some pseudo-types, based on dicts, into actual enum or
23
+ class types to allow stronger type checking. These will be rolled out in
24
+ upcoming releases.
25
+
26
+ This is part of a modernization of the XlsxWriter code base, see "XlsxWriter
27
+ Roadmap v2" :feature:`1128`.
28
+
29
+
1
30
  Release 3.2.2 - January 28 2025
2
31
  -------------------------------
3
32
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: XlsxWriter
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: A Python module for creating Excel XLSX files.
5
5
  Home-page: https://github.com/jmcnamara/XlsxWriter
6
6
  Author: John McNamara
@@ -11,8 +11,6 @@ Classifier: License :: OSI Approved :: BSD License
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
14
  Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: XlsxWriter
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: A Python module for creating Excel XLSX files.
5
5
  Home-page: https://github.com/jmcnamara/XlsxWriter
6
6
  Author: John McNamara
@@ -11,8 +11,6 @@ Classifier: License :: OSI Approved :: BSD License
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
14
  Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
@@ -139,6 +139,7 @@ xlsxwriter/drawing.py
139
139
  xlsxwriter/exceptions.py
140
140
  xlsxwriter/feature_property_bag.py
141
141
  xlsxwriter/format.py
142
+ xlsxwriter/image.py
142
143
  xlsxwriter/metadata.py
143
144
  xlsxwriter/packager.py
144
145
  xlsxwriter/relationships.py
@@ -151,6 +152,7 @@ xlsxwriter/sharedstrings.py
151
152
  xlsxwriter/styles.py
152
153
  xlsxwriter/table.py
153
154
  xlsxwriter/theme.py
155
+ xlsxwriter/url.py
154
156
  xlsxwriter/utility.py
155
157
  xlsxwriter/vml.py
156
158
  xlsxwriter/workbook.py
@@ -7,8 +7,8 @@ try:
7
7
  except ImportError:
8
8
  from distutils.core import setup, Command
9
9
 
10
- if sys.version_info < (3, 6):
11
- warn("The minimum Python version supported by XlsxWriter is 3.6")
10
+ if sys.version_info < (3, 8):
11
+ warn("The minimum Python version supported by XlsxWriter is 3.8")
12
12
  sys.exit()
13
13
 
14
14
 
@@ -28,7 +28,7 @@ class PyTest(Command):
28
28
 
29
29
  setup(
30
30
  name='XlsxWriter',
31
- version='3.2.2',
31
+ version='3.2.3',
32
32
  author='John McNamara',
33
33
  author_email='jmcnamara@cpan.org',
34
34
  url='https://github.com/jmcnamara/XlsxWriter',
@@ -44,8 +44,6 @@ setup(
44
44
  'Programming Language :: Python',
45
45
  'Programming Language :: Python :: 3 :: Only',
46
46
  'Programming Language :: Python :: 3',
47
- 'Programming Language :: Python :: 3.6',
48
- 'Programming Language :: Python :: 3.7',
49
47
  'Programming Language :: Python :: 3.8',
50
48
  'Programming Language :: Python :: 3.9',
51
49
  'Programming Language :: Python :: 3.10',
@@ -3,6 +3,6 @@
3
3
  #
4
4
  # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
5
5
  #
6
- __version__ = "3.2.2"
6
+ __version__ = "3.2.3"
7
7
  __VERSION__ = __version__
8
8
  from .workbook import Workbook # noqa
@@ -7,7 +7,8 @@
7
7
  # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
8
8
  #
9
9
 
10
- # Package imports.
10
+ from typing import Dict, List, Tuple
11
+
11
12
  from . import xmlwriter
12
13
 
13
14
 
@@ -37,11 +38,11 @@ class App(xmlwriter.XMLwriter):
37
38
  self.properties = {}
38
39
  self.doc_security = 0
39
40
 
40
- def _add_part_name(self, part_name):
41
+ def _add_part_name(self, part_name: str):
41
42
  # Add the name of a workbook Part such as 'Sheet1' or 'Print_Titles'.
42
43
  self.part_names.append(part_name)
43
44
 
44
- def _add_heading_pair(self, heading_pair):
45
+ def _add_heading_pair(self, heading_pair: Tuple[str, int]):
45
46
  # Add the name of a workbook Heading Pair such as 'Worksheets',
46
47
  # 'Charts' or 'Named Ranges'.
47
48
 
@@ -52,7 +53,7 @@ class App(xmlwriter.XMLwriter):
52
53
  self.heading_pairs.append(("lpstr", heading_pair[0]))
53
54
  self.heading_pairs.append(("i4", heading_pair[1]))
54
55
 
55
- def _set_properties(self, properties):
56
+ def _set_properties(self, properties: Dict[str, str]):
56
57
  # Set the document properties.
57
58
  self.properties = properties
58
59
 
@@ -137,7 +138,7 @@ class App(xmlwriter.XMLwriter):
137
138
 
138
139
  self._xml_end_tag("TitlesOfParts")
139
140
 
140
- def _write_vt_vector(self, base_type, vector_data):
141
+ def _write_vt_vector(self, base_type: str, vector_data: List[Tuple[str, int]]):
141
142
  # Write the <vt:vector> element.
142
143
  attributes = [
143
144
  ("size", len(vector_data)),
@@ -157,7 +158,7 @@ class App(xmlwriter.XMLwriter):
157
158
 
158
159
  self._xml_end_tag("vt:vector")
159
160
 
160
- def _write_vt_data(self, vt_data):
161
+ def _write_vt_data(self, vt_data: Tuple[str, int]):
161
162
  # Write the <vt:*> elements such as <vt:lpstr> and <vt:if>.
162
163
  self._xml_data_element(f"vt:{vt_data[0]}", vt_data[1])
163
164
 
@@ -54,7 +54,7 @@ class Chart(xmlwriter.XMLwriter):
54
54
  self.style_id = 2
55
55
  self.axis_ids = []
56
56
  self.axis2_ids = []
57
- self.cat_has_num_fmt = 0
57
+ self.cat_has_num_fmt = False
58
58
  self.requires_category = False
59
59
  self.legend = {}
60
60
  self.cat_axis_position = "b"
@@ -1982,17 +1982,17 @@ class Chart(xmlwriter.XMLwriter):
1982
1982
  cat_type = self._get_data_type(data)
1983
1983
 
1984
1984
  if cat_type == "str":
1985
- self.cat_has_num_fmt = 0
1985
+ self.cat_has_num_fmt = False
1986
1986
  # Write the c:numRef element.
1987
1987
  self._write_str_ref(formula, data, cat_type)
1988
1988
 
1989
1989
  elif cat_type == "multi_str":
1990
- self.cat_has_num_fmt = 0
1990
+ self.cat_has_num_fmt = False
1991
1991
  # Write the c:numRef element.
1992
1992
  self._write_multi_lvl_str_ref(formula, data)
1993
1993
 
1994
1994
  else:
1995
- self.cat_has_num_fmt = 1
1995
+ self.cat_has_num_fmt = True
1996
1996
  # Write the c:numRef element.
1997
1997
  self._write_num_ref(formula, data, cat_type)
1998
1998
 
@@ -3151,13 +3151,13 @@ class Chart(xmlwriter.XMLwriter):
3151
3151
 
3152
3152
  def _write_a_def_rpr(self, font):
3153
3153
  # Write the <a:defRPr> element.
3154
- has_color = 0
3154
+ has_color = False
3155
3155
 
3156
3156
  style_attributes = Shape._get_font_style_attributes(font)
3157
3157
  latin_attributes = Shape._get_font_latin_attributes(font)
3158
3158
 
3159
3159
  if font and font.get("color") is not None:
3160
- has_color = 1
3160
+ has_color = True
3161
3161
 
3162
3162
  if latin_attributes or has_color:
3163
3163
  self._xml_start_tag("a:defRPr", style_attributes)
@@ -3195,14 +3195,14 @@ class Chart(xmlwriter.XMLwriter):
3195
3195
 
3196
3196
  def _write_a_r_pr(self, font):
3197
3197
  # Write the <a:rPr> element.
3198
- has_color = 0
3198
+ has_color = False
3199
3199
  lang = "en-US"
3200
3200
 
3201
3201
  style_attributes = Shape._get_font_style_attributes(font)
3202
3202
  latin_attributes = Shape._get_font_latin_attributes(font)
3203
3203
 
3204
3204
  if font and font["color"] is not None:
3205
- has_color = 1
3205
+ has_color = True
3206
3206
 
3207
3207
  # Add the lang type to the attributes.
3208
3208
  style_attributes.insert(0, ("lang", lang))
@@ -0,0 +1,397 @@
1
+ ###############################################################################
2
+ #
3
+ # Comments - A class for writing the Excel XLSX Worksheet file.
4
+ #
5
+ # SPDX-License-Identifier: BSD-2-Clause
6
+ #
7
+ # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
8
+ #
9
+
10
+ from typing import Dict, List, Optional, Union
11
+
12
+ from . import xmlwriter
13
+ from .utility import (
14
+ _preserve_whitespace,
15
+ _xl_color,
16
+ xl_cell_to_rowcol,
17
+ xl_rowcol_to_cell,
18
+ )
19
+
20
+
21
+ ###########################################################################
22
+ #
23
+ # A comment type class.
24
+ #
25
+ ###########################################################################
26
+ class CommentType:
27
+ """
28
+ A class to represent a comment in an Excel worksheet.
29
+
30
+ """
31
+
32
+ def __init__(
33
+ self,
34
+ row: int,
35
+ col: int,
36
+ text: str,
37
+ options: Optional[Dict[str, Union[str, int, float]]] = None,
38
+ ):
39
+ """
40
+ Initialize a Comment instance.
41
+
42
+ Args:
43
+ row (int): The row number of the comment.
44
+ col (int): The column number of the comment.
45
+ text (str): The text of the comment.
46
+ options (dict): Additional options for the comment.
47
+ """
48
+ self.row: int = row
49
+ self.col: int = col
50
+ self.text: str = text
51
+
52
+ self.author: Optional[str] = None
53
+ self.color: str = "#ffffe1"
54
+
55
+ self.start_row: int = 0
56
+ self.start_col: int = 0
57
+
58
+ self.is_visible: Optional[bool] = None
59
+
60
+ self.width: float = 128
61
+ self.height: float = 74
62
+
63
+ self.x_scale: float = 1
64
+ self.y_scale: float = 1
65
+ self.x_offset: int = 0
66
+ self.y_offset: int = 0
67
+
68
+ self.font_size: float = 8
69
+ self.font_name: str = "Tahoma"
70
+ self.font_family: int = 2
71
+
72
+ self.vertices: List[Union[int, float]] = []
73
+
74
+ # Set the default start cell and offsets for the comment.
75
+ self.set_offsets(self.row, self.col)
76
+
77
+ # Set any user supplied options.
78
+ self._set_user_options(options)
79
+
80
+ def _set_user_options(
81
+ self, options: Optional[Dict[str, Union[str, int, float]]] = None
82
+ ):
83
+ """
84
+ This method handles the additional optional parameters to
85
+ ``write_comment()``.
86
+ """
87
+ if options is None:
88
+ return
89
+
90
+ # Overwrite the defaults with any user supplied values. Incorrect or
91
+ # misspelled parameters are silently ignored.
92
+ width = options.get("width")
93
+ if width and isinstance(width, (int, float)):
94
+ self.width = width
95
+
96
+ height = options.get("height")
97
+ if height and isinstance(height, (int, float)):
98
+ self.height = height
99
+
100
+ x_offset = options.get("x_offset")
101
+ if x_offset and isinstance(x_offset, int):
102
+ self.x_offset = x_offset
103
+
104
+ y_offset = options.get("y_offset")
105
+ if y_offset and isinstance(y_offset, int):
106
+ self.y_offset = y_offset
107
+
108
+ start_col = options.get("start_col")
109
+ if start_col and isinstance(start_col, int):
110
+ self.start_col = start_col
111
+
112
+ start_row = options.get("start_row")
113
+ if start_row and isinstance(start_row, int):
114
+ self.start_row = start_row
115
+
116
+ font_size = options.get("font_size")
117
+ if font_size and isinstance(font_size, (int, float)):
118
+ self.font_size = font_size
119
+
120
+ font_name = options.get("font_name")
121
+ if font_name and isinstance(font_name, str):
122
+ self.font_name = font_name
123
+
124
+ font_family = options.get("font_family")
125
+ if font_family and isinstance(font_family, int):
126
+ self.font_family = font_family
127
+
128
+ author = options.get("author")
129
+ if author and isinstance(author, str):
130
+ self.author = author
131
+
132
+ visible = options.get("visible")
133
+ if visible is not None and isinstance(visible, bool):
134
+ self.is_visible = visible
135
+
136
+ color = options.get("color")
137
+ if color and isinstance(color, str):
138
+ # Set the comment background color.
139
+ color = _xl_color(color).lower()
140
+
141
+ # Convert from Excel XML style color to XML html style color.
142
+ self.color = color.replace("ff", "#", 1)
143
+
144
+ # Convert a cell reference to a row and column.
145
+ start_cell = options.get("start_cell")
146
+ if start_cell and isinstance(start_cell, str):
147
+ (start_row, start_col) = xl_cell_to_rowcol(start_cell)
148
+ self.start_row = start_row
149
+ self.start_col = start_col
150
+
151
+ # Scale the size of the comment box if required.
152
+ x_scale = options.get("x_scale")
153
+ if x_scale and isinstance(x_scale, (int, float)):
154
+ self.width = self.width * x_scale
155
+
156
+ y_scale = options.get("y_scale")
157
+ if y_scale and isinstance(y_scale, (int, float)):
158
+ self.height = self.height * y_scale
159
+
160
+ # Round the dimensions to the nearest pixel.
161
+ self.width = int(0.5 + self.width)
162
+ self.height = int(0.5 + self.height)
163
+
164
+ def set_offsets(self, row: int, col: int):
165
+ """
166
+ Set the default start cell and offsets for the comment. These are
167
+ generally a fixed offset relative to the parent cell. However there are
168
+ some edge cases for cells at the, well, edges.
169
+ """
170
+ row_max = 1048576
171
+ col_max = 16384
172
+
173
+ if self.row == 0:
174
+ self.y_offset = 2
175
+ self.start_row = 0
176
+ elif self.row == row_max - 3:
177
+ self.y_offset = 16
178
+ self.start_row = row_max - 7
179
+ elif self.row == row_max - 2:
180
+ self.y_offset = 16
181
+ self.start_row = row_max - 6
182
+ elif self.row == row_max - 1:
183
+ self.y_offset = 14
184
+ self.start_row = row_max - 5
185
+ else:
186
+ self.y_offset = 10
187
+ self.start_row = row - 1
188
+
189
+ if self.col == col_max - 3:
190
+ self.x_offset = 49
191
+ self.start_col = col_max - 6
192
+ elif self.col == col_max - 2:
193
+ self.x_offset = 49
194
+ self.start_col = col_max - 5
195
+ elif self.col == col_max - 1:
196
+ self.x_offset = 49
197
+ self.start_col = col_max - 4
198
+ else:
199
+ self.x_offset = 15
200
+ self.start_col = col + 1
201
+
202
+
203
+ ###########################################################################
204
+ #
205
+ # The file writer class for the Excel XLSX Comments file.
206
+ #
207
+ ###########################################################################
208
+ class Comments(xmlwriter.XMLwriter):
209
+ """
210
+ A class for writing the Excel XLSX Comments file.
211
+
212
+
213
+ """
214
+
215
+ ###########################################################################
216
+ #
217
+ # Public API.
218
+ #
219
+ ###########################################################################
220
+
221
+ def __init__(self):
222
+ """
223
+ Constructor.
224
+
225
+ """
226
+
227
+ super().__init__()
228
+ self.author_ids = {}
229
+
230
+ ###########################################################################
231
+ #
232
+ # Private API.
233
+ #
234
+ ###########################################################################
235
+
236
+ def _assemble_xml_file(self, comments_data: Optional[List[CommentType]] = None):
237
+ # Assemble and write the XML file.
238
+
239
+ if comments_data is None:
240
+ comments_data = []
241
+
242
+ # Write the XML declaration.
243
+ self._xml_declaration()
244
+
245
+ # Write the comments element.
246
+ self._write_comments()
247
+
248
+ # Write the authors element.
249
+ self._write_authors(comments_data)
250
+
251
+ # Write the commentList element.
252
+ self._write_comment_list(comments_data)
253
+
254
+ self._xml_end_tag("comments")
255
+
256
+ # Close the file.
257
+ self._xml_close()
258
+
259
+ ###########################################################################
260
+ #
261
+ # XML methods.
262
+ #
263
+ ###########################################################################
264
+
265
+ def _write_comments(self):
266
+ # Write the <comments> element.
267
+ xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
268
+
269
+ attributes = [("xmlns", xmlns)]
270
+
271
+ self._xml_start_tag("comments", attributes)
272
+
273
+ def _write_authors(self, comment_data: List[CommentType]):
274
+ # Write the <authors> element.
275
+ author_count = 0
276
+
277
+ self._xml_start_tag("authors")
278
+
279
+ for comment in comment_data:
280
+ author = comment.author
281
+
282
+ if author is not None and author not in self.author_ids:
283
+ # Store the author id.
284
+ self.author_ids[author] = author_count
285
+ author_count += 1
286
+
287
+ # Write the author element.
288
+ self._write_author(author)
289
+
290
+ self._xml_end_tag("authors")
291
+
292
+ def _write_author(self, data: str):
293
+ # Write the <author> element.
294
+ self._xml_data_element("author", data)
295
+
296
+ def _write_comment_list(self, comment_data: List[CommentType]):
297
+ # Write the <commentList> element.
298
+ self._xml_start_tag("commentList")
299
+
300
+ for comment in comment_data:
301
+ # Look up the author id.
302
+ author_id = -1
303
+ if comment.author is not None:
304
+ author_id = self.author_ids[comment.author]
305
+
306
+ # Write the comment element.
307
+ self._write_comment(comment, author_id)
308
+
309
+ self._xml_end_tag("commentList")
310
+
311
+ def _write_comment(self, comment: CommentType, author_id: int):
312
+ # Write the <comment> element.
313
+ ref = xl_rowcol_to_cell(comment.row, comment.col)
314
+
315
+ attributes = [("ref", ref)]
316
+
317
+ if author_id != -1:
318
+ attributes.append(("authorId", f"{author_id}"))
319
+
320
+ self._xml_start_tag("comment", attributes)
321
+
322
+ # Write the text element.
323
+ self._write_text(comment)
324
+
325
+ self._xml_end_tag("comment")
326
+
327
+ def _write_text(self, comment: CommentType):
328
+ # Write the <text> element.
329
+ self._xml_start_tag("text")
330
+
331
+ # Write the text r element.
332
+ self._write_text_r(comment)
333
+
334
+ self._xml_end_tag("text")
335
+
336
+ def _write_text_r(self, comment: CommentType):
337
+ # Write the <r> element.
338
+ self._xml_start_tag("r")
339
+
340
+ # Write the rPr element.
341
+ self._write_r_pr(comment)
342
+
343
+ # Write the text r element.
344
+ self._write_text_t(comment.text)
345
+
346
+ self._xml_end_tag("r")
347
+
348
+ def _write_text_t(self, text: str):
349
+ # Write the text <t> element.
350
+ attributes = []
351
+
352
+ if _preserve_whitespace(text):
353
+ attributes.append(("xml:space", "preserve"))
354
+
355
+ self._xml_data_element("t", text, attributes)
356
+
357
+ def _write_r_pr(self, comment: CommentType):
358
+ # Write the <rPr> element.
359
+ self._xml_start_tag("rPr")
360
+
361
+ # Write the sz element.
362
+ self._write_sz(comment.font_size)
363
+
364
+ # Write the color element.
365
+ self._write_color()
366
+
367
+ # Write the rFont element.
368
+ self._write_r_font(comment.font_name)
369
+
370
+ # Write the family element.
371
+ self._write_family(comment.font_family)
372
+
373
+ self._xml_end_tag("rPr")
374
+
375
+ def _write_sz(self, font_size: float):
376
+ # Write the <sz> element.
377
+ attributes = [("val", font_size)]
378
+
379
+ self._xml_empty_tag("sz", attributes)
380
+
381
+ def _write_color(self):
382
+ # Write the <color> element.
383
+ attributes = [("indexed", 81)]
384
+
385
+ self._xml_empty_tag("color", attributes)
386
+
387
+ def _write_r_font(self, font_name: str):
388
+ # Write the <rFont> element.
389
+ attributes = [("val", font_name)]
390
+
391
+ self._xml_empty_tag("rFont", attributes)
392
+
393
+ def _write_family(self, font_family: int):
394
+ # Write the <family> element.
395
+ attributes = [("val", font_family)]
396
+
397
+ self._xml_empty_tag("family", attributes)