| 538 | |
| 539 | class 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"]) |