diff options
author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
---|---|---|
committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py | |
parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
download | gn-ai-master.tar.gz |
Diffstat (limited to '.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py')
-rw-r--r-- | .venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py b/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py new file mode 100644 index 00000000..33e0f021 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/xlsxwriter/rich_value_structure.py @@ -0,0 +1,99 @@ +############################################################################### +# +# RichValueStructure - A class for writing the Excel XLSX rdrichvaluestructure.xml file. +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class RichValueStructure(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX rdrichvaluestructure.xml file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super().__init__() + self.has_embedded_descriptions = False + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the rvStructures element. + self._write_rv_structures() + + self._xml_end_tag("rvStructures") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + def _write_rv_structures(self): + # Write the <rvStructures> element. + xmlns = "http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" + count = "1" + + attributes = [ + ("xmlns", xmlns), + ("count", count), + ] + + self._xml_start_tag("rvStructures", attributes) + + # Write the s element. + self._write_s() + + def _write_s(self): + # Write the <s> element. + t = "_localImage" + attributes = [("t", t)] + + self._xml_start_tag("s", attributes) + + # Write the k elements. + self._write_k("_rvRel:LocalImageIdentifier", "i") + self._write_k("CalcOrigin", "i") + + if self.has_embedded_descriptions: + self._write_k("Text", "s") + + self._xml_end_tag("s") + + def _write_k(self, name, k_type): + # Write the <k> element. + attributes = [ + ("n", name), + ("t", k_type), + ] + + self._xml_empty_tag("k", attributes) |