From 4a52a71956a8d46fcb7294ac71734504bb09bcc2 Mon Sep 17 00:00:00 2001 From: S. Solomon Darnell Date: Fri, 28 Mar 2025 21:52:21 -0500 Subject: two version of R2R are here --- .../site-packages/xlsxwriter/rich_value_rel.py | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .venv/lib/python3.12/site-packages/xlsxwriter/rich_value_rel.py (limited to '.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_rel.py') diff --git a/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_rel.py b/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_rel.py new file mode 100644 index 00000000..c8d85932 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_rel.py @@ -0,0 +1,82 @@ +############################################################################### +# +# RichValueRel - A class for writing the Excel XLSX richValueRel.xml file. +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class RichValueRel(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX richValueRel.xml file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super().__init__() + self.num_embedded_images = 0 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the richValueRels element. + self._write_rich_value_rels() + + self._xml_end_tag("richValueRels") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + def _write_rich_value_rels(self): + # Write the element. + xmlns = "http://schemas.microsoft.com/office/spreadsheetml/2022/richvaluerel" + xmlns_r = "http://schemas.openxmlformats.org/officeDocument/2006/relationships" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:r", xmlns_r), + ] + + self._xml_start_tag("richValueRels", attributes) + + # Write the rel elements. + for index in range(self.num_embedded_images): + self._write_rel(index + 1) + + def _write_rel(self, index): + # Write the element. + r_id = f"rId{index}" + attributes = [("r:id", r_id)] + + self._xml_empty_tag("rel", attributes) -- cgit v1.2.3