Skip to content

Commit

Permalink
Merge pull request #779 from euphorie/openpyxl3
Browse files Browse the repository at this point in the history
Support openpyxl 3.x
  • Loading branch information
reinhardt authored Jan 7, 2025
2 parents f5c4788 + 863f7e1 commit c67d01c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Changelog
- German translations related to locking
(`#3015 <https://github.com/syslabcom/scrum/issues/3015>`_)
[reinhardt]
- Support openpyxl 3.x
[reinhardt]


16.2.5 (2024-12-09)
Expand Down
15 changes: 8 additions & 7 deletions src/euphorie/client/browser/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from euphorie.client import survey
from euphorie.client import utils
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import save_virtual_workbook
from openpyxl.writer.excel import save_workbook
from plone import api
from plone.memoize.view import memoize
from Products.Five import BrowserView
from sqlalchemy import sql
from tempfile import NamedTemporaryFile
from urllib.parse import quote
from zope.i18n import translate

Expand Down Expand Up @@ -218,11 +219,7 @@ def create_workbook(self):
value = module.title
if value is not None:
cell = sheet.cell(row=row, column=column)
if key == "number":
# force sting
cell.set_explicit_value(value)
else:
cell.value = value
cell.value = value
column += 1
row += 1
return book
Expand Down Expand Up @@ -252,4 +249,8 @@ def __call__(self):
"Content-Type",
"application/vnd.openxmlformats-" "officedocument.spreadsheetml.sheet",
)
return save_virtual_workbook(book)

with NamedTemporaryFile() as tmp:
save_workbook(book, tmp.name)
tmp.seek(0)
return tmp.read()

0 comments on commit c67d01c

Please sign in to comment.