Anpassung der Spaltenbreiten in Excel Ausgabe auf Inhalt
This commit is contained in:
@@ -283,6 +283,11 @@ def write_excel_from_json(plines:Polylines, outpath:str):
|
||||
ws1.title = "Length by ID"
|
||||
ws1.append(["Cable-ID", "True Length (m)", "Cable-ArtNr", "Cable-Name (short)"])
|
||||
|
||||
ws1.column_dimensions['A'].width = 18
|
||||
ws1.column_dimensions['B'].width = 15
|
||||
ws1.column_dimensions['C'].width = 15
|
||||
ws1.column_dimensions['D'].width = 25
|
||||
|
||||
for pl in plines.kabel:
|
||||
length = pl.length /1000 # Umrechnung von mm in m
|
||||
for artnr in sens2cable[pl.id]:
|
||||
@@ -301,6 +306,10 @@ def write_excel_from_json(plines:Polylines, outpath:str):
|
||||
ws2 = wb.create_sheet("Cables SIVAS")
|
||||
ws2.append(["Cable-ArtNr", "Amount (pcs)", "Cumm. Length (m)"])
|
||||
|
||||
ws2.column_dimensions['A'].width = 20
|
||||
ws2.column_dimensions['B'].width = 12
|
||||
ws2.column_dimensions['C'].width = 15
|
||||
|
||||
all_artnrs = set(count_summary.keys()) | set(length_summary.keys())
|
||||
|
||||
for artnr in sorted(all_artnrs):
|
||||
@@ -315,6 +324,9 @@ def write_excel_from_json(plines:Polylines, outpath:str):
|
||||
# Worksheet 3 - Nicht an Racks gekoppeltes Equipment
|
||||
ws3 = wb.create_sheet("ERR-Equipment-Connection")
|
||||
ws3.append(["Type", "ID", "x", "y"])
|
||||
|
||||
ws3.column_dimensions['A'].width = 20
|
||||
|
||||
# nicht angebundene Sensoren
|
||||
for error in plines.errors_sensors:
|
||||
ws3.append(["Sensor / Actuator", error.name, error.coords.x, error.coords.y])
|
||||
@@ -328,6 +340,8 @@ def write_excel_from_json(plines:Polylines, outpath:str):
|
||||
ws4 = wb.create_sheet("ERR-Routing")
|
||||
ws4.append(["Subdistributor", "Sensor / Actuator", "Details"])
|
||||
|
||||
ws4.column_dimensions['C'].width = 35
|
||||
|
||||
nicht_angebunden = set(e.name for e in plines.errors_sensors + plines.errors_dists)
|
||||
|
||||
for routing_error in plines.errors_routing:
|
||||
@@ -357,6 +371,7 @@ def write_excel_from_json(plines:Polylines, outpath:str):
|
||||
# Worksheet 5 - Fehlende Attribute -> kein Routing
|
||||
ws5 = wb.create_sheet("ERR-Attributes")
|
||||
ws5.append(["ID", "Error Detail"])
|
||||
ws5.column_dimensions['B'].width = 35
|
||||
|
||||
for sname, err_msg in plines.errors_missing_attributes.items():
|
||||
ws5.append([sname, err_msg])
|
||||
|
||||
Reference in New Issue
Block a user