v5:HWPX 스타일 주입 + 표 열너비 변환_20260127

This commit is contained in:
2026-02-20 11:42:07 +09:00
parent 17e639ed40
commit 71740ce912
6 changed files with 1260 additions and 228 deletions

22
app.py
View File

@@ -229,16 +229,22 @@ def export_hwp():
# 스타일 그루핑 사용 여부
if use_style_grouping:
converter.convert_with_styles(html_path, hwp_path)
final_path = converter.convert_with_styles(html_path, hwp_path)
# HWPX 파일 전송
return send_file(
final_path,
as_attachment=True,
download_name=f'report_{datetime.now().strftime("%Y%m%d_%H%M%S")}.hwpx',
mimetype='application/vnd.hancom.hwpx'
)
else:
converter.convert(html_path, hwp_path)
return send_file(
hwp_path,
as_attachment=True,
download_name=f'report_{datetime.now().strftime("%Y%m%d_%H%M%S")}.hwp',
mimetype='application/x-hwp'
)
return send_file(
hwp_path,
as_attachment=True,
download_name=f'report_{datetime.now().strftime("%Y%m%d_%H%M%S")}.hwp',
mimetype='application/x-hwp'
)
except ImportError as e:
return jsonify({'error': f'pyhwpx 필요: {str(e)}'}), 500