첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
'--------------------------------------------------
' 아래 한글 페이지 마진 설정하기 (단위 : 밀리미터)
'--------------------------------------------------
' pHwpCtrl      : HwpCtrl OCX
' dLeftMargin   : 왼쪽 마진
' dTopMargin    : 위쪽 마진
' dRightMargin  : 오른쪽 마진
' dBottomMargin : 아래쪽 마진
'--------------------------------------------------
Public Sub HWPSetPageMargin(pHwpCtrl As HwpCtrl, dLeftMargin As Double, dTopMargin As Double, dRightMargin As Double, dBottomMargin As Double)

    Dim pHwpAction        As HwpAction
    Dim pHwpParameterSet1 As HwpParameterSet
    Dim pHwpParameterSet2 As HwpParameterSet
    
    Set pHwpAction = pHwpCtrl.CreateAction("PageSetup")
    
    Set pHwpParameterSet1 = pHwpAction.CreateSet()
    
    pHwpAction.GetDefault pHwpParameterSet1
    
    pHwpParameterSet1.SetItem "ApplyTo", 3
    
    Set pHwpParameterSet2 = pHwpParameterSet1.CreateItemSet("PageDef", "PageDef")
    
    pHwpParameterSet2.SetItem "TopMargin", HWPGetUnit(dTopMargin)
    pHwpParameterSet2.SetItem "BottomMargin", HWPGetUnit(dBottomMargin)
    pHwpParameterSet2.SetItem "LeftMargin", HWPGetUnit(dLeftMargin)
    pHwpParameterSet2.SetItem "RightMargin", HWPGetUnit(dRightMargin)
    pHwpParameterSet2.SetItem "HeaderLen", 0
    pHwpParameterSet2.SetItem "FooterLen", 0
    pHwpParameterSet2.SetItem "GutterLen", 0
    
    pHwpAction.Execute pHwpParameterSet1
    
    Set pHwpParameterSet2 = Nothing
    
    Set pHwpParameterSet2 = Nothing
    
    Set pHwpAction = Nothing

End Sub
728x90
반응형
그리드형(광고전용)
Posted by icodebroker
TAG ,

댓글을 달아 주세요