Commit for development environment setup
This commit is contained in:
@@ -389,43 +389,21 @@ namespace LBWordLibrary
|
||||
LBPages myPages = ActiveWindow.ActivePane.Pages;// Start with pages
|
||||
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);
|
||||
|
||||
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0);
|
||||
float mytop = myRange.PageSetup.TopMargin;
|
||||
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
|
||||
//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) - GetTopMargin(myRange); // B2019-169 added function to get top margin
|
||||
float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - mytop;
|
||||
partial += myRange.Font.Size;
|
||||
retval += partial / 7200;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
// B2019-169
|
||||
// Would sometimes not return the top margin from Word. We added a Try/Catch and attempt an alternative way doing this, else we log an error and return a zero top margin
|
||||
public float GetTopMargin (LBRange myRange)
|
||||
{
|
||||
try
|
||||
{
|
||||
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
|
||||
return myRange.PageSetup.TopMargin;
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0);
|
||||
float tpmar = myRange.PageSetup.TopMargin;
|
||||
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
|
||||
return tpmar;
|
||||
}
|
||||
catch
|
||||
{
|
||||
_MyLog.ErrorFormat("Unable to read Top Margin");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Ascii
|
||||
{
|
||||
get
|
||||
@@ -840,25 +818,6 @@ namespace LBWordLibrary
|
||||
{
|
||||
return new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
|
||||
}
|
||||
// B2022-088: Find Doc Ro button not working in Word Sections
|
||||
public bool LastWasUpper
|
||||
{
|
||||
get
|
||||
{
|
||||
int start = this.Start - 1;
|
||||
|
||||
while (start >= 0)
|
||||
{
|
||||
this.Start = start;
|
||||
this.End = start + 1;
|
||||
string previous = LBDocumentClass.GetRangeText(this);
|
||||
if (Regex.IsMatch(previous, "[A-Z]")) return true;
|
||||
if (Regex.IsMatch(previous, "[a-z]")) return false;
|
||||
start = start - 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class LBSelection : LBComObject
|
||||
{
|
||||
|
Reference in New Issue
Block a user