Enable XlsxWriter Worksheet object to be opened, operated on, and then automatically closed within a `with` statement. A filename or stream object (such as an `io.BytesIO` instance) is expected as *xlsx_file*.
(self, xlsx_file)
| 25 | |
| 26 | @contextmanager |
| 27 | def _open_worksheet(self, xlsx_file): |
| 28 | """ |
| 29 | Enable XlsxWriter Worksheet object to be opened, operated on, and |
| 30 | then automatically closed within a `with` statement. A filename or |
| 31 | stream object (such as an `io.BytesIO` instance) is expected as |
| 32 | *xlsx_file*. |
| 33 | """ |
| 34 | workbook = Workbook(xlsx_file, {"in_memory": True}) |
| 35 | worksheet = workbook.add_worksheet() |
| 36 | yield workbook, worksheet |
| 37 | workbook.close() |
| 38 | |
| 39 | def _populate_worksheet(self, workbook, worksheet): |
| 40 | """ |