해결됨
직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
한글-파이썬 : 바탕쪽, 다단
안녕하세요. 파이썬으로 한글자동화 업무를 위해 공부하고있습니다.바탕쪽 혹은 다단으로 들어가는 코드에서파이썬코드로 문법을 바꾸어도 편집모드로 들어가지지 않거나 실행이 되지 않습니다.혹시 다른 방법이 있는지 궁금합니다! 바탕쪽hwp.HAction.GetDefault("MasterPage", hwp.HParameterSet.HMasterPage.HSet)
hwp.HParameterSet.HMasterPage.Duplicate = 0
hwp.HParameterSet.HMasterPage.Front = 0
hwp.HParameterSet.HMasterPage.Type = 0
hwp.HParameterSet.HMasterPage.HSet.SetItem("ApplyTo", 2)
hwp.HAction.Execute("MasterPage", hwp.HParameterSet.HMasterPage.HSet)
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[7], line 2
1 hwp.HAction.GetDefault("MasterPage", hwp.HParameterSet.HMasterPage.HSet)
----> 2 hwp.HParameterSet.HMasterPage.SetItem(Duplicate, 0)
3 hwp.HParameterSet.HMasterPage.SetItem(Front, 0)
4 hwp.HParameterSet.HMasterPage.SetItem(Type ,0)
File ~\anaconda3\Lib\site-packages\win32com\client\__init__.py:580, in DispatchBaseClass.__getattr__(self, attr)
578 args = self._prop_map_get_.get(attr)
579 if args is None:
--> 580 raise AttributeError(
581 "'%s' object has no attribute '%s'" % (repr(self), attr)
582 )
583 return self._ApplyTypes_(*args)
AttributeError: '<win32com.gen_py.HwpObject 1.0 Type Library.HMasterPage instance at 0x1349180151824>' object has no attribute 'SetItem' 2.다단 hwp.HAction.GetDefault("MultiColumn", hwp.HParameterSet.HColDef.HSet)
hwp.HParameterSet.HColDef.Count = 2
hwp.HParameterSet.HColDef.SameGap = MiliToHwpUnit(8.0)
hwp.HParameterSet.HColDef.HSet.SetItem("ApplyClass", 832)
hwp.HParameterSet.HColDef.HSet.SetItem("ApplyTo", 6)
hwp.HAction.Execute("MultiColumn", hwp.HParameterSet.HColDef.HSet)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[5], line 3
1 hwp.HAction.GetDefault("MultiColumn", hwp.HParameterSet.HColDef.HSet)
2 hwp.HParameterSet.HColDef.Count = 2
----> 3 hwp.HParameterSet.HColDef.SameGap = MiliToHwpUnit(8.0)
4 hwp.HParameterSet.HColDef.HSet.SetItem("ApplyClass", 832)
5 hwp.HParameterSet.HColDef.HSet.SetItem("ApplyTo", 6)
NameError: name 'MiliToHwpUnit' is not defined