B2018-028 MS Word2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word. We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page.

This commit is contained in:
John Jenko 2018-02-19 17:04:27 +00:00
parent d257fbe856
commit 9355ead6ef
2 changed files with 13 additions and 1 deletions

View File

@ -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")); }

View File

@ -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;