Skip to content

Commit

Permalink
擴充功能
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJui committed Sep 6, 2024
1 parent bcd00a1 commit d05926e
Show file tree
Hide file tree
Showing 11 changed files with 1,209 additions and 569 deletions.
Binary file modified Tai_Gi_Zu_Im_Bun.xlsx
Binary file not shown.
26 changes: 25 additions & 1 deletion a710_Thiam_Han_Ji_Tan_Piau_Im.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# 填漢字等標音:將整段的文字拆解,個別填入儲存格,以便後續人工手動填入台語音標、注音符號。
import getopt
import os
import sys

import xlwings as xw

import settings
from p710_thiam_han_ji import fill_hanji_in_cells

Expand Down Expand Up @@ -61,9 +64,30 @@ def get_input_and_output_options(argv):
CONVERT_FILE_NAME = file_path
print(f"CONVERT_FILE_NAME = {CONVERT_FILE_NAME}")

# 打開 Excel 檔案
wb = xw.Book(CONVERT_FILE_NAME)

# =========================================================================
# (2) 將漢字填入
# - 上方:台語音標
# - 下方:台語注音符號
# =========================================================================
fill_hanji_in_cells(CONVERT_FILE_NAME)
fill_hanji_in_cells(wb)

# =========================================================================
# (3) 依據《文章標題》另存新檔。
# =========================================================================
# wb = xw.Book(CONVERT_FILE_NAME)
# setting_sheet = wb.sheets["env"]
# new_file_name = str(
# setting_sheet.range("C4").value
# ).strip()
# new_file_path = os.path.join(
# ".\\output",
# f"【河洛話注音】{new_file_name}" + ".xlsx")

# # 儲存新建立的工作簿
# wb.save(new_file_path)

# # 保存 Excel 檔案
# wb.close()
20 changes: 19 additions & 1 deletion a720_Thiam_Zu_Im.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,30 @@ def get_input_and_output_options(argv):
CONVERT_FILE_NAME = file_path
print(f"CONVERT_FILE_NAME = {CONVERT_FILE_NAME}")

# 打開 Excel 檔案
wb = xw.Book(CONVERT_FILE_NAME)

# =========================================================================
# (2) 分析已輸入的【台語音標】及【台語注音符號】,將之各別填入漢字之上、下方。
# - 上方:台語音標
# - 下方:台語注音符號
# =========================================================================
thiam_zu_im(CONVERT_FILE_NAME)
thiam_zu_im(wb, '漢字注音', 'V3')

# =========================================================================
# (3) 依據《文章標題》另存新檔。
# =========================================================================
# wb = xw.Book(CONVERT_FILE_NAME)
# setting_sheet = wb.sheets["env"]
# new_file_name = str(
# setting_sheet.range("C4").value
# ).strip()
# new_file_path = os.path.join(
# ".\\output",
# f"【河洛話注音】{new_file_name}" + ".xlsx")

# # 儲存新建立的工作簿
# wb.save(new_file_path)

# 保存 Excel 檔案
# wb.close()
29 changes: 16 additions & 13 deletions a730_Tng_Bang_Iah.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,28 @@ def get_input_and_output_options(argv):
CONVERT_FILE_NAME = file_path
print(f"CONVERT_FILE_NAME = {CONVERT_FILE_NAME}")

# 打開 Excel 檔案
wb = xw.Book(CONVERT_FILE_NAME)

# =========================================================================
# (2) 將已注音之「漢字注音表」,製作成 HTML 格式之「注音/拼音/標音」網頁。
# =========================================================================
tng_sing_bang_iah(CONVERT_FILE_NAME)
tng_sing_bang_iah(wb, '漢字注音', 'V3')

# =========================================================================
# (3) 依據《文章標題》另存新檔。
# =========================================================================
wb = xw.Book(CONVERT_FILE_NAME)
setting_sheet = wb.sheets["env"]
new_file_name = str(
setting_sheet.range("C4").value
).strip()
new_file_path = os.path.join(
".\\output",
f"【河洛話注音】{new_file_name}" + ".xlsx")
# wb = xw.Book(CONVERT_FILE_NAME)
# setting_sheet = wb.sheets["env"]
# new_file_name = str(
# setting_sheet.range("C4").value
# ).strip()
# new_file_path = os.path.join(
# ".\\output",
# f"【河洛話注音】{new_file_name}" + ".xlsx")

# 儲存新建立的工作簿
wb.save(new_file_path)
# # 儲存新建立的工作簿
# wb.save(new_file_path)

# 保存 Excel 檔案
wb.close()
# # 保存 Excel 檔案
# wb.close()
Loading

0 comments on commit d05926e

Please sign in to comment.