MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / Ifc5DXlsxWriter

Class Ifc5DXlsxWriter

src/ifc5d/ifc5d/ifc5Dspreadsheet.py:539–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537
538
539class Ifc5DXlsxWriter(Ifc5Dwriter):
540 def write(self) -> None:
541 import xlsxwriter
542
543 super().write()
544 os.makedirs(self.output, exist_ok=True)
545 file_name = ""
546 for cost_schedule in self.cost_schedules:
547 if file_name:
548 file_name += "_" + cost_schedule.Name or ""
549 else:
550 file_name += cost_schedule.Name or ""
551 self.file_path = os.path.join(self.output, "{}.xlsx".format(file_name))
552 self.workbook = xlsxwriter.Workbook(self.file_path)
553 for cost_schedule in self.cost_schedules:
554 self.write_table(cost_schedule)
555 self.workbook.close()
556
557 def write_table(self, cost_schedule):
558 worksheet = self.workbook.add_worksheet(self.sheet_data[cost_schedule.id()]["Name"])
559 headers = self.sheet_data[cost_schedule.id()]["headers"]
560 for i, header in enumerate(headers):
561 worksheet.write(0, i, header)
562
563 row = 1
564 for cost_item_data in self.sheet_data[cost_schedule.id()]["cost_items"]:
565 col = 0
566 for header in headers:
567 worksheet.write(row, col, cost_item_data.get(header, ""))
568 col += 1
569 row += 1
570
571
572class Ifc5DPdfWriter(Ifc5Dwriter):

Callers 2

export_cost_schedulesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected