-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,958 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import getopt | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
import xlwings as xw | ||
|
||
from p710_thiam_han_ji import fill_hanji_in_cells | ||
|
||
# ========================================================================= | ||
# (1) 取得專案根目錄。 | ||
# ========================================================================= | ||
# 獲取當前檔案的路徑 | ||
current_file_path = Path(__file__).resolve() | ||
|
||
# 專案根目錄 | ||
project_root = current_file_path.parent | ||
|
||
print(f"專案根目錄為: {project_root}") | ||
|
||
# ========================================================================= | ||
# (2) 若無指定輸入檔案,則獲取當前作用中的 Excel 檔案並另存新檔。 | ||
# ========================================================================= | ||
wb = None | ||
# 使用已打開且處於作用中的 Excel 工作簿 | ||
try: | ||
# 嘗試獲取當前作用中的 Excel 工作簿 | ||
wb = xw.apps.active.books.active | ||
except Exception as e: | ||
print(f"發生錯誤: {e}") | ||
print("無法找到作用中的 Excel 工作簿") | ||
sys.exit(2) | ||
|
||
if not wb: | ||
print("無法執行,可能原因:(1) 未指定輸入檔案;(2) 未找到作用中的 Excel 工作簿") | ||
sys.exit(2) | ||
|
||
# 清空儲存格內容 | ||
sheet = wb.sheets['漢字注音'] | ||
sheet.range('D3:R166').clear_contents() # 清除 C3:R166 範圍的內容 | ||
|
||
# 將待注音的漢字填入 | ||
fill_hanji_in_cells(wb) | ||
|
||
# 將檔案存放路徑設為【專案根目錄】之下 | ||
file_name = "Tai_Gi_Zu_Im_Bun.xlsx" | ||
try: | ||
file_name = str(wb.names['TITLE'].refers_to_range.value).strip() | ||
except KeyError: | ||
# print("未找到命名範圍 'TITLE',使用預設名稱") | ||
# file_name = "default_file_name.xlsx" # 提供一個預設檔案名稱 | ||
setting_sheet = wb.sheets["env"] | ||
file_name = str( | ||
setting_sheet.range("C4").value | ||
).strip() | ||
|
||
# 設定檔案輸出路徑,存於專案根目錄下的 output2 資料夾 | ||
output_path = wb.names['OUTPUT_PATH'].refers_to_range.value | ||
new_file_path = os.path.join( | ||
".\\{0}".format(output_path), | ||
f"【河洛話注音】{file_name}.xlsx") | ||
|
||
# 儲存新建立的工作簿 | ||
wb.save(new_file_path) | ||
|
||
# 關閉工作簿 | ||
wb.close() | ||
|
||
print(f"檔案已成功存為 {new_file_path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="zh-TW"> | ||
<head> | ||
<title>《金剛般若波羅蜜經001。法會因由分第一》【漢字注音】</title> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="assets/styles/styles.css"> | ||
</head> | ||
<body> | ||
《金剛般若波羅蜜經001。法會因由分第一》【漢字注音】 | ||
<div class='separator' style='clear: both'> | ||
<a href='圖片' style='display: block; padding: 1em 0; text-align: center'> | ||
<img alt='金剛般若波羅蜜經001。法會因由分第一' border='0' width='400' data-original-height='630' data-original-width='1200' | ||
src='https://shoplineimg.com/5db585d59db3cb0012a18bce/5f2a9d3f30cc6200455c1c25/1296x.webp?source_format=jpg' /> | ||
</a> | ||
</div> | ||
|
||
<div class='Siang_Pai'><p> | ||
<span>《</span> | ||
<ruby><rb>金</rb><rt>kim1</rt><rtc>ㄍㄧㆬ˙</rtc></ruby> | ||
<ruby><rb>剛</rb><rt>kong1</rt><rtc>ㄍㆲ˙</rtc></ruby> | ||
<ruby><rb>般</rb><rt>puann1</rt><rtc>ㄅㄨㆩ˙</rtc></ruby> | ||
<ruby><rb>若</rb><rt>jiok4</rt><rtc>ㆡㄧㆦㆻ</rtc></ruby> | ||
<ruby><rb>波</rb><rt>phoo¹</rt><rtc>ㄆㆦˉ</rtc></ruby> | ||
<ruby><rb>羅</rb><rt>lo5</rt><rtc>ㄌㄜˊ</rtc></ruby> | ||
<ruby><rb>蜜</rb><rt>bit8</rt><rtc>ㆠㄧㆵ˙</rtc></ruby> | ||
<ruby><rb>經</rb><rt>king1</rt><rtc>ㄍㄧㄥ˙</rtc></ruby> | ||
<span>》</span> | ||
</p><p> | ||
<ruby><rb>法</rb><rt>huat4</rt><rtc>ㄏㄨㄚㆵ</rtc></ruby> | ||
<ruby><rb>會</rb><rt>e6</rt><rtc>ㆤˋ</rtc></ruby> | ||
<ruby><rb>因</rb><rt>in1</rt><rtc>ㄧㄣ˙</rtc></ruby> | ||
<ruby><rb>由</rb><rt>iu5</rt><rtc>ㄧㄨˊ</rtc></ruby> | ||
<ruby><rb>分</rb><rt>hun1</rt><rtc>ㄏㄨㄣ˙</rtc></ruby> | ||
<ruby><rb>第</rb><rt>te7</rt><rtc>ㄉㆤ˪</rtc></ruby> | ||
<ruby><rb>一</rb><rt>it4</rt><rtc>ㄧㆵ</rtc></ruby> | ||
</p><p> | ||
<ruby><rb>如</rb><rt>ju5</rt><rtc>ㆡㄨˊ</rtc></ruby> | ||
<ruby><rb>是</rb><rt>si6</rt><rtc>ㄙㄧˋ</rtc></ruby> | ||
<ruby><rb>我</rb><rt>ngoo2</rt><rtc>ㄫㆦˋ</rtc></ruby> | ||
<ruby><rb>聞</rb><rt>bun5</rt><rtc>ㆠㄨㄣˊ</rtc></ruby> | ||
<span>:</span> | ||
<ruby><rb>一</rb><rt>it4</rt><rtc>ㄧㆵ</rtc></ruby> | ||
<ruby><rb>時</rb><rt>si5</rt><rtc>ㄙㄧˊ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>佛</rb><rt>put8</rt><rtc>ㄅㄨㆵ˙</rtc></ruby> | ||
<ruby><rb>在</rb><rt>tsai6</rt><rtc>ㄗㄞˋ</rtc></ruby> | ||
<ruby><rb>舍</rb><rt></rt><rtc></rtc></ruby> | ||
<ruby><rb>衛</rb><rt>ue7</rt><rtc>ㄨㆤ˪</rtc></ruby> | ||
<ruby><rb>國</rb><rt>kok4</rt><rtc>ㄍㆦㆻ</rtc></ruby> | ||
<ruby><rb>祈</rb><rt>ki5</rt><rtc>ㄍㄧˊ</rtc></ruby> | ||
<ruby><rb>樹</rb><rt>tshiu7</rt><rtc>ㄘㄧㄨ˪</rtc></ruby> | ||
<ruby><rb>給</rb><rt>kip4</rt><rtc>ㄍ一ㆴ</rtc></ruby> | ||
<ruby><rb>孤</rb><rt>koo1</rt><rtc>ㄍㆦ˙</rtc></ruby> | ||
<ruby><rb>獨</rb><rt>tak8</rt><rtc>ㄉㄚㆻ˙</rtc></ruby> | ||
<ruby><rb>園</rb><rt>uan5</rt><rtc>ㄨㄢˊ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>與</rb><rt>ir2</rt><rtc>ˋ</rtc></ruby> | ||
<ruby><rb>大</rb><rt>tua7</rt><rtc>ㄉㄨㄚ˪</rtc></ruby> | ||
<ruby><rb>比</rb><rt>pi2</rt><rtc>ㄅㄧˋ</rtc></ruby> | ||
<ruby><rb>丘</rb><rt>khu1</rt><rtc>ㄎㄨ˙</rtc></ruby> | ||
<ruby><rb>眾</rb><rt>tsing3</rt><rtc>ㄗㄧㄥ˫</rtc></ruby> | ||
<ruby><rb>千</rb><rt>tshainn1</rt><rtc>ㄘㆮ˙</rtc></ruby> | ||
<ruby><rb>二</rb><rt>ji7</rt><rtc>ㆡㄧ˪</rtc></ruby> | ||
<ruby><rb>百</rb><rt>pah4</rt><rtc>ㄅㄚㆷ</rtc></ruby> | ||
<ruby><rb>五</rb><rt>goo6</rt><rtc>ㆣㆦˋ</rtc></ruby> | ||
<ruby><rb>十</rb><rt>tsap8</rt><rtc>ㄗㄚㆴ˙</rtc></ruby> | ||
<ruby><rb>人</rb><rt>jin⁵</rt><rtc>ㆢㄧㄣˊ</rtc></ruby> | ||
<ruby><rb>俱</rb><rt>ku1</rt><rtc>ㄍㄨ˙</rtc></ruby> | ||
<span>。</span> | ||
<ruby><rb>爾</rb><rt>nia7</rt><rtc>ㄋㄧㄚ˪</rtc></ruby> | ||
<ruby><rb>時</rb><rt>si5</rt><rtc>ㄙㄧˊ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>世</rb><rt>se3</rt><rtc>ㄙㆤ˫</rtc></ruby> | ||
<ruby><rb>尊</rb><rt>tsun1</rt><rtc>ㄗㄨㄣ˙</rtc></ruby> | ||
<ruby><rb>食</rb><rt>sit8</rt><rtc>ㄙㄧㆵ˙</rtc></ruby> | ||
<ruby><rb>時</rb><rt>si5</rt><rtc>ㄙㄧˊ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>著</rb><rt>tio0</rt><rtc>ㄉㄧㄜ˙</rtc></ruby> | ||
<ruby><rb>衣</rb><rt>i1</rt><rtc>ㄧ˙</rtc></ruby> | ||
<ruby><rb>持</rb><rt>ti5</rt><rtc>ㄉㄧˊ</rtc></ruby> | ||
<ruby><rb>缽</rb><rt>puat4</rt><rtc>ㄅㄨㄚㆵ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>入</rb><rt>jip8</rt><rtc>ㆡ一ㆴ˙</rtc></ruby> | ||
<ruby><rb>舍</rb><rt></rt><rtc></rtc></ruby> | ||
<ruby><rb>衛</rb><rt>ue7</rt><rtc>ㄨㆤ˪</rtc></ruby> | ||
<ruby><rb>大</rb><rt>tua7</rt><rtc>ㄉㄨㄚ˪</rtc></ruby> | ||
<ruby><rb>城</rb><rt>siann5</rt><rtc>ㄙˊ</rtc></ruby> | ||
<ruby><rb>乞</rb><rt>khit4</rt><rtc>ㄎㄧㆵ</rtc></ruby> | ||
<ruby><rb>食</rb><rt>sit8</rt><rtc>ㄙㄧㆵ˙</rtc></ruby> | ||
<span>。</span> | ||
<ruby><rb>於</rb><rt>u1</rt><rtc>ㄨ˙</rtc></ruby> | ||
<ruby><rb>其</rb><rt>ki5</rt><rtc>ㄍㄧˊ</rtc></ruby> | ||
<ruby><rb>城</rb><rt>siann5</rt><rtc>ㄙˊ</rtc></ruby> | ||
<ruby><rb>中</rb><rt>tiong1</rt><rtc>ㄉㄧㆲ˙</rtc></ruby> | ||
<ruby><rb>次</rb><rt>tshur3</rt><rtc>ㄘ˫</rtc></ruby> | ||
<ruby><rb>第</rb><rt>te7</rt><rtc>ㄉㆤ˪</rtc></ruby> | ||
<ruby><rb>乞</rb><rt>khit4</rt><rtc>ㄎㄧㆵ</rtc></ruby> | ||
<ruby><rb>已</rb><rt>i2</rt><rtc>ㄧˋ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>還</rb><rt>huan5</rt><rtc>ㄏㄨㄢˊ</rtc></ruby> | ||
<ruby><rb>至</rb><rt>tsi3</rt><rtc>ㄗㄧ˫</rtc></ruby> | ||
<ruby><rb>本</rb><rt>puinn2</rt><rtc>ㄅㄨㆪˋ</rtc></ruby> | ||
<ruby><rb>處</rb><rt>tshir3</rt><rtc>ㄘ˫</rtc></ruby> | ||
<span>。</span> | ||
<ruby><rb>飯</rb><rt>puinn7</rt><rtc>ㄅㄨㆪ˪</rtc></ruby> | ||
<ruby><rb>食</rb><rt>sit8</rt><rtc>ㄙㄧㆵ˙</rtc></ruby> | ||
<ruby><rb>訖</rb><rt>git4</rt><rtc>ㆣㄧㆵ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>收</rb><rt>siu1</rt><rtc>ㄙㄧㄨ˙</rtc></ruby> | ||
<ruby><rb>衣</rb><rt>i1</rt><rtc>ㄧ˙</rtc></ruby> | ||
<ruby><rb>缽</rb><rt>puat4</rt><rtc>ㄅㄨㄚㆵ</rtc></ruby> | ||
<span>。</span> | ||
<ruby><rb>洗</rb><rt>se2</rt><rtc>ㄙㆤˋ</rtc></ruby> | ||
<ruby><rb>足</rb><rt>tsiok4</rt><rtc>ㄗㄧㆦㆻ</rtc></ruby> | ||
<ruby><rb>已</rb><rt>i2</rt><rtc>ㄧˋ</rtc></ruby> | ||
<span>,</span> | ||
<ruby><rb>敷</rb><rt>hu1</rt><rtc>ㄏㄨ˙</rtc></ruby> | ||
<ruby><rb>座</rb><rt>tso7</rt><rtc>ㄗㄜ˪</rtc></ruby> | ||
<ruby><rb>而</rb><rt>ji5</rt><rtc>ㆡㄧˊ</rtc></ruby> | ||
<ruby><rb>坐</rb><rt>tser6</rt><rtc>ㄗˋ</rtc></ruby> | ||
<span>。</span> | ||
</p></div> | ||
</body> | ||
</html> | ||
|
Oops, something went wrong.