hml로 변환시 북마크 기능으로 페이지 카운팅 기능 추가

This commit is contained in:
2025-06-26 17:51:25 +09:00
parent 6c18fba0cf
commit eb1ed8b105
3 changed files with 318 additions and 2 deletions

View File

@@ -79,6 +79,33 @@ def convert_hwp_to_xml(input_folder, output_folder):
#hwpactionid 기반
hwp.Run("MoveDocBegin")
total_pages = hwp.PageCount
current = 1
# hwp.HAction.Run("MoveDocBegin")
while( current <= total_pages ):
# 북마크 삽입 (현재 커서 위치에 "Page_쪽_start","Page_쪽_end" 이름으로)
hwp.HAction.GetDefault("Bookmark", hwp.HParameterSet.HBookMark.HSet)
hwp.HParameterSet.HBookMark.name = "Page_" + str(current) + "_start"
hwp.HParameterSet.HBookMark.type = 0
hwp.HParameterSet.HBookMark.Command = 0
hwp.HAction.Execute("Bookmark", hwp.HParameterSet.HBookMark.HSet)
if current < total_pages:
hwp.HAction.Run("MovePageDown")
hwp.HAction.Run("MoveLeft")
else:
hwp.HAction.Run("MoveDocEnd")
hwp.HAction.GetDefault("Bookmark", hwp.HParameterSet.HBookMark.HSet)
hwp.HParameterSet.HBookMark.name = "Page_" + str(current) + "_end"
hwp.HParameterSet.HBookMark.type = 0
hwp.HParameterSet.HBookMark.Command = 0
hwp.HAction.Execute("Bookmark", hwp.HParameterSet.HBookMark.HSet)
hwp.HAction.Run("MoveRight")
current += 1
hwp.Run("SelectCtrlFront")
while True:
@@ -134,8 +161,8 @@ def delete_gen_py():
if __name__ == "__main__":
exam_rounds = [
"2506_3",
# "2504_3"
# "2506_3",
"2505"
]
delete_gen_py()