Added properties and methods

This commit is contained in:
Rich
2010-02-02 20:50:34 +00:00
parent b80775a454
commit 710cfee31d
2 changed files with 278 additions and 10 deletions

View File

@@ -19,6 +19,10 @@ namespace LBWordLibrary
{
InvokeMethod("PrintOut", Background, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
}
public void Quit(bool save)
{
InvokeMethod("Quit", save, Missing.Value, Missing.Value);
}
public bool VolianPDFInstalled
{
get
@@ -246,6 +250,34 @@ namespace LBWordLibrary
{
SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
}
public LBRange Range(int Start, int End)
{
return new LBRange(InvokeMethod("Range", Start, End));
}
/// <summary>
/// Length is Pages and Partial Pages
/// The integral part is the number of full pages
/// The decimal part is the size of the last page divided by 7200
/// (the first two digits should be the number of inches)
/// </summary>
public float Length
{
get
{
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.wdVerticalPositionRelativeToPage);
partial += myRange.Font.Size;
retval += partial / 7200;
return retval;
}
}
public void Close(bool SaveChanges)
{
InvokeMethod("Close", SaveChanges, Missing.Value, Missing.Value);
}
}
public partial class LBFind
{
@@ -264,6 +296,17 @@ namespace LBWordLibrary
set { SetProperty("Color", value); }
}
}
public partial class LBRange : LBComObject
{
public Object get_Information(LBWdInformation info)
{
return GetProperty("Information", info);
}
public LBRange GoTo(LBWdGoToItem What, LBWdGoToDirection Which, int Count)
{
return new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
}
}
public partial class LBSelection : LBComObject
{
public Object get_Information(LBWdInformation info)
@@ -282,6 +325,52 @@ namespace LBWordLibrary
{
return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
}
}
public partial class LBInlineShapes : LBComObjectList<LBInlineShapes, LBInlineShape> /* Collection */
{
public LBInlineShape AddPicture(string FileName, LBRange Range)
{
return new LBInlineShape(InvokeMethod("AddPicture", FileName, false, true, Range));
}
}
public partial class LBShapes : LBComObjectList<LBShapes, LBShape> /* Collection */
{
public LBShape AddPicture(string FileName, float Left, float Top, LBRange Anchor)
{
return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Anchor));
}
public LBShape AddPicture(string FileName, float Left, float Top)
{
return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Missing.Value));
}
}
public enum LBMsoTriState
{
msoCTrue = 1,
msoFalse = 0,
msoTriStateMixed = -2,
msoTriStateToggle = -3,
msoTrue = -1
}
//public partial class ProcessKiller
//{
// System.Diagnostics.Process _MyProcess;
// private bool _Exited = false;
// public ProcessKiller(System.Diagnostics.Process myProcess)
// {
// _MyProcess = myProcess;
// _MyProcess.Exited += new EventHandler(_MyProcess_Exited);
// _MyProcess.Kill();
// DateTime next = DateTime.Now.AddMilliseconds(200);
// while (DateTime.Now < next)
// Application.DoEvents();
// while (!_Exited)
// Application.DoEvents();
// }
// void _MyProcess_Exited(object sender, EventArgs e)
// {
// Console.WriteLine("Exited");
// _Exited = true;
// }
//}
}