From 3543314cdf116997f40fcb9741c689b057652f25 Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 6 May 2026 16:59:23 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20apply=5Fmatches=20=D1=81=D0=BE=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D1=8F=D0=B5=D1=82=20=D1=80=D0=B5=D0=B7=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D1=82=D0=B0=D1=82=20=D0=BA=D0=B0=D0=BA=20.xlsx,=20?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=20.xlsm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openpyxl при wb.save() сбрасывает VBA-макросы из исходного .xlsm, получая фактически .xlsx-контент под расширением .xlsm — Excel такой файл не открывает. Меняем выходное расширение на .xlsx. Co-Authored-By: Claude Opus 4.7 (1M context) --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index b75038f..5b6fe22 100644 --- a/main.py +++ b/main.py @@ -483,7 +483,9 @@ async def apply_matches_endpoint(request: Request): fpath = work_dir / safe_name if not fpath.exists(): raise HTTPException(404, "File not found in work directory") - out_name = f"{Path(safe_name).stem}_filled.xlsm" + # openpyxl drops VBA macros when saving — write as .xlsx so Excel + # opens it cleanly even when the source was .xlsm + out_name = f"{Path(safe_name).stem}_filled.xlsx" out_path = work_dir / out_name try: result = apply_to_registry(fpath, out_path)