1cdf0e10cSrcweirAttribute VB_Name = "Preparation" 2*e76eebc6SAndrew Rist'************************************************************************* 3*e76eebc6SAndrew Rist' 4*e76eebc6SAndrew Rist' Licensed to the Apache Software Foundation (ASF) under one 5*e76eebc6SAndrew Rist' or more contributor license agreements. See the NOTICE file 6*e76eebc6SAndrew Rist' distributed with this work for additional information 7*e76eebc6SAndrew Rist' regarding copyright ownership. The ASF licenses this file 8*e76eebc6SAndrew Rist' to you under the Apache License, Version 2.0 (the 9*e76eebc6SAndrew Rist' "License"); you may not use this file except in compliance 10*e76eebc6SAndrew Rist' with the License. You may obtain a copy of the License at 11*e76eebc6SAndrew Rist' 12*e76eebc6SAndrew Rist' http://www.apache.org/licenses/LICENSE-2.0 13*e76eebc6SAndrew Rist' 14*e76eebc6SAndrew Rist' Unless required by applicable law or agreed to in writing, 15*e76eebc6SAndrew Rist' software distributed under the License is distributed on an 16*e76eebc6SAndrew Rist' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17*e76eebc6SAndrew Rist' KIND, either express or implied. See the License for the 18*e76eebc6SAndrew Rist' specific language governing permissions and limitations 19*e76eebc6SAndrew Rist' under the License. 20*e76eebc6SAndrew Rist' 21*e76eebc6SAndrew Rist'************************************************************************* 22cdf0e10cSrcweirOption Explicit 23cdf0e10cSrcweir 24cdf0e10cSrcweirFunction Prepare_HeaderFooter_GraphicFrames(docAnalysis As DocumentAnalysis, myIssue As IssueInfo, _ 25cdf0e10cSrcweir var As Variant, currDoc As Document) As Boolean 26cdf0e10cSrcweir On Error GoTo HandleErrors 27cdf0e10cSrcweir Dim currentFunctionName As String 28cdf0e10cSrcweir currentFunctionName = "Prepare_HeaderFooter_GraphicFrames" 29cdf0e10cSrcweir 30cdf0e10cSrcweir Dim myPrepInfo As PrepareInfo 31cdf0e10cSrcweir Set myPrepInfo = var 32cdf0e10cSrcweir 33cdf0e10cSrcweir Dim smove As Long 34cdf0e10cSrcweir Dim temp As Single 35cdf0e10cSrcweir Dim ELength As Single 36cdf0e10cSrcweir Dim PageHeight As Single 37cdf0e10cSrcweir Dim Snum As Integer 38cdf0e10cSrcweir Dim Fnum As Integer 39cdf0e10cSrcweir Dim I As Integer 40cdf0e10cSrcweir Dim myshape As Shape 41cdf0e10cSrcweir Dim shapetop() As Single 42cdf0e10cSrcweir Dim temptop As Single 43cdf0e10cSrcweir 44cdf0e10cSrcweir With currDoc.ActiveWindow 'change to printview 45cdf0e10cSrcweir If .View.SplitSpecial = wdPaneNone Then 46cdf0e10cSrcweir .ActivePane.View.Type = wdPrintView 47cdf0e10cSrcweir Else 48cdf0e10cSrcweir .Panes(2).Close 49cdf0e10cSrcweir .ActivePane.View.Type = wdPrintView 50cdf0e10cSrcweir .View.Type = wdPrintView 51cdf0e10cSrcweir End If 52cdf0e10cSrcweir End With 53cdf0e10cSrcweir 54cdf0e10cSrcweir PageHeight = currDoc.PageSetup.PageHeight 55cdf0e10cSrcweir PageHeight = PageHeight / 2 56cdf0e10cSrcweir 57cdf0e10cSrcweir Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _ 58cdf0e10cSrcweir count:=myPrepInfo.HF_OnPage 59cdf0e10cSrcweir currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader 60cdf0e10cSrcweir 61cdf0e10cSrcweir Snum = myPrepInfo.HF_Shapes.count 62cdf0e10cSrcweir If Snum <> 0 Then 63cdf0e10cSrcweir ReDim shapetop(Snum) 64cdf0e10cSrcweir ReDim top(Snum) 65cdf0e10cSrcweir I = 0 66cdf0e10cSrcweir For Each myshape In myPrepInfo.HF_Shapes 67cdf0e10cSrcweir If myshape.Type = msoPicture Then 68cdf0e10cSrcweir If myshape.RelativeVerticalPosition <> wdRelativeVerticalPositionPage Then 69cdf0e10cSrcweir shapetop(I) = myshape.top + myshape.Anchor.Information(wdVerticalPositionRelativeToPage) 70cdf0e10cSrcweir Else 71cdf0e10cSrcweir shapetop(I) = myshape.top 72cdf0e10cSrcweir End If 73cdf0e10cSrcweir ElseIf myshape.Type = msoTextBox Then 74cdf0e10cSrcweir myshape.TextFrame.TextRange.Select 75cdf0e10cSrcweir 76cdf0e10cSrcweir shapetop(I) = Selection.Information(wdVerticalPositionRelativeToPage) 77cdf0e10cSrcweir End If 78cdf0e10cSrcweir I = I + 1 79cdf0e10cSrcweir Next myshape 80cdf0e10cSrcweir End If 81cdf0e10cSrcweir 82cdf0e10cSrcweir currDoc.Content.Select 83cdf0e10cSrcweir Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _ 84cdf0e10cSrcweir count:=myPrepInfo.HF_OnPage 'set frametop might change the selection position 85cdf0e10cSrcweir 86cdf0e10cSrcweir If myPrepInfo.HF_inheader Then 87cdf0e10cSrcweir currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader 88cdf0e10cSrcweir Selection.MoveStart 89cdf0e10cSrcweir ELength = 0 90cdf0e10cSrcweir While ELength < myPrepInfo.HF_extendLength 91cdf0e10cSrcweir Selection.TypeParagraph 92cdf0e10cSrcweir ELength = ELength + Selection.Characters.First.Font.Size 93cdf0e10cSrcweir Wend 94cdf0e10cSrcweir Else 95cdf0e10cSrcweir currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter 96cdf0e10cSrcweir Selection.MoveStart 97cdf0e10cSrcweir ELength = 0 98cdf0e10cSrcweir While ELength < myPrepInfo.HF_extendLength 99cdf0e10cSrcweir Selection.TypeParagraph 100cdf0e10cSrcweir ELength = ELength + Selection.Characters.First.Font.Size 101cdf0e10cSrcweir Wend 102cdf0e10cSrcweir End If 103cdf0e10cSrcweir 104cdf0e10cSrcweir If Snum <> 0 Then 105cdf0e10cSrcweir I = 0 106cdf0e10cSrcweir For Each myshape In myPrepInfo.HF_Shapes 107cdf0e10cSrcweir If myshape.Type = msoPicture Then 108cdf0e10cSrcweir If myshape.RelativeVerticalPosition <> wdRelativeVerticalPositionPage Then 109cdf0e10cSrcweir temptop = myshape.top + myshape.Anchor.Information(wdVerticalPositionRelativeToPage) 110cdf0e10cSrcweir Else 111cdf0e10cSrcweir temptop = myshape.top 112cdf0e10cSrcweir End If 113cdf0e10cSrcweir ElseIf myshape.Type = msoTextBox Then 114cdf0e10cSrcweir myshape.TextFrame.TextRange.Select 115cdf0e10cSrcweir 116cdf0e10cSrcweir temptop = Selection.Information(wdVerticalPositionRelativeToPage) 117cdf0e10cSrcweir End If 118cdf0e10cSrcweir Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _ 119cdf0e10cSrcweir count:=myPrepInfo.HF_OnPage 120cdf0e10cSrcweir If myPrepInfo.HF_inheader Then 121cdf0e10cSrcweir currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader 122cdf0e10cSrcweir Else 123cdf0e10cSrcweir currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter 124cdf0e10cSrcweir End If 125cdf0e10cSrcweir Selection.HeaderFooter.Shapes(myshape.name).Select 126cdf0e10cSrcweir Selection.ShapeRange.IncrementTop shapetop(I) - temptop 127cdf0e10cSrcweir I = I + 1 128cdf0e10cSrcweir Next myshape 129cdf0e10cSrcweir End If 130cdf0e10cSrcweir ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 131cdf0e10cSrcweir Prepare_HeaderFooter_GraphicFrames = True 132cdf0e10cSrcweirFinalExit: 133cdf0e10cSrcweir Exit Function 134cdf0e10cSrcweir 135cdf0e10cSrcweirHandleErrors: 136cdf0e10cSrcweir WriteDebug currentFunctionName & " : " & docAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source 137cdf0e10cSrcweir Resume FinalExit 138cdf0e10cSrcweirEnd Function 139cdf0e10cSrcweir 140cdf0e10cSrcweir'Stub for Excel Prepare SheetName 141cdf0e10cSrcweirFunction Prepare_WorkbookVersion() As Boolean 142cdf0e10cSrcweir Prepare_WorkbookVersion = False 143cdf0e10cSrcweirEnd Function 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146