basic debugging step 1

This commit is contained in:
2024-11-05 07:46:21 +09:00
parent d6464c1369
commit 0c2dfec7dd
8 changed files with 499 additions and 194 deletions

View File

@ -1,55 +1,19 @@
from sumaexcel import SumasenExcel
import logging
# 初期化
excel = SumasenExcel()
excel.init("username", "project_id", "document")
variables = {"zekken_number":"5033","event_code":"FC岐阜"}
excel = SumasenExcel(document="test", variables=variables, docbase="./testdata")
logging.info("Excelファイル作成 step-1")
# シート初期化
excel.init_sheet("Sheet1")
# スタイル適用
excel.apply_style(
"A1:D10",
font={"name": "Arial", "size": 12, "bold": True},
fill={"start_color": "FFFF00"},
alignment={"horizontal": "center"}
)
# セルのマージ
excel.merge_range(1, 1, 1, 4)
# 画像追加
excel.add_image(
"logo.png",
position=(1, 1),
size=(100, 100)
)
# 条件付き書式
excel.add_conditional_format(
"B2:B10",
format_type="color_scale",
min_color="00FF0000",
max_color="0000FF00"
)
# ページ設定
excel.setup_page(
orientation="landscape",
paper_size=PaperSizes.A4,
margins={
"left": 1.0,
"right": 1.0,
"top": 1.0,
"bottom": 1.0
},
header_footer={
"odd_header": "&L&BPage &P of &N&C&BConfidential",
"odd_footer": "&RDraft"
}
)
# レポート生成
excel.make_report(db, data_rec)
ret = excel.make_report(variables=variables)
logging.info(f"Excelファイル作成 step-2 : ret={ret}")
if ret["status"]==True:
filepath=ret["filepath"]
logging.info(f"Excelファイル作成 : ret.filepath={filepath}")
else:
message = ret.get("message", "No message provided")
logging.error(f"Excelファイル作成失敗 : ret.message={message}")