XlsxWriter 3.2.0__tar.gz → 3.2.1__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.2.0 → XlsxWriter-3.2.1}/Changes +21 -3
- {XlsxWriter-3.2.0/XlsxWriter.egg-info → XlsxWriter-3.2.1}/PKG-INFO +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1/XlsxWriter.egg-info}/PKG-INFO +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/XlsxWriter.egg-info/SOURCES.txt +2 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/autofilter.py +1 -1
- XlsxWriter-3.2.1/examples/autofit_manually.py +31 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/background.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_combined.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_date_axis.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_stock.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_styles.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/check_close.py +3 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/data_validate.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/datetimes.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/defined_name.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/demo.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/django_simple.py +5 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/dynamic_arrays.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/embedded_images.py +5 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/images.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/images_bytesio.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/inheritance1.py +3 -4
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/inheritance2.py +6 -7
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/merge1.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/merge_rich_string.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_chart.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_chart_line.py +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_conditional_format.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_datetime.py +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_multiple.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_percentage.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_positioning.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_simple.py +0 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_chart.py +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_format_custom.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_format_default.py +1 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_multiple.py +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_positioning.py +3 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_sparklines.py +1 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_xlsxwriter.py +2 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/rich_strings.py +2 -2
- XlsxWriter-3.2.1/examples/sensitivity_label.py +29 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/tutorial3.py +1 -0
- XlsxWriter-3.2.1/examples/unicode_polish_utf8.py +38 -0
- XlsxWriter-3.2.1/examples/unicode_shift_jis.py +38 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/user_types1.py +4 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/user_types2.py +4 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/user_types3.py +3 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/vba_extract.py +14 -14
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/setup.py +3 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/__init__.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/app.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart.py +74 -79
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_area.py +3 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_bar.py +6 -4
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_column.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_doughnut.py +6 -5
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_line.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_pie.py +7 -5
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_radar.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_scatter.py +5 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chart_stock.py +4 -4
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/chartsheet.py +2 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/comments.py +7 -5
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/contenttypes.py +21 -20
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/core.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/custom.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/drawing.py +18 -27
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/format.py +229 -66
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/metadata.py +6 -6
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/packager.py +14 -13
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/relationships.py +7 -7
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/rich_value.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/rich_value_rel.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/rich_value_structure.py +3 -3
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/rich_value_types.py +0 -14
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/shape.py +23 -22
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/sharedstrings.py +9 -9
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/styles.py +2 -5
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/table.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/theme.py +4 -2
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/utility.py +139 -54
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/vml.py +20 -34
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/workbook.py +85 -51
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/worksheet.py +381 -337
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/xmlwriter.py +32 -32
- XlsxWriter-3.2.0/examples/unicode_polish_utf8.py +0 -38
- XlsxWriter-3.2.0/examples/unicode_shift_jis.py +0 -38
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/LICENSE.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/MANIFEST.in +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/README.rst +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/XlsxWriter.egg-info/dependency_links.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/XlsxWriter.egg-info/top_level.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/array_formula.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/autofilter_data.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/autofit.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/cell_indentation.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_area.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_bar.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_clustered.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_column.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_data_labels.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_data_table.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_data_tools.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_doughnut.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_gauge.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_gradient.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_line.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_pareto.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_pattern.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_pie.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_radar.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_scatter.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chart_secondary_axis.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/chartsheet.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/comments1.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/comments2.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/conditional_format.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/context_manager.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/diagonal_border.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/doc_properties.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/headers_footers.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/hello_world.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/hide_row_col.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/hide_sheet.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/http_server.py +1 -1
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/hyperlink.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/ignore_errors.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/lambda.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/macros.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/outline.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/outline_collapsed.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_autofilter.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_chart_columns.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_column_formats.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_header_format.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/pandas_table.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/panes.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_conditional_format.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/polars_simple.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/right_to_left.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/sparklines1.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/sparklines2.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/tab_colors.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/tables.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/text_indent.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/textbox.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/tutorial1.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/tutorial2.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/unicode.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/unicode_polish_utf8.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/unicode_shift_jis.txt +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/vbaProject.bin +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/watermark.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/examples/worksheet_protection.py +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/setup.cfg +0 -0
- {XlsxWriter-3.2.0 → XlsxWriter-3.2.1}/xlsxwriter/exceptions.py +0 -0
|
@@ -1,10 +1,28 @@
|
|
|
1
|
+
Release 3.2.1 - January 22 2025
|
|
2
|
+
--------------------------------
|
|
3
|
+
|
|
4
|
+
Added improvements to ``autofit()``.
|
|
5
|
+
|
|
6
|
+
* Added the optional ``max_width`` parameter to the :func:`autofit()` method to
|
|
7
|
+
work around the issue where the autofit width is too big.
|
|
8
|
+
|
|
9
|
+
Excel autofits very long strings up to limit of 1790 pixels/255 characters.
|
|
10
|
+
This is often too wide to display on a single screen at normal zoom. As such
|
|
11
|
+
the ``max_width`` parameter is provided to enable a smaller upper pixel limit
|
|
12
|
+
for autofitting long strings. See :func:`autofit()`.
|
|
13
|
+
|
|
14
|
+
:feature:`1106`.
|
|
15
|
+
|
|
16
|
+
* Added the :func:`cell_autofit_width` utility function to allow users to
|
|
17
|
+
calculate the auto-fit width for a cell value. This allows the user to
|
|
18
|
+
implement their own auto-fit logic. See :ref:`ex_autofit_manually`.
|
|
1
19
|
|
|
2
20
|
|
|
3
21
|
Release 3.2.0 - February 17 2024
|
|
4
22
|
--------------------------------
|
|
5
23
|
|
|
6
24
|
This is the 10th anniversary release of XlsxWriter. Version 0.0.1 was released
|
|
7
|
-
on February 17 2013. Since
|
|
25
|
+
on February 17 2013. Since then there have been 167 releases, 25,000 lines of
|
|
8
26
|
code, 1600 test cases, 700 pages of documentation, 71,000 users on GitHub, 50
|
|
9
27
|
contributors, 1000 closed issues and 150 million yearly downloads. Thanks to
|
|
10
28
|
everyone who has contributed code, given feedback or just used the library.
|
|
@@ -118,9 +136,9 @@ Release 3.0.9 - March 10 2023
|
|
|
118
136
|
-----------------------------
|
|
119
137
|
|
|
120
138
|
* Add documentation and examples on :ref:`ewx_polars` to demonstrate new `Polars
|
|
121
|
-
<https://
|
|
139
|
+
<https://pola.rs/>`_ integration of XlsxWriter in `write_excel()`_.
|
|
122
140
|
|
|
123
|
-
.. _write_excel(): https://pola
|
|
141
|
+
.. _write_excel(): https://docs.pola.rs/py-polars/html/reference/api/polars.DataFrame.write_excel.html
|
|
124
142
|
|
|
125
143
|
* Add fix for rare issue with duplicate number formats.
|
|
126
144
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: XlsxWriter
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.1
|
|
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
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
22
|
Requires-Python: >=3.6
|
|
22
23
|
License-File: LICENSE.txt
|
|
23
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: XlsxWriter
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.1
|
|
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
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
22
|
Requires-Python: >=3.6
|
|
22
23
|
License-File: LICENSE.txt
|
|
23
24
|
|
|
@@ -12,6 +12,7 @@ examples/array_formula.py
|
|
|
12
12
|
examples/autofilter.py
|
|
13
13
|
examples/autofilter_data.txt
|
|
14
14
|
examples/autofit.py
|
|
15
|
+
examples/autofit_manually.py
|
|
15
16
|
examples/background.py
|
|
16
17
|
examples/cell_indentation.py
|
|
17
18
|
examples/chart.py
|
|
@@ -93,6 +94,7 @@ examples/polars_sparklines.py
|
|
|
93
94
|
examples/polars_xlsxwriter.py
|
|
94
95
|
examples/rich_strings.py
|
|
95
96
|
examples/right_to_left.py
|
|
97
|
+
examples/sensitivity_label.py
|
|
96
98
|
examples/sparklines1.py
|
|
97
99
|
examples/sparklines2.py
|
|
98
100
|
examples/tab_colors.py
|
|
@@ -26,7 +26,7 @@ worksheet7 = workbook.add_worksheet()
|
|
|
26
26
|
bold = workbook.add_format({"bold": 1})
|
|
27
27
|
|
|
28
28
|
# Open a text file with autofilter example data.
|
|
29
|
-
textfile = open("autofilter_data.txt")
|
|
29
|
+
textfile = open("autofilter_data.txt", encoding="utf-8")
|
|
30
30
|
|
|
31
31
|
# Read the headers from the first line of the input file.
|
|
32
32
|
headers = textfile.readline().strip("\n").split()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
#
|
|
3
|
+
# The following example demonstrates manually auto-fitting the the width of a
|
|
4
|
+
# column in Excel based on the maximum string width. The worksheet ``autofit()``
|
|
5
|
+
# method will do this automatically but occasionally you may need to control the
|
|
6
|
+
# maximum and minimum column widths yourself.
|
|
7
|
+
#
|
|
8
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
9
|
+
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
10
|
+
#
|
|
11
|
+
from functools import reduce
|
|
12
|
+
|
|
13
|
+
import xlsxwriter
|
|
14
|
+
from xlsxwriter.utility import cell_autofit_width
|
|
15
|
+
|
|
16
|
+
workbook = xlsxwriter.Workbook("autofit.xlsx")
|
|
17
|
+
worksheet = workbook.add_worksheet()
|
|
18
|
+
|
|
19
|
+
# Some string data to write.
|
|
20
|
+
cities = ["Addis Ababa", "Buenos Aires", "Cairo", "Dhaka"]
|
|
21
|
+
|
|
22
|
+
# Write the strings:
|
|
23
|
+
worksheet.write_column(0, 0, cities)
|
|
24
|
+
|
|
25
|
+
# Find the maximum column width in pixels.
|
|
26
|
+
max_width = reduce(max, map(cell_autofit_width, cities))
|
|
27
|
+
|
|
28
|
+
# Set the column width as if it was auto-fitted.
|
|
29
|
+
worksheet.set_column_pixels(0, 0, max_width)
|
|
30
|
+
|
|
31
|
+
workbook.close()
|
|
@@ -43,7 +43,7 @@ column_chart1.add_series(
|
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
|
|
46
|
-
# Create a new
|
|
46
|
+
# Create a new line chart. This will use this as the secondary chart.
|
|
47
47
|
line_chart1 = workbook.add_chart({"type": "line"})
|
|
48
48
|
|
|
49
49
|
# Configure the data series for the secondary chart.
|
|
@@ -25,7 +25,7 @@ for chart_type in chart_types:
|
|
|
25
25
|
for col_num in range(0, 64, 8):
|
|
26
26
|
chart = workbook.add_chart({"type": chart_type})
|
|
27
27
|
chart.add_series({"values": "=Data!$A$1:$A$6"})
|
|
28
|
-
chart.set_title({"name": "Style
|
|
28
|
+
chart.set_title({"name": f"Style {style_number}"})
|
|
29
29
|
chart.set_legend({"none": True})
|
|
30
30
|
chart.set_style(style_number)
|
|
31
31
|
|
|
@@ -20,9 +20,9 @@ while True:
|
|
|
20
20
|
workbook.close()
|
|
21
21
|
except xlsxwriter.exceptions.FileCreateError as e:
|
|
22
22
|
decision = input(
|
|
23
|
-
"Exception caught in workbook.close():
|
|
24
|
-
"Please close the file if it is open in Excel.\n"
|
|
25
|
-
"Try to write file again? [Y/n]: "
|
|
23
|
+
f"Exception caught in workbook.close(): {e}\n"
|
|
24
|
+
f"Please close the file if it is open in Excel.\n"
|
|
25
|
+
f"Try to write file again? [Y/n]: "
|
|
26
26
|
)
|
|
27
27
|
if decision != "n":
|
|
28
28
|
continue
|
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
|
+
# pylint: skip-file
|
|
10
|
+
|
|
9
11
|
import io
|
|
12
|
+
|
|
10
13
|
from django.http import HttpResponse
|
|
11
14
|
from django.views.generic import View
|
|
15
|
+
|
|
12
16
|
import xlsxwriter
|
|
13
17
|
|
|
14
18
|
|
|
@@ -49,6 +53,6 @@ class MyView(View):
|
|
|
49
53
|
output,
|
|
50
54
|
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
51
55
|
)
|
|
52
|
-
response["Content-Disposition"] = "attachment; filename
|
|
56
|
+
response["Content-Disposition"] = f"attachment; filename={filename}"
|
|
53
57
|
|
|
54
58
|
return response
|
|
@@ -26,8 +26,8 @@ def main():
|
|
|
26
26
|
worksheet9 = workbook.add_worksheet("Spill ranges")
|
|
27
27
|
worksheet10 = workbook.add_worksheet("Older functions")
|
|
28
28
|
|
|
29
|
-
header1 = workbook.add_format({"fg_color": "#74AC4C", "
|
|
30
|
-
header2 = workbook.add_format({"fg_color": "#528FD3", "
|
|
29
|
+
header1 = workbook.add_format({"fg_color": "#74AC4C", "font_color": "#FFFFFF"})
|
|
30
|
+
header2 = workbook.add_format({"fg_color": "#528FD3", "font_color": "#FFFFFF"})
|
|
31
31
|
|
|
32
32
|
#
|
|
33
33
|
# Example of using the FILTER() function.
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
##############################################################################
|
|
2
2
|
#
|
|
3
3
|
# An example of embedding images into a worksheet cells using the XlsxWriter
|
|
4
|
-
# Python module.
|
|
4
|
+
# Python module.
|
|
5
|
+
#
|
|
6
|
+
# This is the equivalent of Excel's menu option to insert an image using the
|
|
7
|
+
# option to "Place in Cell" which is only available in Excel 365 versions from
|
|
8
|
+
# 2023 onwards. For older versions of Excel a ``#VALUE!`` error is displayed.
|
|
5
9
|
#
|
|
6
10
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
7
11
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
12
|
#
|
|
9
13
|
import xlsxwriter
|
|
10
14
|
|
|
11
|
-
|
|
12
15
|
# Create an new Excel file and add a worksheet.
|
|
13
16
|
workbook = xlsxwriter.Workbook("embedded_images.xlsx")
|
|
14
17
|
worksheet = workbook.add_worksheet()
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
9
|
from xlsxwriter.workbook import Workbook
|
|
10
|
-
from xlsxwriter.worksheet import Worksheet
|
|
11
|
-
from xlsxwriter.worksheet import convert_cell_args
|
|
10
|
+
from xlsxwriter.worksheet import Worksheet, convert_cell_args
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class MyWorksheet(Worksheet):
|
|
@@ -28,7 +27,7 @@ class MyWorksheet(Worksheet):
|
|
|
28
27
|
return self.write_string(row, col, data)
|
|
29
28
|
else:
|
|
30
29
|
# Call the parent version of write() as usual for other data.
|
|
31
|
-
return super(
|
|
30
|
+
return super().write(row, col, *args)
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
class MyWorkbook(Workbook):
|
|
@@ -40,7 +39,7 @@ class MyWorkbook(Workbook):
|
|
|
40
39
|
|
|
41
40
|
def add_worksheet(self, name=None):
|
|
42
41
|
# Overwrite add_worksheet() to create a MyWorksheet object.
|
|
43
|
-
worksheet = super(
|
|
42
|
+
worksheet = super().add_worksheet(name, MyWorksheet)
|
|
44
43
|
|
|
45
44
|
return worksheet
|
|
46
45
|
|
|
@@ -15,18 +15,17 @@
|
|
|
15
15
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
16
16
|
#
|
|
17
17
|
from xlsxwriter.workbook import Workbook
|
|
18
|
-
from xlsxwriter.worksheet import Worksheet
|
|
19
|
-
from xlsxwriter.worksheet import convert_cell_args
|
|
18
|
+
from xlsxwriter.worksheet import Worksheet, convert_cell_args
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
def excel_string_width(
|
|
21
|
+
def excel_string_width(string):
|
|
23
22
|
"""
|
|
24
23
|
Calculate the length of the string in Excel character units. This is only
|
|
25
24
|
an example and won't give accurate results. It will need to be replaced
|
|
26
25
|
by something more rigorous.
|
|
27
26
|
|
|
28
27
|
"""
|
|
29
|
-
string_width = len(
|
|
28
|
+
string_width = len(string)
|
|
30
29
|
|
|
31
30
|
if string_width == 0:
|
|
32
31
|
return 0
|
|
@@ -63,7 +62,7 @@ class MyWorksheet(Worksheet):
|
|
|
63
62
|
self.max_column_widths[col] = string_width
|
|
64
63
|
|
|
65
64
|
# Now call the parent version of write_string() as usual.
|
|
66
|
-
return super(
|
|
65
|
+
return super().write_string(row, col, string, cell_format)
|
|
67
66
|
|
|
68
67
|
|
|
69
68
|
class MyWorkbook(Workbook):
|
|
@@ -76,7 +75,7 @@ class MyWorkbook(Workbook):
|
|
|
76
75
|
def add_worksheet(self, name=None):
|
|
77
76
|
# Overwrite add_worksheet() to create a MyWorksheet object.
|
|
78
77
|
# Also add an Worksheet attribute to store the column widths.
|
|
79
|
-
worksheet = super(
|
|
78
|
+
worksheet = super().add_worksheet(name, MyWorksheet)
|
|
80
79
|
worksheet.max_column_widths = {}
|
|
81
80
|
|
|
82
81
|
return worksheet
|
|
@@ -90,7 +89,7 @@ class MyWorkbook(Workbook):
|
|
|
90
89
|
for column, width in worksheet.max_column_widths.items():
|
|
91
90
|
worksheet.set_column(column, column, width)
|
|
92
91
|
|
|
93
|
-
return super(
|
|
92
|
+
return super().close()
|
|
94
93
|
|
|
95
94
|
|
|
96
95
|
# Create a new MyWorkbook object.
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
import pandas as pd
|
|
11
10
|
import random
|
|
12
11
|
|
|
12
|
+
import pandas as pd
|
|
13
|
+
|
|
13
14
|
# Create some sample data to plot.
|
|
14
15
|
categories = ["Node 1", "Node 2", "Node 3", "Node 4"]
|
|
15
16
|
index_1 = range(0, 21, 1)
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
import xlsxwriter
|
|
11
10
|
import polars as pl
|
|
12
11
|
|
|
12
|
+
import xlsxwriter
|
|
13
|
+
|
|
13
14
|
df = pl.DataFrame({"Data": [10, 20, 30, 20, 15, 30, 45]})
|
|
14
15
|
|
|
15
16
|
with xlsxwriter.Workbook("polars_chart.xlsx") as workbook:
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
import xlsxwriter
|
|
11
10
|
import polars as pl
|
|
12
11
|
|
|
12
|
+
import xlsxwriter
|
|
13
|
+
|
|
13
14
|
# Create some Polars dataframes from some data.
|
|
14
15
|
df1 = pl.DataFrame({"Data": [11, 12, 13, 14]})
|
|
15
16
|
df2 = pl.DataFrame({"Data": [21, 22, 23, 24]})
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
import xlsxwriter
|
|
11
10
|
import polars as pl
|
|
12
11
|
|
|
12
|
+
import xlsxwriter
|
|
13
|
+
|
|
13
14
|
# Create some Polars dataframes from some data.
|
|
14
15
|
df1 = pl.DataFrame({"Data": [11, 12, 13, 14]})
|
|
15
16
|
df2 = pl.DataFrame({"Data": [21, 22, 23, 24]})
|
|
@@ -28,5 +29,5 @@ with xlsxwriter.Workbook("polars_positioning.xlsx") as workbook:
|
|
|
28
29
|
|
|
29
30
|
# Write the dataframe without the header.
|
|
30
31
|
df4.write_excel(
|
|
31
|
-
workbook=workbook, worksheet="Sheet1", position="C8",
|
|
32
|
+
workbook=workbook, worksheet="Sheet1", position="C8", include_header=False
|
|
32
33
|
)
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
#
|
|
9
9
|
|
|
10
10
|
import polars as pl
|
|
11
|
-
from polars.datatypes import INTEGER_DTYPES
|
|
12
11
|
|
|
13
12
|
df = pl.DataFrame(
|
|
14
13
|
{
|
|
@@ -26,7 +25,7 @@ df.write_excel(
|
|
|
26
25
|
# Set an alternative table style.
|
|
27
26
|
table_style="Table Style Light 2",
|
|
28
27
|
# Specify an Excel number format for integer types.
|
|
29
|
-
dtype_formats={
|
|
28
|
+
dtype_formats={pl.Int32: "#,##0_);(#,##0)"},
|
|
30
29
|
# Configure sparklines to the dataframe.
|
|
31
30
|
sparklines={
|
|
32
31
|
# We use the default options with just the source columns.
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
7
7
|
#
|
|
8
8
|
|
|
9
|
-
import xlsxwriter
|
|
10
9
|
import polars as pl
|
|
11
10
|
|
|
11
|
+
import xlsxwriter
|
|
12
|
+
|
|
12
13
|
with xlsxwriter.Workbook("polars_xlsxwriter.xlsx") as workbook:
|
|
13
14
|
# Create a new worksheet.
|
|
14
15
|
worksheet = workbook.add_worksheet()
|
|
@@ -16,8 +16,8 @@ worksheet.set_column("A:A", 30)
|
|
|
16
16
|
# Set up some formats to use.
|
|
17
17
|
bold = workbook.add_format({"bold": True})
|
|
18
18
|
italic = workbook.add_format({"italic": True})
|
|
19
|
-
red = workbook.add_format({"
|
|
20
|
-
blue = workbook.add_format({"
|
|
19
|
+
red = workbook.add_format({"font_color": "red"})
|
|
20
|
+
blue = workbook.add_format({"font_color": "blue"})
|
|
21
21
|
center = workbook.add_format({"align": "center"})
|
|
22
22
|
superscript = workbook.add_format({"font_script": 1})
|
|
23
23
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
#
|
|
3
|
+
# An example of adding a Sensitivity Label to an XlsxWriter file.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
6
|
+
# Copyright 2013-2024, John McNamara, jmcnamara@cpan.org
|
|
7
|
+
#
|
|
8
|
+
import xlsxwriter
|
|
9
|
+
|
|
10
|
+
workbook = xlsxwriter.Workbook("sensitivity_label.xlsx")
|
|
11
|
+
worksheet = workbook.add_worksheet()
|
|
12
|
+
|
|
13
|
+
# Metadata extracted from a company specific file.
|
|
14
|
+
company_guid = "2096f6a2-d2f7-48be-b329-b73aaa526e5d"
|
|
15
|
+
site_id = "cb46c030-1825-4e81-a295-151c039dbf02"
|
|
16
|
+
action_id = "88124cf5-1340-457d-90e1-0000a9427c99"
|
|
17
|
+
|
|
18
|
+
# Add the document properties. Note that these should all be in text format.
|
|
19
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_Enabled", "true", "text")
|
|
20
|
+
workbook.set_custom_property(
|
|
21
|
+
f"MSIP_Label_{company_guid}_SetDate", "2024-01-01T12:00:00Z", "text"
|
|
22
|
+
)
|
|
23
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_Method", "Privileged", "text")
|
|
24
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_Name", "Confidential", "text")
|
|
25
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_SiteId", site_id, "text")
|
|
26
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_ActionId", action_id, "text")
|
|
27
|
+
workbook.set_custom_property(f"MSIP_Label_{company_guid}_ContentBits", "2", "text")
|
|
28
|
+
|
|
29
|
+
workbook.close()
|