コード例 #1
0
        /// <summary>Get the Reference point.</summary>
        /// <param name="data">The data.</param>
        /// <param name="findValue">The find value.</param>
        /// <param name="compare">The compare formula to use.</param>
        /// <param name="returnType">Specify what should be returned.</param>
        /// <returns></returns>
        public List <string> Find(pcExcelData_ data, string findValue = "|->", enExcel_Compare compare = enExcel_Compare.Contains, enExcel_FindReturnValue returnType = enExcel_FindReturnValue.CellValue)
        {
            var result = new List <string>();
            int rowNo  = 1;

            foreach (List <string> row in data.Rows)
            {
                var colNo = 1;
                foreach (string item in row)
                {
                    bool found = false;
                    if (compare == enExcel_Compare.Contains)
                    {
                        if (item.Contains(findValue))
                        {
                            found = true;
                        }
                    }
                    else if (item == findValue)
                    {
                        found = true;
                    }

                    if (found)
                    {
                        if (returnType == enExcel_FindReturnValue.CellValue)
                        {
                            result.Add(item);
                        }
                        else
                        {
                            result.Add(CellAddress(colNo, rowNo));
                        }
                    }
                    colNo++;
                }
                rowNo++;
            }
            return(result);
        }
コード例 #2
0
        ///// <summary>Gets all the cells that contain's |V>|.</summary>
        ///// <param name="data">The data.</param>
        ///// <returns></returns>
        //public List<string> Compile_DownLeftCells(ExcelData_ data)
        //{
        //    return Find(data, "|V>|", enExcelCompare.Equal, enExcelFindReturnValue.CellAddress);

        //    //var result = new List<string>();
        //    //var rowNo = 1;
        //    //foreach (List<string> row in data.Rows)
        //    //{
        //    //    var colNo = 1;
        //    //    foreach (string cell in row)
        //    //    {
        //    //        if (cell == "|V>|")
        //    //        {
        //    //            var address = CellAddress(colNo, rowNo, false);  // Todo: fix this macro to do everything
        //    //            result.Add(address);
        //    //        }
        //    //        colNo++;
        //    //    }
        //    //    rowNo++;
        //    //}
        //    //return result;
        //}

        /// <summary>Finds the first occurance.</summary>
        /// <param name="data">The data.</param>
        /// <param name="result">The result.</param>
        /// <param name="findValue">The find value.</param>
        /// <param name="compare">The compare formula to use.</param>
        /// <param name="returnType">Type of the return.</param>
        /// <returns></returns>
        public bool Find_First(pcExcelData_ data, out string result, string findValue = "|->", enExcel_Compare compare = enExcel_Compare.Contains,
                               enExcel_FindReturnValue returnType = enExcel_FindReturnValue.CellValue)
        {
            result = "";
            var findList = Find(data, findValue, compare, returnType);

            if (findList.Count == 0)
            {
                return(false);
            }

            result = findList[0];
            return(true);
        }
コード例 #3
0
ファイル: pcExcelData_.cs プロジェクト: LouwrensP/LamedalCore
 /// <summary>Finds the first occurance.</summary>
 /// <param name="result">The result.</param>
 /// <param name="findValue">The find value.</param>
 /// <param name="compare">The compare.</param>
 /// <param name="returnType">Type of the return.</param>
 /// <returns></returns>
 public bool Find_First(out string result, string findValue = "|->",
                        enExcel_Compare compare             = enExcel_Compare.Contains,
                        enExcel_FindReturnValue returnType  = enExcel_FindReturnValue.CellValue)
 {
     return(_lamed.lib.Excel.Adress.Find_First(this, out result, findValue, compare, returnType));
 }
コード例 #4
0
ファイル: pcExcelData_.cs プロジェクト: LouwrensP/LamedalCore
 public List <string> Find(string findValue = "|->", enExcel_Compare compare = enExcel_Compare.Contains,
                           enExcel_FindReturnValue returnType = enExcel_FindReturnValue.CellValue)
 {
     return(_lamed.lib.Excel.Adress.Find(this, findValue, compare, returnType));
 }