public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result) { if (arguments.Count == 1) { string location = arguments.GetText(0); string parentname; string sheetname = arguments.CurrentWorksheet.ToString(); if (sheetname.Length > 2 && sheetname.Substring(0, 3) == "[S]") { parentname = "L!"; } else if (sheetname.Length > 2 && sheetname.Substring(0, 3) == "[N]") { parentname = "S!"; } else { parentname = "L!"; } result.Text = parentname + location; } else { result.Error = SpreadsheetGear.ValueError.Value; } }
public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result) { bool rs = true; string combinestring = ""; for (int i = 0; i < arguments.Count; i++) { string argu = arguments.GetText(i); char[] chars = argu.ToCharArray(); int number = 0; for (int p = 0; p < chars.Length; p++) { if (chars[p] == ';') { number++; } } if (number == 2) { if (i != arguments.Count - 1) { combinestring = combinestring + arguments.GetText(i) + "|"; } else { combinestring = combinestring + arguments.GetText(i); } } else { rs = false; break; } } if (rs) { result.Text = combinestring; } else { result.Error = SpreadsheetGear.ValueError.Value; } }
public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result) { if (arguments.Count == 2 || arguments.Count == 3) { string pipeline = arguments.GetText(1); string last = ""; int rowCount, columnCount; arguments.GetArrayDimensions(0, out rowCount, out columnCount); last = arguments.GetArrayValue(0, 0, 0).Text; for (int i = 1; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(0, i, 0); last = last + pipeline + value.Text; } result.Text = last; } else { result.Error = SpreadsheetGear.ValueError.Value; } }
public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result) { if (arguments.Count == 2) { string partname = arguments.GetText(1); int rowCount, columnCount; arguments.GetArrayDimensions(0, out rowCount, out columnCount); for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(0, i, 0); if (value.Text == partname) { result.Number = arguments.GetArrayValue(0, i, 4).Number; break; } } } else { result.Error = SpreadsheetGear.ValueError.Value; } }
public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result) { if (arguments.Count == 5 || arguments.Count == 4) { string partname = ""; int rowCount, columnCount; arguments.GetArrayDimensions(0, out rowCount, out columnCount); if (arguments.Count == 5) { partname = arguments.GetText(4); } else { for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(0, i, 0); if (arguments.CurrentRow == i) { partname = value.Text; break; } } } string MaterialName = ""; for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(0, i, 0); if (value.Text == partname) { MaterialName = arguments.GetArrayValue(0, i, 5).Text; break; } } if (MaterialName != "") { bool findit = false; if (!findit) { arguments.GetArrayDimensions(1, out rowCount, out columnCount); for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(1, i, 0); if (value.Text == MaterialName) { result.Number = arguments.GetArrayValue(1, i, 1).Number; findit = true; break; } } } if (!findit) { arguments.GetArrayDimensions(2, out rowCount, out columnCount); for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(2, i, 0); if (value.Text == MaterialName) { result.Number = arguments.GetArrayValue(2, i, 1).Number; findit = true; break; } } } if (!findit) { arguments.GetArrayDimensions(3, out rowCount, out columnCount); for (int i = 0; i < rowCount; i++) { SpreadsheetGear.CustomFunctions.IValue value = arguments.GetArrayValue(3, i, 0); if (value.Text == MaterialName) { result.Number = arguments.GetArrayValue(3, i, 1).Number; findit = true; break; } } } if (!findit) { result.Error = SpreadsheetGear.ValueError.Value; } } } else { result.Error = SpreadsheetGear.ValueError.Value; } }