![]() |
#1
|
|||
|
|||
![]() Hello and Greetings, I am developing a program in python using (pywin32) and using msword 2007 for automatically adjsting formatting for paragraphs based on its attributes. For which i require postion of paragraph.range. I am using paragraph.range.information(wdverticalpositionrela tivetopage) but it is not accurate because it is returning the correct position for page one and returning 72.5 for every paragraph in second page with few exceptions. I would like to know if there are other ways to access vertical and horizontal positions? |
#2
|
||||
|
||||
![]()
Without seeing your code, no-one will be able to help you. Besides which, this forum is for VBA, not python, and I don't know how often people proficient in python visit this page.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
First of all Thank you for replying.
I was using the following code to test the vertical Position but it returned correct position of paragraphs for one page and returned 72.5 for all paragraphs of another page and also got the same result from python code. I also discovered that when a cell of a table is selected and Selection.Range.Information(wdVerticalPositionRela tiveToPage) is executed than also wdVerticalPositionRelativeToPage would give position relative to that table and not page. So, I was wondering that is there something that i am missing or is it a bug? Code:
Sub GetParagraphVerticalPositionsWithSelection() Dim para As paragraph Dim vertPos As Single For Each para In ActiveDocument.Paragraphs para.Range.Select vertPos = Selection.Range.Information(wdVerticalPositionRelativeToPage) Debug.Print ("Paragraph: " & para.Range.text & "Vertical Position: " & vertPos) Next para End Sub |
#4
|
||||
|
||||
![]()
There is no need to select anything. For example:
Code:
Sub GetParagraphVerticalPositions() Dim para As Paragraph, vertPos As Single For Each para In ActiveDocument.Paragraphs vertPos = para.Range.Information(wdVerticalPositionRelativeToPage) MsgBox ("Paragraph: " & para.Range.Text & "Vertical Position: " & vertPos) Next para End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Thank you Paul.... The problem seems to be in my document rather than word.
|
![]() |
Tags |
vertical postion |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why my watermark are placed in different positions in some pages? | shanlau | Word VBA | 2 | 12-04-2018 01:51 AM |
Page numbers in different positions | NugentS | Word | 3 | 12-04-2018 01:24 AM |
Visio Pro 2016: Measuring the total length of a series of interconnected lines | busander | Visio | 3 | 07-11-2017 09:53 AM |
Measuring Turnaround Time | quirkycanuck | Outlook | 0 | 03-03-2015 01:22 PM |
Using MSWord 2003 docs in MSWord 2010 | Joe Watson | Word | 7 | 05-31-2014 11:27 AM |