Added New Word Properties and Methods

This commit is contained in:
Rich 2009-12-07 15:52:32 +00:00
parent c6e18d4fe7
commit 6d298bfbfd
2 changed files with 77 additions and 4 deletions

View File

@ -205,6 +205,10 @@ namespace LBWordLibrary
get { return (GetProperty("Start") as int? ?? 0); }
set { SetProperty("Start", value); }
}
public LBInlineShapes InlineShapes
{
get { return new LBInlineShapes(GetProperty("InlineShapes")); }
}
public void WholeStory()
{
InvokeMethod("WholeStory");
@ -229,6 +233,14 @@ namespace LBWordLibrary
{
InvokeMethod("Copy");
}
public int EndKey()
{
return InvokeMethod("EndKey", Missing.Value, Missing.Value) as int? ?? 0;
}
public int EndKey(object Unit, object Extend)
{
return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
}
}
public partial class LBDocumentClass : LBComObject
{
@ -471,6 +483,21 @@ namespace LBWordLibrary
wdInWordMail = 37,
wdInClipboard = 38
}
public partial class LBInlineShapes : LBComObjectList<LBInlineShapes, LBInlineShape> /* Collection */
{
public LBInlineShapes(Object item)
{
Item = item;
}
public LBInlineShape AddPicture(string FileName)
{
return new LBInlineShape(InvokeMethod("AddPicture", FileName, Missing.Value, Missing.Value, Missing.Value));
}
public LBInlineShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Range)
{
return new LBInlineShape(InvokeMethod("AddPicture", FileName, LinkToFile, SaveWithDocument, Range));
}
}
public enum LBWdExportFormat
{
wdExportFormatPDF = 17,
@ -635,6 +662,21 @@ namespace LBWordLibrary
wdColorWhite = 16777215,
wdColorAutomatic = -16777216
}
public partial class LBInlineShape : LBComObject
{
public LBInlineShape() { }
public LBInlineShape(Object item) : base(item) { }
public float Height
{
get { return (GetProperty("Height") as float? ?? 0); }
set { SetProperty("Height", value); }
}
public float Width
{
get { return (GetProperty("Width") as float? ?? 0); }
set { SetProperty("Width", value); }
}
}
public partial class LBPages : LBComObjectList<LBPages, LBPage> /* Collection */
{
public LBPages(Object item)

View File

@ -75,9 +75,35 @@ namespace LBWordLibrary
public string CreatePDF(string pdfFileName, bool openPDF)
{
pdfFileName = CreatePDF(pdfFileName);
if (openPDF) System.Diagnostics.Process.Start(pdfFileName);
if (openPDF) OpenPDF(pdfFileName);
return pdfFileName;
}
static List<System.Diagnostics.Process> _AcrobatProcesses=new List<System.Diagnostics.Process>();
private static void OpenPDF(string pdfFileName)
{
_AcrobatProcesses.Add(System.Diagnostics.Process.Start(pdfFileName));
}
public static void ClosePDFs()
{
foreach(System.Diagnostics.Process proc in _AcrobatProcesses)
if (!proc.HasExited)
KillAndWait(proc);
}
private static void KillAndWait(System.Diagnostics.Process proc)
{
Console.WriteLine("{0:s.ffff} Killing Adobe", DateTime.Now);
DateTime tStart = DateTime.Now;
proc.Kill();
DateTime tEnd = DateTime.Now.AddMilliseconds(100);
while (DateTime.Now < tEnd)
{
Application.DoEvents();
}
Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime
,TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds);
}
public string CreatePDF(string pdfFileName)
{
pdfFileName = AvailableFileName(pdfFileName);
@ -91,7 +117,7 @@ namespace LBWordLibrary
public string CreatePDF2003FG(string pdfFileName, bool openPDF)
{
pdfFileName = CreatePDF2003FG(pdfFileName);
if (openPDF) System.Diagnostics.Process.Start(pdfFileName);
if (openPDF) OpenPDF(pdfFileName);
return pdfFileName;
}
public string CreatePDF2003FG(string pdfFileName)
@ -120,7 +146,7 @@ namespace LBWordLibrary
public string CreatePDF2003BG(string pdfFileName, bool openPDF)
{
pdfFileName = CreatePDF2003BG(pdfFileName);
if (openPDF) System.Diagnostics.Process.Start(pdfFileName);
if (openPDF) OpenPDF(pdfFileName);
return pdfFileName;
}
public string CreatePDF2003BG(string pdfFileName)
@ -154,7 +180,7 @@ namespace LBWordLibrary
public string CreatePDF2007(string pdfFileName, bool openPDF)
{
pdfFileName = CreatePDF2007(pdfFileName);
if (openPDF) System.Diagnostics.Process.Start(pdfFileName);
if (openPDF) OpenPDF(pdfFileName);
return pdfFileName;
}
public string CreatePDF2007(string pdfFileName)
@ -252,5 +278,10 @@ namespace LBWordLibrary
{
return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
}
public int EndKey(LBWdUnits Unit, bool Extend)
{
return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
}
}
}