VBA代碼Imposition是啥意思-創(chuàng)新互聯(lián)

本篇文章給大家分享的是有關(guān)VBA代碼Imposition是啥意思,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。

創(chuàng)新互聯(lián)-云計(jì)算及IDC服務(wù)提供商,涵蓋公有云、IDC機(jī)房租用、南充服務(wù)器托管、等保安全、私有云建設(shè)等企業(yè)級(jí)互聯(lián)網(wǎng)基礎(chǔ)服務(wù),歡迎聯(lián)系:18982081108

ImpositionTool.bas


Attribute VB_Name = "ImpositionTool"

' 折手(Imposition)

' 在考慮版式和印后加工的前提下,將多個(gè)單獨(dú)的頁(yè)面安排到一個(gè)印張上(將文字、圖形和圖像安排到一個(gè)頁(yè)面內(nèi),稱為頁(yè)面排版)。

'打印全部

Sub printAll()

    Dim l_pages_count As Long, tmp_s As String

    l_pages_count = Selection.Information(wdNumberOfPagesInDocument)

    If l_pages_count Mod 4 > 0 Then Call setPageTo4Times

    tmp_s = getPageSequance(1, l_pages_count)

    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _

        wdPrintDocumentContent, Copies:=1, Pages:=tmp_s, _

        PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, _

        Background:=False, PrintToFile:=False, PrintZoomColumn:=2, PrintZoomRow:=1 _

        , PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

End Sub

'調(diào)整頁(yè)碼為4的倍數(shù)

'

Sub setPageTo4Times()

    Dim l_current_page As Long

    Dim l_current_page2 As Long

    Dim l_pages_count As Long

    Dim l_tmp As Long

    l_current_page = Selection.Information(wdActiveEndPageNumber)

    l_pages_count = Selection.Information(wdNumberOfPagesInDocument)

    l_tmp = l_pages_count Mod 4

    If l_tmp >= 0 Then

        Selection.EndKey Unit:=wdStory

        l_current_page2 = Selection.Information(wdActiveEndPageNumber)

        For i = 1 To 4 - l_tmp

            Selection.InsertBreak Type:=wdPageBreak

        Next

        ActiveDocument.ActiveWindow.PageScroll Up:=(l_current_page2 - l_current_page) '+ 4 - l_tmp

    End If

End Sub

' 返回折手頁(yè)碼順序

' 一頁(yè)紙正反2面各打印2頁(yè),共4頁(yè)

' 0 表示此處需要打印空白頁(yè)

Function getPageSequance(i_from As Long, i_to As Long) As String

    Dim l_page_count As Long

    Dim l_paper_count As Long

    Dim l_p As Long, l_tmp As Long

    If i_to >= i_from And i_from > 0 Then

        getPageSequance = ""

        l_page_count = i_to - i_from + 1

        l_paper_count = CLng(l_page_count / 4)

        If l_paper_count * 4 < l_page_count Then

            l_paper_count = l_paper_count + 1

        End If

        getPageSequance = ""

        For l_p = 1 To l_paper_count

            l_tmp = 2 * l_p - 1

            If l_tmp <= l_page_count Then

                getPageSequance = getPageSequance & "," & CStr(l_tmp - 1 + i_from)

            Else

                getPageSequance = getPageSequance & ",0"

            End If

            l_tmp = 2 * (2 * l_paper_count + 1 - l_p)

            If l_tmp <= l_page_count Then

                getPageSequance = getPageSequance & "," & CStr(l_tmp - 1 + i_from)

            Else

                getPageSequance = getPageSequance & ",0"

            End If

            l_tmp = 2 * l_p

            If l_tmp <= l_page_count Then

                getPageSequance = getPageSequance & "," & CStr(l_tmp - 1 + i_from)

            Else

                getPageSequance = getPageSequance & ",0"

            End If

            l_tmp = 2 * (2 * l_paper_count - l_p) + 1

            If l_tmp <= l_page_count Then

                getPageSequance = getPageSequance & "," & CStr(l_tmp - 1 + i_from)

            Else

                getPageSequance = getPageSequance & ",0"

            End If

        Next

        If Left$(getPageSequance, 1) = "," Then

            getPageSequance = Mid$(getPageSequance, 2)

        End If

    Else

        getPageSequance = ""

    End If

End Function

以上就是VBA代碼Imposition是啥意思,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

分享題目:VBA代碼Imposition是啥意思-創(chuàng)新互聯(lián)
標(biāo)題來(lái)源:http://bm7419.com/article40/gipeo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、軟件開發(fā)App設(shè)計(jì)、云服務(wù)器、用戶體驗(yàn)、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司