From b43f4c711e81d61677baacc34d63a5e694e408ed Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 16 May 2019 10:53:19 +0000 Subject: [PATCH] Added methods and properties needed for Importing Word Content --- PROMS/LBWordLibrary/LBComObject.cs | 108 +++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 12 deletions(-) diff --git a/PROMS/LBWordLibrary/LBComObject.cs b/PROMS/LBWordLibrary/LBComObject.cs index b6637e41..4b4f7688 100644 --- a/PROMS/LBWordLibrary/LBComObject.cs +++ b/PROMS/LBWordLibrary/LBComObject.cs @@ -87,15 +87,15 @@ namespace LBWordLibrary tmp.Item = InvokeMethod("Add"); return tmp; } - //public TItem this[int item] - //{ - // get - // { - // TItem tmp = new TItem(); - // tmp.Item = GetProperty("Item", item); - // return tmp; - // } - //} + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + // Get each item in a collection + public Object this[int item] + { + get + { + return InvokeMethod("Item", item);// Use Item Method to get an entry from an object list + } + } } public partial class LBApplicationClass : LBComObject { @@ -233,11 +233,33 @@ namespace LBWordLibrary } public LBTables Tables { - get { return new LBTables(GetProperty("Tables")); } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + get + { + try // added Try/Catch logic to allow a null to be returned. + { + return new LBTables(GetProperty("Tables")); + } + catch + { + return null; + } + } } public LBCells Cells { - get { return new LBCells(GetProperty("Cells")); } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + get + { + try // added Try/Catch logic to allow a null to be returned. + { + return new LBCells(GetProperty("Cells")); + } + catch + { + return null; + } + } } public LBRows Rows { @@ -526,9 +548,20 @@ namespace LBWordLibrary { get { return new LBColumns(GetProperty("Columns")); } } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content public LBCells Cells { - get { return new LBCells(GetProperty("Cells")); } + get + { + try // added Try/Catch logic to allow a null to be returned. + { + return new LBCells(GetProperty("Cells")); + } + catch(Exception ex) + { + return null; + } + } } public LBRange GoTo() { @@ -802,6 +835,19 @@ namespace LBWordLibrary { return new LBTable(InvokeMethod("Add", Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)); } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public int Count + { + get { return (GetProperty("Count") as int? ?? 0); } + } + public LBTable this[int item] + { + get + { // Get a Table from a list + return new LBTable(base[item]); + } + } + } public partial class LBCells : LBComObjectList /* Collection */ { @@ -819,6 +865,11 @@ namespace LBWordLibrary get { return (GetProperty("Height") as float? ?? 0); } set { SetProperty("Height", value); } } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public int Count + { + get { return (GetProperty("Count") as int? ?? 0); } + } public LBBorders Borders { get { return new LBBorders(GetProperty("Borders")); } @@ -831,6 +882,15 @@ namespace LBWordLibrary { InvokeMethod("Merge"); } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public LBCell this[int item] + { + get // Get a Cell from a List + { + return new LBCell(base[item]); + } + } + } public partial class LBRows : LBComObjectList /* Collection */ { @@ -843,6 +903,11 @@ namespace LBWordLibrary get { return (GetProperty("HeadingFormat") as int? ?? 0); } set { SetProperty("HeadingFormat", value); } } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public int Count + { + get { return (GetProperty("Count") as int? ?? 0); } + } public LBRow First { get { return new LBRow(GetProperty("First")); } @@ -1185,6 +1250,11 @@ namespace LBWordLibrary { public LBTable() { } public LBTable(Object item) : base(item) { } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public LBRange Range + { + get { return new LBRange(GetProperty("Range")); } + } public LBColumns Columns { get { return new LBColumns(GetProperty("Columns")); } @@ -1520,6 +1590,11 @@ namespace LBWordLibrary { public LBCell() { } public LBCell(Object item) : base(item) { } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public LBRange Range + { + get { return new LBRange(GetProperty("Range")); } + } public LBColumn Column { get { return new LBColumn(GetProperty("Column")); } @@ -1546,6 +1621,15 @@ namespace LBWordLibrary get { return (GetProperty("Width") as float? ?? 0); } set { SetProperty("Width", value); } } + // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content + public int RowIndex + { + get { return (GetProperty("RowIndex") as int? ?? 0); } + } + public int ColumnIndex + { + get { return (GetProperty("ColumnIndex") as int? ?? 0); } + } public LBTables Tables { get { return new LBTables(GetProperty("Tables")); }