Esempio n. 1
0
 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;
     }
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
        public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result)
        {
            if (arguments.Count == 2)
            {
                double degree = arguments.GetNumber(1) * Math.PI / 180 * arguments.GetNumber(0);

                result.Text = degree.ToString();
            }
            else
            {
                result.Error = SpreadsheetGear.ValueError.Value;
            }
        }
Esempio n. 4
0
        public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result)
        {
            if (arguments.Count == 3)
            {
                string x = arguments.GetNumber(0).ToString();
                string y = arguments.GetNumber(1).ToString();
                string z = arguments.GetNumber(2).ToString();

                result.Text = x + ";" + y + ";" + z;
            }
            else
            {
                result.Error = SpreadsheetGear.ValueError.Value;
            }
        }
Esempio n. 5
0
 public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result)
 {
     if (arguments.Count == 2)
     {
         double number1 = arguments.GetNumber(0);
         double number2 = arguments.GetNumber(1);
         result.Text = "EQ2 " + number1.ToString() + "," + number2.ToString();
     }
     else
     {
         result.Error = SpreadsheetGear.ValueError.Value;
     }
 }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
 public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result)
 {
     if (arguments.Count == 6)
     {
         double number1 = arguments.GetNumber(0);
         double number2 = arguments.GetNumber(1);
         double number3 = arguments.GetNumber(2);
         double number4 = arguments.GetNumber(3);
         double number5 = arguments.GetNumber(4);
         double number6 = arguments.GetNumber(5);
         result.Text = "EQV " + number1.ToString() + "," + number2.ToString() + "," + number3.ToString() + "," + number4.ToString() + "," + number5.ToString() + "," + number6.ToString();
     }
     else if (arguments.Count == 4)
     {
         double number1 = arguments.GetNumber(0);
         double number2 = arguments.GetNumber(1);
         double number3 = arguments.GetNumber(2);
         double number4 = arguments.GetNumber(3);
         result.Text = string.Format("EQV {0},{1},{2},{3}", number1, number2, number3, number4);
     }
     else
     {
         result.Error = SpreadsheetGear.ValueError.Value;
     }
 }
Esempio n. 9
0
 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;
     }
 }
Esempio n. 10
0
 public override void Evaluate(SpreadsheetGear.CustomFunctions.IArguments arguments, SpreadsheetGear.CustomFunctions.IValue result)
 {
     result.Text = arguments.CurrentWorksheet.Workbook.Name;
 }