XlsxWriter 3.3.4__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.4 → xlsxwriter-3.3.5}/Changes +19 -0
- {xlsxwriter-3.3.4/xlsxwriter.egg-info → xlsxwriter-3.3.5}/PKG-INFO +1 -1
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/pyproject.toml +1 -1
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/__init__.py +1 -1
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart.py +3 -2
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/shape.py +10 -2
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/sharedstrings.py +35 -5
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/worksheet.py +196 -122
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5/xlsxwriter.egg-info}/PKG-INFO +1 -1
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/LICENSE.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/MANIFEST.in +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/README.rst +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/array_formula.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/autofilter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/autofilter_data.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/autofit.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/autofit_manually.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/background.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/cell_indentation.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_area.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_bar.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_clustered.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_column.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_combined.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_data_labels.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_data_table.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_data_tools.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_date_axis.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_doughnut.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_gauge.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_gradient.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_line.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_pareto.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_pattern.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_pie.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_radar.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_scatter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_secondary_axis.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_stock.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chart_styles.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/chartsheet.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/check_close.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/checkbox.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/colors.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/comments1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/comments2.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/conditional_format.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/context_manager.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/custom_ui.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/data_validate.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/datetimes.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/defined_name.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/demo.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/diagonal_border.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/django_simple.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/doc_properties.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/dynamic_arrays.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/embedded_images.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/headers_footers.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/hello_world.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/hide_row_col.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/hide_sheet.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/http_server.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/hyperlink.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/ignore_errors.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/images.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/images_bytesio.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/inheritance1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/inheritance2.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/lambda.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/macros.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/merge1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/merge_rich_string.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/outline.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/outline_collapsed.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_autofilter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_chart.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_chart_columns.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_chart_line.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_column_formats.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_conditional_format.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_datetime.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_header_format.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_multiple.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_percentage.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_positioning.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_simple.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pandas_table.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/panes.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/pivot_table.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_chart.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_checkbox.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_conditional_format.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_format_custom.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_format_default.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_multiple.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_positioning.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_simple.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_sparklines.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/polars_xlsxwriter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/rich_strings.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/right_to_left.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/sensitivity_label.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/sparklines1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/sparklines2.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/tab_colors.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/tables.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/text_indent.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/textbox.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/theme_custom.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/theme_excel_2023.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/tutorial1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/tutorial2.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/tutorial3.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/unicode.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/unicode_polish_utf8.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/unicode_polish_utf8.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/unicode_shift_jis.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/unicode_shift_jis.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/user_types1.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/user_types2.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/user_types3.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/vbaProject.bin +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/vbaProject_custom_ui.bin +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/vba_extract.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/watermark.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/examples/worksheet_protection.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/setup.cfg +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/app.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_area.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_bar.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_column.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_doughnut.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_line.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_pie.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_radar.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_scatter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_stock.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chart_title.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/chartsheet.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/color.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/comments.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/contenttypes.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/core.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/custom.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/drawing.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/exceptions.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/feature_property_bag.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/format.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/image.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/metadata.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/packager.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/pivot_cache.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/pivot_table.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/relationships.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/rich_value.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_rel.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_structure.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/rich_value_types.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/styles.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/table.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/theme.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/url.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/utility.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/vml.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/workbook.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter/xmlwriter.py +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/SOURCES.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/dependency_links.txt +0 -0
- {xlsxwriter-3.3.4 → xlsxwriter-3.3.5}/xlsxwriter.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,22 @@
|
|
|
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
|
+
|
|
1
20
|
|
|
2
21
|
Release 3.3.4 - November 22 2026
|
|
3
22
|
--------------------------------
|
|
@@ -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"]:
|
|
@@ -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 = {}
|
|
@@ -636,7 +636,7 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
636
636
|
|
|
637
637
|
self.validations = []
|
|
638
638
|
self.cond_formats = {}
|
|
639
|
-
self.
|
|
639
|
+
self.x14_cond_formats = {}
|
|
640
640
|
self.use_data_bars_2010 = False
|
|
641
641
|
self.dxf_priority = 1
|
|
642
642
|
self.page_view = 0
|
|
@@ -1571,7 +1571,7 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
1571
1571
|
|
|
1572
1572
|
# Write a shared string or an in-line string in constant_memory mode.
|
|
1573
1573
|
if not self.constant_memory:
|
|
1574
|
-
string_index = self.str_table.
|
|
1574
|
+
string_index = self.str_table._get_rich_string_index(string)
|
|
1575
1575
|
else:
|
|
1576
1576
|
string_index = string
|
|
1577
1577
|
|
|
@@ -2200,97 +2200,100 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
2200
2200
|
|
|
2201
2201
|
# Create a reverse lookup for the share strings table so we can convert
|
|
2202
2202
|
# the string id back to the original string.
|
|
2203
|
-
strings =
|
|
2204
|
-
|
|
2205
|
-
|
|
2203
|
+
strings = {
|
|
2204
|
+
index: string for string, index in self.str_table.string_table.items()
|
|
2205
|
+
}
|
|
2206
2206
|
|
|
2207
|
-
|
|
2208
|
-
|
|
2207
|
+
# Iterate over the stored cells only, since the worksheet data can be
|
|
2208
|
+
# sparse, and ignore any outside the worksheet dimensions.
|
|
2209
|
+
for row_num, row_data in self.table.items():
|
|
2210
|
+
if not self.dim_rowmin <= row_num <= self.dim_rowmax:
|
|
2209
2211
|
continue
|
|
2210
2212
|
|
|
2211
|
-
for col_num in
|
|
2212
|
-
if col_num
|
|
2213
|
-
|
|
2214
|
-
cell_type = cell.__class__.__name__
|
|
2215
|
-
length = 0
|
|
2216
|
-
|
|
2217
|
-
if cell_type in ("String", "RichString"):
|
|
2218
|
-
# Handle strings and rich strings.
|
|
2219
|
-
#
|
|
2220
|
-
# For standard shared strings we do a reverse lookup
|
|
2221
|
-
# from the shared string id to the actual string. For
|
|
2222
|
-
# rich strings we use the unformatted string. We also
|
|
2223
|
-
# split multi-line strings and handle each part
|
|
2224
|
-
# separately.
|
|
2225
|
-
if cell_type == "String":
|
|
2226
|
-
string_id = cell.string
|
|
2227
|
-
string = strings[string_id]
|
|
2228
|
-
else:
|
|
2229
|
-
string = cell.raw_string
|
|
2213
|
+
for col_num, cell in row_data.items():
|
|
2214
|
+
if not self.dim_colmin <= col_num <= self.dim_colmax:
|
|
2215
|
+
continue
|
|
2230
2216
|
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
#
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2217
|
+
cell_type = cell.__class__.__name__
|
|
2218
|
+
length = 0
|
|
2219
|
+
|
|
2220
|
+
if cell_type in ("String", "RichString"):
|
|
2221
|
+
# Handle strings and rich strings.
|
|
2222
|
+
#
|
|
2223
|
+
# For standard shared strings we do a reverse lookup
|
|
2224
|
+
# from the shared string id to the actual string. For
|
|
2225
|
+
# rich strings we use the unformatted string. We also
|
|
2226
|
+
# split multi-line strings and handle each part
|
|
2227
|
+
# separately.
|
|
2228
|
+
if cell_type == "String":
|
|
2229
|
+
string_id = cell.string
|
|
2230
|
+
string = strings[string_id]
|
|
2231
|
+
else:
|
|
2232
|
+
string = cell.raw_string
|
|
2233
|
+
|
|
2234
|
+
if "\n" not in string:
|
|
2235
|
+
# Single line string.
|
|
2236
|
+
length = xl_pixel_width(string)
|
|
2237
|
+
else:
|
|
2238
|
+
# Handle multi-line strings.
|
|
2239
|
+
for segment in string.split("\n"):
|
|
2240
|
+
seg_length = xl_pixel_width(segment)
|
|
2241
|
+
length = max(length, seg_length)
|
|
2242
|
+
|
|
2243
|
+
elif cell_type == "Number":
|
|
2244
|
+
# Handle numbers.
|
|
2245
|
+
#
|
|
2246
|
+
# We use a workaround/optimization for numbers since
|
|
2247
|
+
# digits all have a pixel width of 7. This gives a
|
|
2248
|
+
# slightly greater width for the decimal place and
|
|
2249
|
+
# minus sign but only by a few pixels and
|
|
2250
|
+
# over-estimation is okay.
|
|
2251
|
+
length = 7 * len(str(cell.number))
|
|
2252
|
+
|
|
2253
|
+
elif cell_type == "Datetime":
|
|
2254
|
+
# Handle dates.
|
|
2255
|
+
#
|
|
2256
|
+
# The following uses the default width for mm/dd/yyyy
|
|
2257
|
+
# dates. It isn't feasible to parse the number format
|
|
2258
|
+
# to get the actual string width for all format types.
|
|
2259
|
+
length = self.default_date_width
|
|
2260
|
+
|
|
2261
|
+
elif cell_type == "Boolean":
|
|
2262
|
+
# Handle boolean values.
|
|
2263
|
+
#
|
|
2264
|
+
# Use the Excel standard widths for TRUE and FALSE.
|
|
2265
|
+
if cell.boolean:
|
|
2266
|
+
length = 31
|
|
2267
|
+
else:
|
|
2268
|
+
length = 36
|
|
2269
|
+
|
|
2270
|
+
elif cell_type in ("Formula", "ArrayFormula"):
|
|
2271
|
+
# Handle formulas.
|
|
2272
|
+
#
|
|
2273
|
+
# We only try to autofit a formula if it has a
|
|
2274
|
+
# non-zero value.
|
|
2275
|
+
if isinstance(cell.value, (float, int)):
|
|
2276
|
+
if cell.value > 0:
|
|
2277
|
+
length = 7 * len(str(cell.value))
|
|
2278
|
+
|
|
2279
|
+
elif isinstance(cell.value, str):
|
|
2280
|
+
length = xl_pixel_width(cell.value)
|
|
2281
|
+
|
|
2282
|
+
elif isinstance(cell.value, bool):
|
|
2283
|
+
if cell.value:
|
|
2263
2284
|
length = 31
|
|
2264
2285
|
else:
|
|
2265
2286
|
length = 36
|
|
2266
2287
|
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
elif isinstance(cell.value, str):
|
|
2277
|
-
length = xl_pixel_width(cell.value)
|
|
2278
|
-
|
|
2279
|
-
elif isinstance(cell.value, bool):
|
|
2280
|
-
if cell.value:
|
|
2281
|
-
length = 31
|
|
2282
|
-
else:
|
|
2283
|
-
length = 36
|
|
2284
|
-
|
|
2285
|
-
# If the cell is in an autofilter header we add an
|
|
2286
|
-
# additional 16 pixels for the dropdown arrow.
|
|
2287
|
-
if self.filter_cells.get((row_num, col_num)) and length > 0:
|
|
2288
|
-
length += 16
|
|
2289
|
-
|
|
2290
|
-
# Add the string length to the lookup table.
|
|
2291
|
-
width_max = col_width_max.get(col_num, 0)
|
|
2292
|
-
if length > width_max:
|
|
2293
|
-
col_width_max[col_num] = length
|
|
2288
|
+
# If the cell is in an autofilter header we add an
|
|
2289
|
+
# additional 16 pixels for the dropdown arrow.
|
|
2290
|
+
if self.filter_cells.get((row_num, col_num)) and length > 0:
|
|
2291
|
+
length += 16
|
|
2292
|
+
|
|
2293
|
+
# Add the string length to the lookup table.
|
|
2294
|
+
width_max = col_width_max.get(col_num, 0)
|
|
2295
|
+
if length > width_max:
|
|
2296
|
+
col_width_max[col_num] = length
|
|
2294
2297
|
|
|
2295
2298
|
# Apply the width to the column.
|
|
2296
2299
|
for col_num, width in col_width_max.items():
|
|
@@ -3173,8 +3176,11 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
3173
3176
|
"4_arrows_gray": "4ArrowsGray", # 14
|
|
3174
3177
|
"4_ratings": "4Rating", # 15
|
|
3175
3178
|
"5_arrows": "5Arrows", # 16
|
|
3176
|
-
"5_ratings": "5Rating",
|
|
3177
|
-
|
|
3179
|
+
"5_ratings": "5Rating", # 17
|
|
3180
|
+
"3_stars": "3Stars", # 18
|
|
3181
|
+
"3_triangles": "3Triangles", # 19
|
|
3182
|
+
"5_boxes": "5Boxes", # 20
|
|
3183
|
+
}
|
|
3178
3184
|
|
|
3179
3185
|
# Set the icon set properties.
|
|
3180
3186
|
if options["type"] == "iconSet":
|
|
@@ -3196,6 +3202,11 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
3196
3202
|
|
|
3197
3203
|
options["icon_style"] = valid_icons[options["icon_style"]]
|
|
3198
3204
|
|
|
3205
|
+
# Excel 2010 icon sets are only written in the extLst element.
|
|
3206
|
+
if options["icon_style"] in ("3Stars", "3Triangles", "5Boxes"):
|
|
3207
|
+
options["is_x14_icon_set"] = True
|
|
3208
|
+
self.excel_version = 2010
|
|
3209
|
+
|
|
3199
3210
|
# Set the number of icons for the icon style.
|
|
3200
3211
|
options["total_icons"] = 3
|
|
3201
3212
|
if options["icon_style"].startswith("4"):
|
|
@@ -3451,8 +3462,6 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
3451
3462
|
if options["max_type"] == "max" and options["max_value"] == 0:
|
|
3452
3463
|
options["max_value"] = None
|
|
3453
3464
|
|
|
3454
|
-
options["range"] = cell_range
|
|
3455
|
-
|
|
3456
3465
|
# Strip the leading = from formulas.
|
|
3457
3466
|
try:
|
|
3458
3467
|
options["min_value"] = options["min_value"].lstrip("=")
|
|
@@ -4974,6 +4983,7 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
4974
4983
|
|
|
4975
4984
|
"""
|
|
4976
4985
|
self.page_start = start_page
|
|
4986
|
+
self.page_setup_changed = True
|
|
4977
4987
|
|
|
4978
4988
|
def set_print_scale(self, scale: int) -> None:
|
|
4979
4989
|
"""
|
|
@@ -7146,7 +7156,7 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
7146
7156
|
string = self._escape_control_characters(string)
|
|
7147
7157
|
|
|
7148
7158
|
# Write any rich strings without further tags.
|
|
7149
|
-
if
|
|
7159
|
+
if type_cell_name == "RichString":
|
|
7150
7160
|
self._xml_rich_inline_string(string, attributes)
|
|
7151
7161
|
else:
|
|
7152
7162
|
# Add attribute to preserve leading or trailing whitespace.
|
|
@@ -7838,11 +7848,38 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
7838
7848
|
def _write_conditional_formats(self) -> None:
|
|
7839
7849
|
# Write the Worksheet conditional formats, in the order that the ranges
|
|
7840
7850
|
# were added in.
|
|
7851
|
+
guid_index = 1
|
|
7852
|
+
|
|
7841
7853
|
for cond_range, params in self.cond_formats.items():
|
|
7854
|
+
# Store the Excel 2010 rules, with a pseudo GUID, to write in the
|
|
7855
|
+
# extLst element.
|
|
7856
|
+
x14_params = [
|
|
7857
|
+
param
|
|
7858
|
+
for param in params
|
|
7859
|
+
if (param["type"] == "dataBar" and param.get("is_data_bar_2010"))
|
|
7860
|
+
or param.get("is_x14_icon_set")
|
|
7861
|
+
]
|
|
7862
|
+
|
|
7863
|
+
for param in x14_params:
|
|
7864
|
+
worksheet_count = self.index + 1
|
|
7865
|
+
param["guid"] = (
|
|
7866
|
+
f"{{DA7ABA51-AAAA-BBBB-{worksheet_count:04X}-{guid_index:012X}}}"
|
|
7867
|
+
)
|
|
7868
|
+
guid_index += 1
|
|
7869
|
+
|
|
7870
|
+
if x14_params:
|
|
7871
|
+
self.x14_cond_formats[cond_range] = x14_params
|
|
7872
|
+
|
|
7842
7873
|
self._write_conditional_formatting(cond_range, params)
|
|
7843
7874
|
|
|
7844
7875
|
def _write_conditional_formatting(self, cond_range, params) -> None:
|
|
7845
7876
|
# Write the <conditionalFormatting> element.
|
|
7877
|
+
|
|
7878
|
+
# Excel 2010 icon sets are only written in the extLst element.
|
|
7879
|
+
params = [param for param in params if not param.get("is_x14_icon_set")]
|
|
7880
|
+
if not params:
|
|
7881
|
+
return
|
|
7882
|
+
|
|
7846
7883
|
attributes = [("sqref", cond_range)]
|
|
7847
7884
|
self._xml_start_tag("conditionalFormatting", attributes)
|
|
7848
7885
|
for param in params:
|
|
@@ -7859,7 +7896,12 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
7859
7896
|
|
|
7860
7897
|
attributes.append(("priority", params["priority"]))
|
|
7861
7898
|
|
|
7862
|
-
if
|
|
7899
|
+
# Excel doesn't support "Stop if True" for these types.
|
|
7900
|
+
if params.get("stop_if_true") and params["type"] not in (
|
|
7901
|
+
"dataBar",
|
|
7902
|
+
"colorScale",
|
|
7903
|
+
"iconSet",
|
|
7904
|
+
):
|
|
7863
7905
|
attributes.append(("stopIfTrue", 1))
|
|
7864
7906
|
|
|
7865
7907
|
if params["type"] == "cellIs":
|
|
@@ -8013,19 +8055,9 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
8013
8055
|
|
|
8014
8056
|
def _write_data_bar_ext(self, param) -> None:
|
|
8015
8057
|
# Write the <extLst> dataBar extension element.
|
|
8016
|
-
|
|
8017
|
-
# Create a pseudo GUID for each unique Excel 2010 data bar.
|
|
8018
|
-
worksheet_count = self.index + 1
|
|
8019
|
-
data_bar_count = len(self.data_bars_2010) + 1
|
|
8020
|
-
guid = f"{{DA7ABA51-AAAA-BBBB-{worksheet_count:04X}-{data_bar_count:012X}}}"
|
|
8021
|
-
|
|
8022
|
-
# Store the 2010 data bar parameters to write the extLst elements.
|
|
8023
|
-
param["guid"] = guid
|
|
8024
|
-
self.data_bars_2010.append(param)
|
|
8025
|
-
|
|
8026
8058
|
self._xml_start_tag("extLst")
|
|
8027
8059
|
self._write_ext("{B025F937-C7B1-47D3-B67F-A62EFF666E3E}")
|
|
8028
|
-
self._xml_data_element("x14:id", guid)
|
|
8060
|
+
self._xml_data_element("x14:id", param["guid"])
|
|
8029
8061
|
self._xml_end_tag("ext")
|
|
8030
8062
|
self._xml_end_tag("extLst")
|
|
8031
8063
|
|
|
@@ -8291,39 +8323,40 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
8291
8323
|
self._xml_empty_tag("tablePart", attributes)
|
|
8292
8324
|
|
|
8293
8325
|
def _write_ext_list(self) -> None:
|
|
8294
|
-
# Write the <extLst> element for
|
|
8295
|
-
|
|
8326
|
+
# Write the <extLst> element for Excel 2010 conditional formats and
|
|
8327
|
+
# sparklines.
|
|
8328
|
+
has_x14_cond_formats = len(self.x14_cond_formats)
|
|
8296
8329
|
has_sparklines = len(self.sparklines)
|
|
8297
8330
|
|
|
8298
|
-
if not
|
|
8331
|
+
if not has_x14_cond_formats and not has_sparklines:
|
|
8299
8332
|
return
|
|
8300
8333
|
|
|
8301
8334
|
# Write the extLst element.
|
|
8302
8335
|
self._xml_start_tag("extLst")
|
|
8303
8336
|
|
|
8304
|
-
if
|
|
8305
|
-
self.
|
|
8337
|
+
if has_x14_cond_formats:
|
|
8338
|
+
self._write_ext_list_cond_formats()
|
|
8306
8339
|
|
|
8307
8340
|
if has_sparklines:
|
|
8308
8341
|
self._write_ext_list_sparklines()
|
|
8309
8342
|
|
|
8310
8343
|
self._xml_end_tag("extLst")
|
|
8311
8344
|
|
|
8312
|
-
def
|
|
8313
|
-
# Write the Excel 2010
|
|
8345
|
+
def _write_ext_list_cond_formats(self) -> None:
|
|
8346
|
+
# Write the Excel 2010 conditional format subelements.
|
|
8314
8347
|
self._write_ext("{78C0D931-6437-407d-A8EE-F0AAD7539E65}")
|
|
8315
8348
|
|
|
8316
8349
|
self._xml_start_tag("x14:conditionalFormattings")
|
|
8317
8350
|
|
|
8318
|
-
# Write the Excel 2010 conditional formatting
|
|
8319
|
-
for
|
|
8351
|
+
# Write the Excel 2010 conditional formatting elements for each range.
|
|
8352
|
+
for cond_range, params in self.x14_cond_formats.items():
|
|
8320
8353
|
# Write the x14:conditionalFormatting element.
|
|
8321
|
-
self._write_conditional_formatting_2010(
|
|
8354
|
+
self._write_conditional_formatting_2010(cond_range, params)
|
|
8322
8355
|
|
|
8323
8356
|
self._xml_end_tag("x14:conditionalFormattings")
|
|
8324
8357
|
self._xml_end_tag("ext")
|
|
8325
8358
|
|
|
8326
|
-
def _write_conditional_formatting_2010(self,
|
|
8359
|
+
def _write_conditional_formatting_2010(self, cond_range, params) -> None:
|
|
8327
8360
|
# Write the <x14:conditionalFormatting> element.
|
|
8328
8361
|
xmlns_xm = "http://schemas.microsoft.com/office/excel/2006/main"
|
|
8329
8362
|
|
|
@@ -8331,7 +8364,19 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
8331
8364
|
|
|
8332
8365
|
self._xml_start_tag("x14:conditionalFormatting", attributes)
|
|
8333
8366
|
|
|
8334
|
-
|
|
8367
|
+
for param in params:
|
|
8368
|
+
if param["type"] == "dataBar":
|
|
8369
|
+
self._write_x14_data_bar_rule(param)
|
|
8370
|
+
else:
|
|
8371
|
+
self._write_x14_icon_set_rule(param)
|
|
8372
|
+
|
|
8373
|
+
# Write the xm:sqref element.
|
|
8374
|
+
self._xml_data_element("xm:sqref", cond_range)
|
|
8375
|
+
|
|
8376
|
+
self._xml_end_tag("x14:conditionalFormatting")
|
|
8377
|
+
|
|
8378
|
+
def _write_x14_data_bar_rule(self, data_bar) -> None:
|
|
8379
|
+
# Write the Excel 2010 data bar <x14:cfRule> element.
|
|
8335
8380
|
self._write_x14_cf_rule(data_bar)
|
|
8336
8381
|
|
|
8337
8382
|
# Write the x14:dataBar element.
|
|
@@ -8363,19 +8408,45 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
8363
8408
|
self._xml_end_tag("x14:dataBar")
|
|
8364
8409
|
self._xml_end_tag("x14:cfRule")
|
|
8365
8410
|
|
|
8366
|
-
|
|
8367
|
-
|
|
8411
|
+
def _write_x14_icon_set_rule(self, param) -> None:
|
|
8412
|
+
# Write the Excel 2010 icon set <x14:cfRule> element.
|
|
8413
|
+
self._write_x14_cf_rule(param)
|
|
8368
8414
|
|
|
8369
|
-
|
|
8415
|
+
# Write the x14:iconSet element.
|
|
8416
|
+
self._write_x14_icon_set(param)
|
|
8370
8417
|
|
|
8371
|
-
|
|
8418
|
+
self._xml_end_tag("x14:cfRule")
|
|
8419
|
+
|
|
8420
|
+
def _write_x14_cf_rule(self, param) -> None:
|
|
8372
8421
|
# Write the <x14:cfRule> element.
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8422
|
+
attributes = [("type", param["type"])]
|
|
8423
|
+
|
|
8424
|
+
# Excel doesn't write a priority for data bars.
|
|
8425
|
+
if param["type"] != "dataBar":
|
|
8426
|
+
attributes.append(("priority", param["priority"]))
|
|
8427
|
+
|
|
8428
|
+
attributes.append(("id", param["guid"]))
|
|
8376
8429
|
|
|
8377
8430
|
self._xml_start_tag("x14:cfRule", attributes)
|
|
8378
8431
|
|
|
8432
|
+
def _write_x14_icon_set(self, param) -> None:
|
|
8433
|
+
# Write the <x14:iconSet> element.
|
|
8434
|
+
attributes = [("iconSet", param["icon_style"])]
|
|
8435
|
+
|
|
8436
|
+
if param.get("icons_only"):
|
|
8437
|
+
attributes.append(("showValue", 0))
|
|
8438
|
+
|
|
8439
|
+
if param.get("reverse_icons"):
|
|
8440
|
+
attributes.append(("reverse", 1))
|
|
8441
|
+
|
|
8442
|
+
self._xml_start_tag("x14:iconSet", attributes)
|
|
8443
|
+
|
|
8444
|
+
# Write the properties for different icon styles.
|
|
8445
|
+
for icon in reversed(param["icons"]):
|
|
8446
|
+
self._write_x14_cfvo(icon["type"], icon["value"], icon["criteria"])
|
|
8447
|
+
|
|
8448
|
+
self._xml_end_tag("x14:iconSet")
|
|
8449
|
+
|
|
8379
8450
|
def _write_x14_data_bar(self, data_bar) -> None:
|
|
8380
8451
|
# Write the <x14:dataBar> element.
|
|
8381
8452
|
min_length = 0
|
|
@@ -8415,10 +8486,13 @@ class Worksheet(xmlwriter.XMLwriter):
|
|
|
8415
8486
|
|
|
8416
8487
|
self._xml_start_tag("x14:dataBar", attributes)
|
|
8417
8488
|
|
|
8418
|
-
def _write_x14_cfvo(self, rule_type, value) -> None:
|
|
8489
|
+
def _write_x14_cfvo(self, rule_type, value, criteria=None) -> None:
|
|
8419
8490
|
# Write the <x14:cfvo> element.
|
|
8420
8491
|
attributes = [("type", rule_type)]
|
|
8421
8492
|
|
|
8493
|
+
if criteria:
|
|
8494
|
+
attributes.append(("gte", 0))
|
|
8495
|
+
|
|
8422
8496
|
if rule_type in ("min", "max", "autoMin", "autoMax"):
|
|
8423
8497
|
self._xml_empty_tag("x14:cfvo", attributes)
|
|
8424
8498
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|