diff --git a/src/caosadvancedtools/table_json_conversion/export_import_xlsx.py b/src/caosadvancedtools/table_json_conversion/export_import_xlsx.py index 8730d9862857ab77e319ec4369806176f583287e..0fe5d9d877bcb074b6e03d9fbe03766ede81a508 100644 --- a/src/caosadvancedtools/table_json_conversion/export_import_xlsx.py +++ b/src/caosadvancedtools/table_json_conversion/export_import_xlsx.py @@ -92,8 +92,6 @@ def _generate_jsondata_from_records(records: Container, The given records data in json form. """ json_data = {} - # Ignore warning from high_level_api to avoid raising warnings that cannot - # be avoided by user for record in records: # Convert records to high level api objects record_obj = convert_to_python_object(record) @@ -196,8 +194,10 @@ def export_container_to_xlsx(records: Container, # Retrieve data new_records = [] for entity_id in entity_ids: - entity_id = str(entity_id).split('@')[0] + entity_id = str(entity_id).split('@')[0] # Queries cannot handle version entity = execute_query(f"FIND ENTITY WITH (ID = {entity_id})", unique=True) + # We can currently only handle Entities with a parent, as otherwise we + # do not know which sheet they belong in. if len(entity.get_parents()) > 0: new_records.append(entity) # ToDo: Handle Files and other Entities (e.g. Properties) separately @@ -212,7 +212,9 @@ def export_container_to_xlsx(records: Container, json_schema = _generate_jsonschema_from_recordtypes(recordtypes, jsonschema_filepath) json_data = _generate_jsondata_from_records(records, jsondata_filepath) - # Generate xlsx template with tempfile if necessary + # Generate xlsx template + # _generate_xlsx_template_file needs a file name, so use NamedTemporaryFile + # ToDo: This might not work on windows, if not, fix _generate file handling if xlsx_template_filepath is None: xlsx_template_file = tempfile.NamedTemporaryFile(suffix='.xlsx') xlsx_template_filepath = xlsx_template_file.name