コード例 #1
0
 /// <summary>
 /// Attempts to write an object to a range of cells defined by the various output-related state values
 /// of this ProjectInvocationRule.
 /// </summary>
 /// <remarks>
 /// If the object is enumerable, its enumerated values are written.
 /// </remarks>
 /// <exception cref="System.InvalidOperationException">The UsesOutput property value is false.</exception>
 public void WriteOutputData(object data)
 {
     if (!UsesOutput) {
         throw new InvalidOperationException();
     }
     var v = new CellRangeValidator(OutputCellRange, m_nrProvider);
     Excel.Worksheet ws = GetSheetByKey(m_outputSheetKey);
     Excel.Range r = v.GetRange(ws);
     IEnumerable e = data as IEnumerable;
     if (e == null || e is string) {
         ws.Cells[r.Row, r.Column] = data;
     }
     else {
         Helper.SetRangeValues(e.Cast<object>(), r, OutputRangeOrder);
     }
 }
コード例 #2
0
 /// <summary>
 /// Returns a value indicating whether this ProjectInvocationRule is in a valid state.
 /// </summary>
 private bool DetermineValidity()
 {
     if (UsesInput) {
         Excel.Worksheet ws = GetSheetByKey(m_inputSheetKey);
         if (ws == null) {
             return false;
         }
         var v = new CellRangeValidator(InputCellRange, m_nrProvider);
         if (!v.IsValid) {
             return false;
         }
     }
     if (UsesOutput) {
         Excel.Worksheet ws = GetSheetByKey(m_outputSheetKey);
         if (ws == null) {
             return false;
         }
         var v = new CellRangeValidator(OutputCellRange, m_nrProvider);
         if (!v.IsValid) {
             return false;
         }
     }
     if (!PathIsValid(ProjectPath)) {
         return false;
     }
     return true;
 }
コード例 #3
0
 /// <summary>
 /// Reads a collection of values from cells in the input range of the selected input data worksheet, 
 /// sequenced in accordance with the input range ordering value.
 /// </summary>
 /// <returns>A collection of cell values.</returns>
 /// <exception cref="System.InvalidOperationException">Either the UsesInput property value is 
 /// false or this ProjectInvocationRule is not in a valid state.</exception>
 public IEnumerable<object> ReadInputData()
 {
     if (!UsesInput || !IsValid) {
         throw new InvalidOperationException();
     }
     var v = new CellRangeValidator(InputCellRange, m_nrProvider);
     Excel.Worksheet ws = GetSheetByKey(m_inputSheetKey);
     Excel.Range r = v.GetRange(ws);
     return Helper.GetRangeValues(r, InputRangeOrder);
 }