轉貼 Facebook 許願:
希望可以新增ODT開放格式 以免出現不同版本的WORD軟體開啟格式都不一樣的問題
2個讚
docx 轉 odt 是一種可能,如:
https://stackoverflow.com/questions/21845789/how-to-convert-docx-to-odt-with-libreoffice-on-ubuntu-bash
3個讚
我也希望官方发布CBETA odt版
上个月我写了个py epub转odt 需要改进 递归子目录.
import os
import subprocess
def convert_and_clean():
# 获取当前目录下所有 epub 文件
files = [f for f in os.listdir('.') if f.endswith('.epub')]
if not files:
print("未发现 epub 文件。")
return
for epub_file in files:
base_name = os.path.splitext(epub_file)[0]
docx_file = f"{base_name}.docx"
odt_file = f"{base_name}.odt"
try:
# 1. EPUB -> DOCX
print(f"正在转换: {epub_file} -> {docx_file}")
subprocess.run(['pandoc', epub_file, '-o', docx_file], check=True)
# 2. DOCX -> ODT
print(f"正在转换: {docx_file} -> {odt_file}")
subprocess.run(['pandoc', docx_file, '-o', odt_file], check=True)
# 3. 删除中间产物 DOCX
if os.path.exists(docx_file):
os.remove(docx_file)
print(f"临时文件已删除: {docx_file}")
print(f"--- {base_name} 转换完成 ---")
except subprocess.CalledProcessError as e:
print(f"转换 {base_name} 时发生错误: {e}")
except Exception as e:
print(f"处理 {base_name} 时发生未知错误: {e}")
if __name__ == "__main__":
convert_and_clean()
1個讚
感謝,幫忙製作 DOCX 的 志工 黃訓慶 師兄 已完成 大正藏 DOCX 轉 ODT,
預定 2026.R1 推出。
2個讚