XlsxWriter 3.2.2__tar.gz → 3.2.4__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.2.2 → xlsxwriter-3.2.4}/Changes +53 -0
  2. {xlsxwriter-3.2.2/XlsxWriter.egg-info → xlsxwriter-3.2.4}/PKG-INFO +3 -5
  3. xlsxwriter-3.2.4/examples/colors.py +87 -0
  4. xlsxwriter-3.2.4/setup.py +35 -0
  5. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/__init__.py +1 -1
  6. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/app.py +7 -6
  7. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart.py +96 -38
  8. xlsxwriter-3.2.4/xlsxwriter/color.py +431 -0
  9. xlsxwriter-3.2.4/xlsxwriter/comments.py +390 -0
  10. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/contenttypes.py +18 -17
  11. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/core.py +14 -38
  12. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/custom.py +9 -13
  13. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/drawing.py +126 -166
  14. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/format.py +62 -48
  15. xlsxwriter-3.2.4/xlsxwriter/image.py +401 -0
  16. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/packager.py +12 -14
  17. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/rich_value.py +8 -7
  18. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/shape.py +20 -4
  19. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/styles.py +16 -31
  20. xlsxwriter-3.2.4/xlsxwriter/url.py +268 -0
  21. xlsxwriter-3.2.4/xlsxwriter/utility.py +998 -0
  22. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/vml.py +127 -51
  23. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/workbook.py +78 -151
  24. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/worksheet.py +316 -670
  25. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/xmlwriter.py +1 -1
  26. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4/xlsxwriter.egg-info}/PKG-INFO +3 -5
  27. {xlsxwriter-3.2.2/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/SOURCES.txt +9 -5
  28. xlsxwriter-3.2.2/setup.py +0 -57
  29. xlsxwriter-3.2.2/xlsxwriter/comments.py +0 -212
  30. xlsxwriter-3.2.2/xlsxwriter/utility.py +0 -1207
  31. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/LICENSE.txt +0 -0
  32. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/MANIFEST.in +0 -0
  33. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/README.rst +0 -0
  34. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/array_formula.py +0 -0
  35. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/autofilter.py +0 -0
  36. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/autofilter_data.txt +0 -0
  37. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/autofit.py +0 -0
  38. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/autofit_manually.py +0 -0
  39. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/background.py +0 -0
  40. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/cell_indentation.py +0 -0
  41. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart.py +0 -0
  42. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_area.py +0 -0
  43. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_bar.py +0 -0
  44. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_clustered.py +0 -0
  45. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_column.py +0 -0
  46. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_combined.py +0 -0
  47. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_data_labels.py +0 -0
  48. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_data_table.py +0 -0
  49. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_data_tools.py +0 -0
  50. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_date_axis.py +0 -0
  51. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_doughnut.py +0 -0
  52. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_gauge.py +0 -0
  53. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_gradient.py +0 -0
  54. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_line.py +0 -0
  55. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_pareto.py +0 -0
  56. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_pattern.py +0 -0
  57. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_pie.py +0 -0
  58. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_radar.py +0 -0
  59. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_scatter.py +0 -0
  60. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_secondary_axis.py +0 -0
  61. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_stock.py +0 -0
  62. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chart_styles.py +0 -0
  63. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/chartsheet.py +0 -0
  64. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/check_close.py +0 -0
  65. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/checkbox.py +0 -0
  66. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/comments1.py +0 -0
  67. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/comments2.py +0 -0
  68. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/conditional_format.py +0 -0
  69. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/context_manager.py +0 -0
  70. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/data_validate.py +0 -0
  71. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/datetimes.py +0 -0
  72. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/defined_name.py +0 -0
  73. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/demo.py +0 -0
  74. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/diagonal_border.py +0 -0
  75. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/django_simple.py +0 -0
  76. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/doc_properties.py +0 -0
  77. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/dynamic_arrays.py +0 -0
  78. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/embedded_images.py +0 -0
  79. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/headers_footers.py +0 -0
  80. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/hello_world.py +0 -0
  81. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/hide_row_col.py +0 -0
  82. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/hide_sheet.py +0 -0
  83. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/http_server.py +0 -0
  84. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/hyperlink.py +0 -0
  85. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/ignore_errors.py +0 -0
  86. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/images.py +0 -0
  87. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/images_bytesio.py +0 -0
  88. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/inheritance1.py +0 -0
  89. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/inheritance2.py +0 -0
  90. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/lambda.py +0 -0
  91. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/macros.py +0 -0
  92. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/merge1.py +0 -0
  93. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/merge_rich_string.py +0 -0
  94. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/outline.py +0 -0
  95. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/outline_collapsed.py +0 -0
  96. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_autofilter.py +0 -0
  97. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_chart.py +0 -0
  98. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_chart_columns.py +0 -0
  99. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_chart_line.py +0 -0
  100. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_column_formats.py +0 -0
  101. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_conditional_format.py +0 -0
  102. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_datetime.py +0 -0
  103. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_header_format.py +0 -0
  104. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_multiple.py +0 -0
  105. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_percentage.py +0 -0
  106. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_positioning.py +0 -0
  107. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_simple.py +0 -0
  108. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/pandas_table.py +0 -0
  109. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/panes.py +0 -0
  110. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_chart.py +0 -0
  111. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_checkbox.py +0 -0
  112. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_conditional_format.py +0 -0
  113. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_format_custom.py +0 -0
  114. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_format_default.py +0 -0
  115. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_multiple.py +0 -0
  116. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_positioning.py +0 -0
  117. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_simple.py +0 -0
  118. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_sparklines.py +0 -0
  119. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/polars_xlsxwriter.py +0 -0
  120. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/rich_strings.py +0 -0
  121. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/right_to_left.py +0 -0
  122. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/sensitivity_label.py +0 -0
  123. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/sparklines1.py +0 -0
  124. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/sparklines2.py +0 -0
  125. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/tab_colors.py +0 -0
  126. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/tables.py +0 -0
  127. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/text_indent.py +0 -0
  128. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/textbox.py +0 -0
  129. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/tutorial1.py +0 -0
  130. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/tutorial2.py +0 -0
  131. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/tutorial3.py +0 -0
  132. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/unicode.py +0 -0
  133. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/unicode_polish_utf8.py +0 -0
  134. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/unicode_polish_utf8.txt +0 -0
  135. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/unicode_shift_jis.py +0 -0
  136. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/unicode_shift_jis.txt +0 -0
  137. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/user_types1.py +0 -0
  138. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/user_types2.py +0 -0
  139. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/user_types3.py +0 -0
  140. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/vbaProject.bin +0 -0
  141. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/vba_extract.py +0 -0
  142. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/watermark.py +0 -0
  143. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/examples/worksheet_protection.py +0 -0
  144. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/setup.cfg +0 -0
  145. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_area.py +0 -0
  146. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_bar.py +0 -0
  147. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_column.py +0 -0
  148. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_doughnut.py +0 -0
  149. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_line.py +0 -0
  150. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_pie.py +0 -0
  151. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_radar.py +0 -0
  152. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_scatter.py +0 -0
  153. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chart_stock.py +0 -0
  154. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/chartsheet.py +0 -0
  155. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/exceptions.py +0 -0
  156. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/feature_property_bag.py +0 -0
  157. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/metadata.py +0 -0
  158. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/relationships.py +0 -0
  159. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_rel.py +0 -0
  160. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_structure.py +0 -0
  161. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_types.py +0 -0
  162. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/sharedstrings.py +0 -0
  163. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/table.py +0 -0
  164. {xlsxwriter-3.2.2 → xlsxwriter-3.2.4}/xlsxwriter/theme.py +0 -0
  165. {xlsxwriter-3.2.2/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/dependency_links.txt +0 -0
  166. {xlsxwriter-3.2.2/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/top_level.txt +0 -0
@@ -1,3 +1,56 @@
1
+ Release 3.2.4 - June 17 2025
2
+ ----------------------------
3
+
4
+ * Added support for a :ref:`Color() <Color>` type. This is backwards compatible
5
+ with existing Html and named color string types but also adds support for
6
+ theme colors. See also :ref:`colors`.
7
+
8
+ * Fixed issue where ``write_url()`` dropped implicit support for generic URL
9
+ types due to the refactoring into a ``Url`` type in the previous release.
10
+
11
+ :issue:`1129`.
12
+
13
+ * Fixed issue where ``max_url_length`` parameter wasn't honored.
14
+
15
+ :issue:`1130`.
16
+
17
+ * Made internal test function ``compare_xlsx_files()`` public via the Utility
18
+ module in order to facilitate similar testing by third party libraries.
19
+
20
+
21
+ Release 3.2.3 - April 17 2025
22
+ -----------------------------
23
+
24
+ * Fix for a breaking change in v3.2.1.
25
+
26
+ The Format class contained methods called ``set_font()``, ``set_size()`` and
27
+ ``set_color()`` which were old internal testing alternatives for
28
+ ``set_font_name()``, ``set_font_size()`` and ``set_font_color()``. Since they
29
+ were intentionally internal methods they were removed as part of a general
30
+ refactoring in v3.2.1. However, the alternative method names had leaked out
31
+ into production code and the removal caused breaks in dependent code. These
32
+ methods have been reinstated to prevent inadvertent breakages but may be
33
+ removed in the future after an orderly deprecation. Users should update to the
34
+ documented method names.
35
+
36
+ * This release drops support for Python 3.6 and 3.7, which are both EOL, in
37
+ order to simplify the additions of type annotations. The minimum supported
38
+ version of Python is now Python 3.8.
39
+
40
+ * This release contains code with initial type annotations as part of an overall
41
+ effort to add type annotations to the entire code base. It also contains
42
+ internal refactoring of some pseudo-types, based on dicts, into actual enum or
43
+ class types to allow stronger type checking. These will be rolled out in
44
+ upcoming releases.
45
+
46
+ This is part of a modernization of the XlsxWriter code base, see "XlsxWriter
47
+ Roadmap v2" :feature:`1128`.
48
+
49
+ * As part of the type annotation refactoring support was added for an explicit
50
+ ``Url`` type in addition to the implicit string URLs used in previous
51
+ versions. This isn't documented in this release.
52
+
53
+
1
54
  Release 3.2.2 - January 28 2025
2
55
  -------------------------------
3
56
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
- Name: XlsxWriter
3
- Version: 3.2.2
2
+ Name: xlsxwriter
3
+ Version: 3.2.4
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,15 +11,13 @@ 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
19
17
  Classifier: Programming Language :: Python :: 3.11
20
18
  Classifier: Programming Language :: Python :: 3.12
21
19
  Classifier: Programming Language :: Python :: 3.13
22
- Requires-Python: >=3.6
20
+ Requires-Python: >=3.8
23
21
  License-File: LICENSE.txt
24
22
  Dynamic: author
25
23
  Dynamic: author-email
@@ -0,0 +1,87 @@
1
+ ##############################################################################
2
+ #
3
+ # A demonstration of the RGB and Theme colors palettes available in the
4
+ # XlsxWriter Python module.
5
+ #
6
+ # SPDX-License-Identifier: BSD-2-Clause
7
+ #
8
+ # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
9
+ #
10
+ import xlsxwriter
11
+ from xlsxwriter.color import Color
12
+
13
+ # Create a new Excel file object.
14
+ workbook = xlsxwriter.Workbook("colors.xlsx")
15
+
16
+ # Add a worksheet for the RGB colors.
17
+ worksheet = workbook.add_worksheet("RGB Colors")
18
+
19
+ # Write some predefined colors to cells.
20
+ named_colors = [
21
+ "Black",
22
+ "Blue",
23
+ "Brown",
24
+ "Cyan",
25
+ "Gray",
26
+ "Green",
27
+ "Lime",
28
+ "Magenta",
29
+ "Navy",
30
+ "Orange",
31
+ "Pink",
32
+ "Purple",
33
+ "Red",
34
+ "Silver",
35
+ "White",
36
+ "Yellow",
37
+ ]
38
+
39
+ # Write the named colors.
40
+ for row, name in enumerate(named_colors):
41
+ color_format = workbook.add_format({"bg_color": Color(name)})
42
+ worksheet.write_string(row, 0, name)
43
+ worksheet.write_blank(row, 1, None, color_format)
44
+
45
+ # Write some user-defined RGB colors to cells.
46
+ user_defined_colors = [
47
+ "#FF7F50",
48
+ "#DCDCDC",
49
+ "#6495ED",
50
+ "#DAA520",
51
+ ]
52
+
53
+ for row, name in enumerate(user_defined_colors, start=len(named_colors)):
54
+ color_format = workbook.add_format({"bg_color": Color(name)})
55
+ worksheet.write_string(row, 0, name)
56
+ worksheet.write_blank(row, 1, None, color_format)
57
+
58
+ # Add a worksheet for the Theme colors.
59
+ worksheet = workbook.add_worksheet("Theme Colors")
60
+
61
+ # Add alternative colors for the cell text.
62
+ black_text = Color("#000000")
63
+ white_text = Color("#FFFFFF")
64
+
65
+ # Create a cell with each of the theme colors.
66
+ for row in range(6):
67
+ for col in range(10):
68
+ # Use the theme color for the background.
69
+ theme_color = Color.theme(col, row)
70
+
71
+ # Use white font color for better contrast on dark backgrounds.
72
+ if col != 0:
73
+ font_color = white_text
74
+ else:
75
+ font_color = black_text
76
+
77
+ color_format = workbook.add_format(
78
+ {
79
+ "align": "center",
80
+ "bg_color": theme_color,
81
+ "font_color": font_color,
82
+ }
83
+ )
84
+ worksheet.write_string(row, col, f"({col}, {row})", color_format)
85
+
86
+ # Save the file to disk.
87
+ workbook.close()
@@ -0,0 +1,35 @@
1
+ import sys
2
+ from warnings import warn
3
+
4
+ from setuptools import setup
5
+
6
+ if sys.version_info < (3, 8):
7
+ warn("The minimum Python version supported by XlsxWriter is 3.8")
8
+ sys.exit()
9
+
10
+ setup(
11
+ name="xlsxwriter",
12
+ version="3.2.4",
13
+ author="John McNamara",
14
+ author_email="jmcnamara@cpan.org",
15
+ url="https://github.com/jmcnamara/XlsxWriter",
16
+ packages=["xlsxwriter"],
17
+ scripts=["examples/vba_extract.py"],
18
+ license="BSD-2-Clause",
19
+ description="A Python module for creating Excel XLSX files.",
20
+ long_description=open("README.rst", encoding="utf-8").read(),
21
+ classifiers=[
22
+ "Development Status :: 5 - Production/Stable",
23
+ "License :: OSI Approved :: BSD License",
24
+ "Programming Language :: Python",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.8",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ ],
34
+ python_requires=">=3.8",
35
+ )
@@ -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.4"
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
 
@@ -11,11 +11,12 @@ import copy
11
11
  import re
12
12
  from warnings import warn
13
13
 
14
+ from xlsxwriter.color import Color, ColorTypes
15
+
14
16
  from . import xmlwriter
15
17
  from .shape import Shape
16
18
  from .utility import (
17
19
  _datetime_to_excel_datetime,
18
- _get_rgb_color,
19
20
  _supported_datetime,
20
21
  quote_sheetname,
21
22
  xl_range_formula,
@@ -54,7 +55,7 @@ class Chart(xmlwriter.XMLwriter):
54
55
  self.style_id = 2
55
56
  self.axis_ids = []
56
57
  self.axis2_ids = []
57
- self.cat_has_num_fmt = 0
58
+ self.cat_has_num_fmt = False
58
59
  self.requires_category = False
59
60
  self.legend = {}
60
61
  self.cat_axis_position = "b"
@@ -204,7 +205,10 @@ class Chart(xmlwriter.XMLwriter):
204
205
 
205
206
  # Set the "invert if negative" fill property.
206
207
  invert_if_neg = options.get("invert_if_negative", False)
207
- inverted_color = options.get("invert_if_negative_color", False)
208
+ inverted_color = options.get("invert_if_negative_color")
209
+
210
+ if inverted_color:
211
+ inverted_color = Color._from_value(inverted_color)
208
212
 
209
213
  # Set the secondary axis properties.
210
214
  x2_axis = options.get("x2_axis")
@@ -845,6 +849,9 @@ class Chart(xmlwriter.XMLwriter):
845
849
  if font["rotation"]:
846
850
  font["rotation"] = 60000 * int(font["rotation"])
847
851
 
852
+ if font.get("color"):
853
+ font["color"] = Color._from_value(font["color"])
854
+
848
855
  return font
849
856
 
850
857
  def _list_to_formula(self, data):
@@ -1889,7 +1896,7 @@ class Chart(xmlwriter.XMLwriter):
1889
1896
 
1890
1897
  self._xml_end_tag("c:ser")
1891
1898
 
1892
- def _write_c_ext_lst_inverted_color(self, color):
1899
+ def _write_c_ext_lst_inverted_color(self, color: Color):
1893
1900
  # Write the <c:extLst> element for the inverted fill color.
1894
1901
 
1895
1902
  uri = "{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}"
@@ -1982,17 +1989,17 @@ class Chart(xmlwriter.XMLwriter):
1982
1989
  cat_type = self._get_data_type(data)
1983
1990
 
1984
1991
  if cat_type == "str":
1985
- self.cat_has_num_fmt = 0
1992
+ self.cat_has_num_fmt = False
1986
1993
  # Write the c:numRef element.
1987
1994
  self._write_str_ref(formula, data, cat_type)
1988
1995
 
1989
1996
  elif cat_type == "multi_str":
1990
- self.cat_has_num_fmt = 0
1997
+ self.cat_has_num_fmt = False
1991
1998
  # Write the c:numRef element.
1992
1999
  self._write_multi_lvl_str_ref(formula, data)
1993
2000
 
1994
2001
  else:
1995
- self.cat_has_num_fmt = 1
2002
+ self.cat_has_num_fmt = True
1996
2003
  # Write the c:numRef element.
1997
2004
  self._write_num_ref(formula, data, cat_type)
1998
2005
 
@@ -3151,13 +3158,13 @@ class Chart(xmlwriter.XMLwriter):
3151
3158
 
3152
3159
  def _write_a_def_rpr(self, font):
3153
3160
  # Write the <a:defRPr> element.
3154
- has_color = 0
3161
+ has_color = False
3155
3162
 
3156
3163
  style_attributes = Shape._get_font_style_attributes(font)
3157
3164
  latin_attributes = Shape._get_font_latin_attributes(font)
3158
3165
 
3159
- if font and font.get("color") is not None:
3160
- has_color = 1
3166
+ if font and font.get("color"):
3167
+ has_color = True
3161
3168
 
3162
3169
  if latin_attributes or has_color:
3163
3170
  self._xml_start_tag("a:defRPr", style_attributes)
@@ -3195,14 +3202,14 @@ class Chart(xmlwriter.XMLwriter):
3195
3202
 
3196
3203
  def _write_a_r_pr(self, font):
3197
3204
  # Write the <a:rPr> element.
3198
- has_color = 0
3205
+ has_color = False
3199
3206
  lang = "en-US"
3200
3207
 
3201
3208
  style_attributes = Shape._get_font_style_attributes(font)
3202
3209
  latin_attributes = Shape._get_font_latin_attributes(font)
3203
3210
 
3204
- if font and font["color"] is not None:
3205
- has_color = 1
3211
+ if font and font["color"]:
3212
+ has_color = True
3206
3213
 
3207
3214
  # Add the lang type to the attributes.
3208
3215
  style_attributes.insert(0, ("lang", lang))
@@ -3362,17 +3369,46 @@ class Chart(xmlwriter.XMLwriter):
3362
3369
 
3363
3370
  self._xml_start_tag("a:solidFill")
3364
3371
 
3365
- if "color" in fill:
3366
- color = _get_rgb_color(fill["color"])
3367
- transparency = fill.get("transparency")
3372
+ if fill.get("color"):
3373
+ self._write_color(fill["color"], fill.get("transparency"))
3374
+
3375
+ self._xml_end_tag("a:solidFill")
3376
+
3377
+ def _write_color(self, color: Color, transparency=None):
3378
+ # Write the appropriate chart color element.
3379
+
3380
+ if not color:
3381
+ return
3382
+
3383
+ if color._is_automatic:
3384
+ # Write the a:sysClr element.
3385
+ self._write_a_sys_clr()
3386
+ elif color._type == ColorTypes.RGB:
3368
3387
  # Write the a:srgbClr element.
3369
3388
  self._write_a_srgb_clr(color, transparency)
3389
+ elif color._type == ColorTypes.THEME:
3390
+ self._write_a_scheme_clr(color, transparency)
3370
3391
 
3371
- self._xml_end_tag("a:solidFill")
3392
+ def _write_a_sys_clr(self):
3393
+ # Write the <a:sysClr> element.
3372
3394
 
3373
- def _write_a_srgb_clr(self, val, transparency=None):
3395
+ val = "window"
3396
+ last_clr = "FFFFFF"
3397
+
3398
+ attributes = [
3399
+ ("val", val),
3400
+ ("lastClr", last_clr),
3401
+ ]
3402
+
3403
+ self._xml_empty_tag("a:sysClr", attributes)
3404
+
3405
+ def _write_a_srgb_clr(self, color: Color, transparency=None):
3374
3406
  # Write the <a:srgbClr> element.
3375
- attributes = [("val", val)]
3407
+
3408
+ if not color:
3409
+ return
3410
+
3411
+ attributes = [("val", color._rgb_hex_value())]
3376
3412
 
3377
3413
  if transparency:
3378
3414
  self._xml_start_tag("a:srgbClr", attributes)
@@ -3384,6 +3420,42 @@ class Chart(xmlwriter.XMLwriter):
3384
3420
  else:
3385
3421
  self._xml_empty_tag("a:srgbClr", attributes)
3386
3422
 
3423
+ def _write_a_scheme_clr(self, color: Color, transparency=None):
3424
+ # Write the <a:schemeClr> element.
3425
+ scheme, lum_mod, lum_off = color._chart_scheme()
3426
+ attributes = [("val", scheme)]
3427
+
3428
+ if lum_mod > 0 or lum_off > 0 or transparency:
3429
+ self._xml_start_tag("a:schemeClr", attributes)
3430
+
3431
+ if lum_mod > 0:
3432
+ # Write the a:lumMod element.
3433
+ self._write_a_lum_mod(lum_mod)
3434
+
3435
+ if lum_off > 0:
3436
+ # Write the a:lumOff element.
3437
+ self._write_a_lum_off(lum_off)
3438
+
3439
+ if transparency:
3440
+ # Write the a:alpha element.
3441
+ self._write_a_alpha(transparency)
3442
+
3443
+ self._xml_end_tag("a:schemeClr")
3444
+ else:
3445
+ self._xml_empty_tag("a:schemeClr", attributes)
3446
+
3447
+ def _write_a_lum_mod(self, value: int):
3448
+ # Write the <a:lumMod> element.
3449
+ attributes = [("val", value)]
3450
+
3451
+ self._xml_empty_tag("a:lumMod", attributes)
3452
+
3453
+ def _write_a_lum_off(self, value: int):
3454
+ # Write the <a:lumOff> element.
3455
+ attributes = [("val", value)]
3456
+
3457
+ self._xml_empty_tag("a:lumOff", attributes)
3458
+
3387
3459
  def _write_a_alpha(self, val):
3388
3460
  # Write the <a:alpha> element.
3389
3461
 
@@ -4279,9 +4351,7 @@ class Chart(xmlwriter.XMLwriter):
4279
4351
  attributes = [("pos", pos)]
4280
4352
  self._xml_start_tag("a:gs", attributes)
4281
4353
 
4282
- # Write the a:srgbClr element.
4283
- color = _get_rgb_color(color)
4284
- self._write_a_srgb_clr(color)
4354
+ self._write_color(color)
4285
4355
 
4286
4356
  self._xml_end_tag("a:gs")
4287
4357
 
@@ -4357,26 +4427,14 @@ class Chart(xmlwriter.XMLwriter):
4357
4427
 
4358
4428
  self._xml_end_tag("a:pattFill")
4359
4429
 
4360
- def _write_a_fg_clr(self, color):
4430
+ def _write_a_fg_clr(self, color: Color):
4361
4431
  # Write the <a:fgClr> element.
4362
-
4363
- color = _get_rgb_color(color)
4364
-
4365
4432
  self._xml_start_tag("a:fgClr")
4366
-
4367
- # Write the a:srgbClr element.
4368
- self._write_a_srgb_clr(color)
4369
-
4433
+ self._write_color(color)
4370
4434
  self._xml_end_tag("a:fgClr")
4371
4435
 
4372
- def _write_a_bg_clr(self, color):
4436
+ def _write_a_bg_clr(self, color: Color):
4373
4437
  # Write the <a:bgClr> element.
4374
-
4375
- color = _get_rgb_color(color)
4376
-
4377
4438
  self._xml_start_tag("a:bgClr")
4378
-
4379
- # Write the a:srgbClr element.
4380
- self._write_a_srgb_clr(color)
4381
-
4439
+ self._write_color(color)
4382
4440
  self._xml_end_tag("a:bgClr")