diff --git a/PROMS/LBWordLibrary/LBComObject.cs b/PROMS/LBWordLibrary/LBComObject.cs index e0e527c2..212f1114 100644 --- a/PROMS/LBWordLibrary/LBComObject.cs +++ b/PROMS/LBWordLibrary/LBComObject.cs @@ -470,6 +470,13 @@ namespace LBWordLibrary { public LBRange() { } public LBRange(Object item) : base(item) { } + // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word. + // We now need to calculated the last row of text in the PROMS attachment differently. + // We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page (Lenght in LBObjectExtension.cs) + public LBPageSetup PageSetup + { + get { return new LBPageSetup(GetProperty("PageSetup")); } + } public LBFontClass Font { get { return new LBFontClass(GetProperty("Font")); } diff --git a/PROMS/LBWordLibrary/LBObjectExtension.cs b/PROMS/LBWordLibrary/LBObjectExtension.cs index c9ccba15..ca093c13 100644 --- a/PROMS/LBWordLibrary/LBObjectExtension.cs +++ b/PROMS/LBWordLibrary/LBObjectExtension.cs @@ -390,7 +390,12 @@ namespace LBWordLibrary float retval = (float)myPages.Count - 1; LBRange myRange = Range(); myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100); - float partial = (float) myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); + //float partial = (float) myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); + // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word. + // We now need to calculated the last row of text in the PROMS attachment differently. + // We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page + // this works with older versions of MS Word as well. + float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - myRange.PageSetup.TopMargin; partial += myRange.Font.Size; retval += partial / 7200; return retval;