Added Error Handling code

Added a new parameter to SaveSectionDocument and Error Handling
Changed error handling for InvokeMember to throw an exception
Added code to change the view to PrintMode when determining length
This commit is contained in:
Rich
2010-04-21 20:55:28 +00:00
parent 1741b0e3e0
commit 2c14e4113b
4 changed files with 43 additions and 22 deletions

View File

@@ -42,15 +42,7 @@ namespace LBWordLibrary
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("{0}.{1} {2} - {3}", _MyType.Name, name, bf.ToString(), ex.GetType().Name));
string prefix = "\r\n ";
do
{
sb.Append(prefix + ex.Message);
ex = ex.InnerException;
} while (ex != null);
Console.WriteLine(sb.ToString());
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex);
}
return null;
}

View File

@@ -263,6 +263,8 @@ namespace LBWordLibrary
{
get
{
ActiveWindow.ActivePane.View.Type = LBWdViewType.wdPrintView;
ActiveWindow.View.Type = LBWdViewType.wdPrintView;
LBPages myPages = ActiveWindow.ActivePane.Pages;// Start with pages
float retval = (float)myPages.Count - 1;
LBRange myRange = Range();
@@ -485,7 +487,7 @@ namespace LBWordLibrary
string previous = LBDocumentClass.GetRangeText(myRange);
if (Regex.IsMatch(previous, "[A-Z]")) return true;
if (Regex.IsMatch(previous, "[a-z]")) return false;
start = start - 1;
start = start - 1;
}
return false;
}