Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

поправлена выгрузка xlsx формата больше 26 столбцов #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions xlsexport/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,14 @@ def to_xlsx(self, queryset=None):
# Add a bold format to use to highlight cells.
bold = workbook.add_format({"bold": True})

letters = string.ascii_uppercase

# Установка ширины колонок и заполнение заголовков
for idx, field in enumerate(param_fields):
export_ignore_field = field.get("export_ignore", False)
if export_ignore_field:
continue
worksheet.set_column(f"{letters[idx]}:{letters[idx]}", field.get("width", 15))
worksheet.write(f"{letters[idx]}1", f'{field.get("name")}', bold)

worksheet.set_column(idx, idx, field.get("width", 15))
worksheet.write(0, idx, f'{field.get("name")}', bold)

# Start from the first cell. Rows and columns are zero indexed.
row = 1
Expand Down