XlsxWriter 3.3.3__tar.gz → 3.3.5__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.
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/Changes +32 -0
- {xlsxwriter-3.3.3/xlsxwriter.egg-info → xlsxwriter-3.3.5}/PKG-INFO +20 -11
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/README.rst +19 -10
- xlsxwriter-3.3.5/examples/custom_ui.py +39 -0
- xlsxwriter-3.3.5/examples/vbaProject_custom_ui.bin +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/pyproject.toml +1 -1
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/__init__.py +1 -1
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart.py +3 -2
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/exceptions.py +4 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/packager.py +23 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/relationships.py +11 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/shape.py +10 -2
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/sharedstrings.py +35 -5
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/utility.py +1 -1
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/workbook.py +51 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/worksheet.py +196 -122
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5/xlsxwriter.egg-info}/PKG-INFO +20 -11
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/SOURCES.txt +2 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/LICENSE.txt +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/MANIFEST.in +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/array_formula.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/autofilter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/autofilter_data.txt +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/autofit.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/autofit_manually.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/background.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/cell_indentation.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_area.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_bar.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_clustered.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_column.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_combined.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_data_labels.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_data_table.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_data_tools.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_date_axis.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_doughnut.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_gauge.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_gradient.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_line.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_pareto.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_pattern.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_pie.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_radar.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_scatter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_secondary_axis.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_stock.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chart_styles.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/chartsheet.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/check_close.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/checkbox.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/colors.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/comments1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/comments2.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/conditional_format.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/context_manager.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/data_validate.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/datetimes.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/defined_name.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/demo.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/diagonal_border.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/django_simple.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/doc_properties.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/dynamic_arrays.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/embedded_images.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/headers_footers.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/hello_world.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/hide_row_col.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/hide_sheet.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/http_server.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/hyperlink.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/ignore_errors.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/images.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/images_bytesio.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/inheritance1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/inheritance2.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/lambda.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/macros.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/merge1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/merge_rich_string.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/outline.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/outline_collapsed.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_autofilter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_chart.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_chart_columns.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_chart_line.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_column_formats.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_conditional_format.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_datetime.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_header_format.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_multiple.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_percentage.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_positioning.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_simple.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pandas_table.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/panes.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/pivot_table.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_chart.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_checkbox.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_conditional_format.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_format_custom.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_format_default.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_multiple.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_positioning.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_simple.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_sparklines.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/polars_xlsxwriter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/rich_strings.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/right_to_left.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/sensitivity_label.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/sparklines1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/sparklines2.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/tab_colors.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/tables.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/text_indent.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/textbox.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/theme_custom.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/theme_excel_2023.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/tutorial1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/tutorial2.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/tutorial3.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/unicode.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/unicode_polish_utf8.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/unicode_polish_utf8.txt +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/unicode_shift_jis.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/unicode_shift_jis.txt +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/user_types1.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/user_types2.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/user_types3.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/vbaProject.bin +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/vba_extract.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/watermark.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/examples/worksheet_protection.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/setup.cfg +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/app.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_area.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_bar.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_column.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_doughnut.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_line.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_pie.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_radar.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_scatter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_stock.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chart_title.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/chartsheet.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/color.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/comments.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/contenttypes.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/core.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/custom.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/drawing.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/feature_property_bag.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/format.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/image.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/metadata.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/pivot_cache.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/pivot_table.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/rich_value.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_rel.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_structure.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_types.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/styles.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/table.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/theme.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/url.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/vml.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter/xmlwriter.py +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/dependency_links.txt +0 -0
- {xlsxwriter-3.3.3 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
Release 3.3.5 - November 29 2026
|
|
2
|
+
--------------------------------
|
|
3
|
+
|
|
4
|
+
* Added support for the Excel 2010 ``3_stars``, ``3_triangles`` and
|
|
5
|
+
``5_boxes`` conditional format icon sets.
|
|
6
|
+
|
|
7
|
+
:feature:`1110`.
|
|
8
|
+
|
|
9
|
+
* Added support for the ``strikeout`` font property in charts and
|
|
10
|
+
textboxes.
|
|
11
|
+
|
|
12
|
+
* Fixed issue where strings that looked like rich string XML, such as
|
|
13
|
+
``<r>abc</r>``, were written unescaped and caused a corrupt file.
|
|
14
|
+
|
|
15
|
+
:issue:`1233`.
|
|
16
|
+
|
|
17
|
+
* Fixed fractional chart and textbox font sizes that were truncated to the
|
|
18
|
+
wrong value.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Release 3.3.4 - November 22 2026
|
|
22
|
+
--------------------------------
|
|
23
|
+
|
|
24
|
+
* Added support for custom ribbon UI XML files via the :func:`add_custom_ui`
|
|
25
|
+
method. See :ref:`customui`.
|
|
26
|
+
|
|
27
|
+
:feature:`1086`.
|
|
28
|
+
|
|
29
|
+
* Fixed issue where datetimes on 1900-02-28 with a time after midnight were
|
|
30
|
+
written as 1900-02-29.
|
|
31
|
+
|
|
32
|
+
:issue:`1232`.
|
|
1
33
|
|
|
2
34
|
Release 3.3.3 - November 20 2026
|
|
3
35
|
--------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xlsxwriter
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.5
|
|
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
|
|
@@ -36,21 +36,30 @@ multiple worksheets and it supports features such as formatting and many more,
|
|
|
36
36
|
including:
|
|
37
37
|
|
|
38
38
|
* 100% compatible Excel XLSX files.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Support for writing all basic Excel data types.
|
|
40
|
+
* Full cell formatting support.
|
|
41
|
+
* Formula support, including new Excel 365 dynamic functions.
|
|
42
42
|
* Charts.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Hyperlink support.
|
|
44
|
+
* Page/Printing Setup support.
|
|
45
|
+
* Merged ranges.
|
|
45
46
|
* Conditional formatting.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
47
|
+
* Data validation and drop down lists.
|
|
48
|
+
* Cell comments.
|
|
49
|
+
* Textboxes.
|
|
50
|
+
* Checkboxes.
|
|
51
|
+
* Sparklines.
|
|
48
52
|
* Worksheet PNG/JPEG/GIF/BMP/WMF/EMF images.
|
|
53
|
+
* Workbook themes.
|
|
49
54
|
* Rich multi-format strings.
|
|
50
|
-
*
|
|
55
|
+
* Outline groupings.
|
|
56
|
+
* Defined names.
|
|
57
|
+
* Autofilters.
|
|
58
|
+
* Worksheet tables.
|
|
59
|
+
* Pivot tables.
|
|
51
60
|
* Integration with Pandas and Polars.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
61
|
+
* Support for macros.
|
|
62
|
+
* Custom UI/Ribbon elements.
|
|
54
63
|
* Memory optimization mode for writing large files.
|
|
55
64
|
|
|
56
65
|
It supports Python 3.8+ and PyPy3 and uses standard libraries only.
|
|
@@ -9,21 +9,30 @@ multiple worksheets and it supports features such as formatting and many more,
|
|
|
9
9
|
including:
|
|
10
10
|
|
|
11
11
|
* 100% compatible Excel XLSX files.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Support for writing all basic Excel data types.
|
|
13
|
+
* Full cell formatting support.
|
|
14
|
+
* Formula support, including new Excel 365 dynamic functions.
|
|
15
15
|
* Charts.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Hyperlink support.
|
|
17
|
+
* Page/Printing Setup support.
|
|
18
|
+
* Merged ranges.
|
|
18
19
|
* Conditional formatting.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* Data validation and drop down lists.
|
|
21
|
+
* Cell comments.
|
|
22
|
+
* Textboxes.
|
|
23
|
+
* Checkboxes.
|
|
24
|
+
* Sparklines.
|
|
21
25
|
* Worksheet PNG/JPEG/GIF/BMP/WMF/EMF images.
|
|
26
|
+
* Workbook themes.
|
|
22
27
|
* Rich multi-format strings.
|
|
23
|
-
*
|
|
28
|
+
* Outline groupings.
|
|
29
|
+
* Defined names.
|
|
30
|
+
* Autofilters.
|
|
31
|
+
* Worksheet tables.
|
|
32
|
+
* Pivot tables.
|
|
24
33
|
* Integration with Pandas and Polars.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
34
|
+
* Support for macros.
|
|
35
|
+
* Custom UI/Ribbon elements.
|
|
27
36
|
* Memory optimization mode for writing large files.
|
|
28
37
|
|
|
29
38
|
It supports Python 3.8+ and PyPy3 and uses standard libraries only.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#######################################################################
|
|
2
|
+
#
|
|
3
|
+
# An example of adding a custom ribbon tab to an XlsxWriter file using a
|
|
4
|
+
# Custom UI XML file.
|
|
5
|
+
#
|
|
6
|
+
# The custom tab contains built-in Excel commands and a button that runs a
|
|
7
|
+
# macro from a VBA project file.
|
|
8
|
+
#
|
|
9
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
10
|
+
#
|
|
11
|
+
# Copyright (c) 2013-2026, John McNamara, jmcnamara@cpan.org
|
|
12
|
+
#
|
|
13
|
+
import xlsxwriter
|
|
14
|
+
|
|
15
|
+
# Note the file extension should be .xlsm.
|
|
16
|
+
workbook = xlsxwriter.Workbook("custom_ui.xlsm")
|
|
17
|
+
worksheet = workbook.add_worksheet()
|
|
18
|
+
|
|
19
|
+
worksheet.set_column("A:A", 50)
|
|
20
|
+
|
|
21
|
+
# Add the Custom UI XML file for the Excel 2010+ ribbon.
|
|
22
|
+
workbook.add_custom_ui("./customUI14.xml")
|
|
23
|
+
|
|
24
|
+
# Show some instructions for the end user.
|
|
25
|
+
bold = workbook.add_format({"bold": True})
|
|
26
|
+
worksheet.write("A1", "Use the 'My Ribbon' tab to sort the selected data.", bold)
|
|
27
|
+
|
|
28
|
+
# Add some data to sort.
|
|
29
|
+
for row, fruit in enumerate(["Pear", "Apple", "Orange", "Banana", "Grape"], 2):
|
|
30
|
+
worksheet.write(row, 0, fruit)
|
|
31
|
+
|
|
32
|
+
# Preselect the data so it is ready to sort.
|
|
33
|
+
worksheet.set_selection("A3:A7")
|
|
34
|
+
|
|
35
|
+
# Add the VBA project for the macro on the custom ribbon tab. This was extracted
|
|
36
|
+
# from an Excel file using the vba_extract tool.
|
|
37
|
+
workbook.add_vba_project("./vbaProject_custom_ui.bin")
|
|
38
|
+
|
|
39
|
+
workbook.close()
|
|
Binary file
|
|
@@ -843,15 +843,16 @@ class Chart(xmlwriter.XMLwriter):
|
|
|
843
843
|
"bold": options.get("bold"),
|
|
844
844
|
"italic": options.get("italic"),
|
|
845
845
|
"underline": options.get("underline"),
|
|
846
|
+
"strikeout": options.get("strikeout"),
|
|
846
847
|
"pitch_family": options.get("pitch_family"),
|
|
847
848
|
"charset": options.get("charset"),
|
|
848
849
|
"baseline": options.get("baseline", 0),
|
|
849
850
|
"rotation": options.get("rotation"),
|
|
850
851
|
}
|
|
851
852
|
|
|
852
|
-
# Convert font size units.
|
|
853
|
+
# Convert font size units to integer hundredths of a point.
|
|
853
854
|
if font["size"]:
|
|
854
|
-
font["size"] =
|
|
855
|
+
font["size"] = round(font["size"] * 100)
|
|
855
856
|
|
|
856
857
|
# Convert rotation into 60,000ths of a degree.
|
|
857
858
|
if font["rotation"]:
|
|
@@ -171,6 +171,7 @@ class Packager:
|
|
|
171
171
|
self._write_metadata_file()
|
|
172
172
|
self._write_feature_bag_property()
|
|
173
173
|
self._write_rich_value_files()
|
|
174
|
+
self._add_ribbons()
|
|
174
175
|
|
|
175
176
|
return self.filenames
|
|
176
177
|
|
|
@@ -626,6 +627,9 @@ class Packager:
|
|
|
626
627
|
if self.workbook.custom_properties:
|
|
627
628
|
rels._add_document_relationship("/custom-properties", "docProps/custom.xml")
|
|
628
629
|
|
|
630
|
+
for part_name in self.workbook.custom_uis:
|
|
631
|
+
rels._add_custom_ui_relationship(part_name)
|
|
632
|
+
|
|
629
633
|
rels._set_xml_writer(self._filename("_rels/.rels"))
|
|
630
634
|
|
|
631
635
|
rels._assemble_xml_file()
|
|
@@ -929,3 +933,22 @@ class Packager:
|
|
|
929
933
|
os_filename = BytesIO(vba_data)
|
|
930
934
|
|
|
931
935
|
self.filenames.append((os_filename, xml_vba_name, True))
|
|
936
|
+
|
|
937
|
+
def _add_ribbons(self) -> None:
|
|
938
|
+
# Write the Custom UI XML files.
|
|
939
|
+
custom_uis = self.workbook.custom_uis
|
|
940
|
+
|
|
941
|
+
if not custom_uis:
|
|
942
|
+
return
|
|
943
|
+
|
|
944
|
+
for part_name, (_, custom_ui_data) in custom_uis.items():
|
|
945
|
+
part_path = f"customUI/{part_name}.xml"
|
|
946
|
+
if not self.in_memory:
|
|
947
|
+
# In file mode we write the xml data to a file.
|
|
948
|
+
with open(self._filename(part_path), mode="wb") as custom_ui_file:
|
|
949
|
+
custom_ui_file.write(custom_ui_data)
|
|
950
|
+
|
|
951
|
+
else:
|
|
952
|
+
# Store the user's XML bytes unchanged.
|
|
953
|
+
os_filename = BytesIO(custom_ui_data)
|
|
954
|
+
self.filenames.append((os_filename, part_path, True))
|
|
@@ -76,6 +76,17 @@ class Relationships(xmlwriter.XMLwriter):
|
|
|
76
76
|
|
|
77
77
|
self.relationships.append((rel_type, target, None))
|
|
78
78
|
|
|
79
|
+
def _add_custom_ui_relationship(self, part_name) -> None:
|
|
80
|
+
# Add Custom UI relationship. Excel 2010+ parts use the 2007 schema.
|
|
81
|
+
if part_name == "customUI14":
|
|
82
|
+
schema = "http://schemas.microsoft.com/office/2007/relationships"
|
|
83
|
+
else:
|
|
84
|
+
schema = "http://schemas.microsoft.com/office/2006/relationships"
|
|
85
|
+
|
|
86
|
+
rel_type = schema + "/ui/extensibility"
|
|
87
|
+
target = f"customUI/{part_name}.xml"
|
|
88
|
+
self.relationships.append((rel_type, target, None))
|
|
89
|
+
|
|
79
90
|
def _add_rich_value_relationship(self) -> None:
|
|
80
91
|
# Add RichValue relationship to XLSX .rels xml files.
|
|
81
92
|
schema = "http://schemas.microsoft.com/office/2022/10/relationships/"
|
|
@@ -330,15 +330,20 @@ class Shape:
|
|
|
330
330
|
"bold": options.get("bold"),
|
|
331
331
|
"italic": options.get("italic"),
|
|
332
332
|
"underline": options.get("underline"),
|
|
333
|
+
"strikeout": options.get("strikeout"),
|
|
333
334
|
"pitch_family": options.get("pitch_family"),
|
|
334
335
|
"charset": options.get("charset"),
|
|
335
336
|
"baseline": options.get("baseline", -1),
|
|
336
337
|
"lang": options.get("lang", "en-US"),
|
|
337
338
|
}
|
|
338
339
|
|
|
339
|
-
#
|
|
340
|
+
# Excel adds a baseline to strikeout fonts.
|
|
341
|
+
if font["strikeout"] and "baseline" not in options:
|
|
342
|
+
font["baseline"] = 0
|
|
343
|
+
|
|
344
|
+
# Convert font size units to integer hundredths of a point.
|
|
340
345
|
if font["size"]:
|
|
341
|
-
font["size"] =
|
|
346
|
+
font["size"] = round(font["size"] * 100)
|
|
342
347
|
|
|
343
348
|
if font.get("color"):
|
|
344
349
|
font["color"] = Color._from_value(font["color"])
|
|
@@ -365,6 +370,9 @@ class Shape:
|
|
|
365
370
|
if font.get("underline") is not None:
|
|
366
371
|
attributes.append(("u", "sng"))
|
|
367
372
|
|
|
373
|
+
if font.get("strikeout"):
|
|
374
|
+
attributes.append(("strike", "sngStrike"))
|
|
375
|
+
|
|
368
376
|
if font.get("baseline") != -1:
|
|
369
377
|
attributes.append(("baseline", font["baseline"]))
|
|
370
378
|
|
|
@@ -79,10 +79,12 @@ class SharedStrings(xmlwriter.XMLwriter):
|
|
|
79
79
|
def _write_sst_strings(self) -> None:
|
|
80
80
|
# Write the sst string elements.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
self._write_si(string)
|
|
82
|
+
rich_string_indices = self.string_table.rich_string_indices
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
for index, string in enumerate(self.string_table.string_array):
|
|
85
|
+
self._write_si(string, index in rich_string_indices)
|
|
86
|
+
|
|
87
|
+
def _write_si(self, string, is_rich_string=False) -> None:
|
|
86
88
|
# Write the <si> element.
|
|
87
89
|
attributes = []
|
|
88
90
|
|
|
@@ -94,7 +96,7 @@ class SharedStrings(xmlwriter.XMLwriter):
|
|
|
94
96
|
attributes.append(("xml:space", "preserve"))
|
|
95
97
|
|
|
96
98
|
# Write any rich strings without further tags.
|
|
97
|
-
if
|
|
99
|
+
if is_rich_string:
|
|
98
100
|
self._xml_rich_si_element(string)
|
|
99
101
|
else:
|
|
100
102
|
self._xml_si_element(string, attributes)
|
|
@@ -111,7 +113,9 @@ class SharedStringTable:
|
|
|
111
113
|
self.count = 0
|
|
112
114
|
self.unique_count = 0
|
|
113
115
|
self.string_table = {}
|
|
116
|
+
self.rich_string_table = {}
|
|
114
117
|
self.string_array = []
|
|
118
|
+
self.rich_string_indices = set()
|
|
115
119
|
|
|
116
120
|
def _get_shared_string_index(self, string):
|
|
117
121
|
""" " Get the index of the string in the Shared String table."""
|
|
@@ -128,11 +132,37 @@ class SharedStringTable:
|
|
|
128
132
|
self.count += 1
|
|
129
133
|
return index
|
|
130
134
|
|
|
135
|
+
def _get_rich_string_index(self, string):
|
|
136
|
+
"""Get the index of a rich string in the Shared String table."""
|
|
137
|
+
# Rich strings are stored separately so that plain strings that look
|
|
138
|
+
# like rich string XML aren't stored with actual rich strings.
|
|
139
|
+
if string not in self.rich_string_table:
|
|
140
|
+
# String isn't already stored in the table so add it.
|
|
141
|
+
index = self.unique_count
|
|
142
|
+
self.rich_string_table[string] = index
|
|
143
|
+
self.count += 1
|
|
144
|
+
self.unique_count += 1
|
|
145
|
+
return index
|
|
146
|
+
|
|
147
|
+
# String exists in the table.
|
|
148
|
+
index = self.rich_string_table[string]
|
|
149
|
+
self.count += 1
|
|
150
|
+
return index
|
|
151
|
+
|
|
131
152
|
def _get_shared_string(self, index):
|
|
132
153
|
""" " Get a shared string from the index."""
|
|
133
154
|
return self.string_array[index]
|
|
134
155
|
|
|
135
156
|
def _sort_string_data(self) -> None:
|
|
136
157
|
""" " Sort the shared string data and convert from dict to list."""
|
|
137
|
-
self.string_array =
|
|
158
|
+
self.string_array = [""] * self.unique_count
|
|
159
|
+
|
|
160
|
+
for string, index in self.string_table.items():
|
|
161
|
+
self.string_array[index] = string
|
|
162
|
+
|
|
163
|
+
for string, index in self.rich_string_table.items():
|
|
164
|
+
self.string_array[index] = string
|
|
165
|
+
self.rich_string_indices.add(index)
|
|
166
|
+
|
|
138
167
|
self.string_table = {}
|
|
168
|
+
self.rich_string_table = {}
|
|
@@ -942,7 +942,7 @@ def _datetime_to_excel_datetime(
|
|
|
942
942
|
excel_time -= 1
|
|
943
943
|
|
|
944
944
|
# Account for Excel erroneously treating 1900 as a leap year.
|
|
945
|
-
if not date_1904 and not is_timedelta and excel_time
|
|
945
|
+
if not date_1904 and not is_timedelta and excel_time >= 60:
|
|
946
946
|
excel_time += 1
|
|
947
947
|
|
|
948
948
|
return excel_time
|
|
@@ -20,6 +20,7 @@ from fractions import Fraction
|
|
|
20
20
|
from io import StringIO
|
|
21
21
|
from typing import IO, Any, AnyStr, Dict, List, Literal, Optional, Tuple, Union
|
|
22
22
|
from warnings import warn
|
|
23
|
+
from xml.etree import ElementTree
|
|
23
24
|
from zipfile import ZIP_DEFLATED, LargeZipFile, ZipFile, ZipInfo
|
|
24
25
|
|
|
25
26
|
# Package imports.
|
|
@@ -35,6 +36,7 @@ from xlsxwriter.chart_scatter import ChartScatter
|
|
|
35
36
|
from xlsxwriter.chart_stock import ChartStock
|
|
36
37
|
from xlsxwriter.chartsheet import Chartsheet
|
|
37
38
|
from xlsxwriter.exceptions import (
|
|
39
|
+
CustomUIFileError,
|
|
38
40
|
DuplicateWorksheetName,
|
|
39
41
|
FileCreateError,
|
|
40
42
|
FileSizeError,
|
|
@@ -176,6 +178,8 @@ class Workbook(xmlwriter.XMLwriter):
|
|
|
176
178
|
self.default_theme_version: str = "124226"
|
|
177
179
|
self.theme_xml: str = THEME_XML_2007
|
|
178
180
|
|
|
181
|
+
self.custom_uis: Dict[str, Tuple[Union[str, os.PathLike], bytes]] = {}
|
|
182
|
+
|
|
179
183
|
# We can't do 'constant_memory' mode while doing 'in_memory' mode.
|
|
180
184
|
if self.in_memory:
|
|
181
185
|
self.constant_memory = False
|
|
@@ -462,6 +466,53 @@ class Workbook(xmlwriter.XMLwriter):
|
|
|
462
466
|
self.theme_xml = theme_xml
|
|
463
467
|
self.default_theme_version = ""
|
|
464
468
|
|
|
469
|
+
def add_custom_ui(self, custom_ui: Union[str, os.PathLike]) -> None:
|
|
470
|
+
"""
|
|
471
|
+
Add a custom ribbon UI XML file to the Excel workbook.
|
|
472
|
+
|
|
473
|
+
Args:
|
|
474
|
+
custom_ui: The Custom UI XML file path (string or PathLike).
|
|
475
|
+
|
|
476
|
+
Raises:
|
|
477
|
+
OSError: If the file cannot be read.
|
|
478
|
+
CustomUIFileError: If the file isn't valid Custom UI XML, or a
|
|
479
|
+
file of the same format was already added.
|
|
480
|
+
|
|
481
|
+
"""
|
|
482
|
+
# Read the file once so the saved part is the one that was checked.
|
|
483
|
+
with open(custom_ui, mode="rb") as custom_ui_file:
|
|
484
|
+
custom_ui_data = custom_ui_file.read()
|
|
485
|
+
|
|
486
|
+
try:
|
|
487
|
+
root_tag = ElementTree.fromstring(custom_ui_data).tag
|
|
488
|
+
except ElementTree.ParseError as e:
|
|
489
|
+
raise CustomUIFileError(
|
|
490
|
+
f"Invalid XML in Custom UI file '{custom_ui}': {e}."
|
|
491
|
+
) from e
|
|
492
|
+
|
|
493
|
+
# Map the root namespace to the Excel 2007 or 2010+ part name.
|
|
494
|
+
schema = "http://schemas.microsoft.com/office"
|
|
495
|
+
part_names = {
|
|
496
|
+
f"{{{schema}/2006/01/customui}}customUI": "customUI",
|
|
497
|
+
f"{{{schema}/2009/07/customui}}customUI": "customUI14",
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
part_name = part_names.get(root_tag)
|
|
501
|
+
|
|
502
|
+
if part_name is None:
|
|
503
|
+
raise CustomUIFileError(
|
|
504
|
+
f"Unrecognized root element or namespace in Custom UI file "
|
|
505
|
+
f"'{custom_ui}'."
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
if part_name in self.custom_uis:
|
|
509
|
+
raise CustomUIFileError(
|
|
510
|
+
f"Custom UI file '{custom_ui}' has the same namespace as "
|
|
511
|
+
f"'{self.custom_uis[part_name][0]}'. Only one of each is allowed."
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
self.custom_uis[part_name] = (custom_ui, custom_ui_data)
|
|
515
|
+
|
|
465
516
|
def close(self) -> None:
|
|
466
517
|
"""
|
|
467
518
|
Call finalization code and close file.
|