コード例 #1
0
        /// <summary>
        /// 스프레드에서 원하는 값을 가지 row를 찾는다.
        /// </summary>
        /// <param name="fp"></param>
        /// <param name="intSheetIndex"></param>
        /// <param name="strSearchText"></param>
        /// <returns></returns>
        public static int[] SearchData(FarPoint.Win.Spread.FpSpread fp, int intSheetIndex, string strSearchText)
        {
            Dictionary <int, int> q = new Dictionary <int, int>();
            int x = 0;
            int y = 0;

            while (y != -1)
            {
                fp.Search(intSheetIndex, strSearchText, false, false, false, true, y, x, ref y, ref x);

                if (y == -1)
                {
                    break;
                }


                if (y != -1 && !q.ContainsKey(y))
                {
                    q.Add(y, y);
                }


                if (x >= fp.Sheets[intSheetIndex].Columns.Count - 1)
                {
                    if (y >= fp.Sheets[intSheetIndex].Rows.Count - 1)
                    {
                        break;
                    }
                    else
                    {
                        x = 0;
                        y++;
                    }
                }
                else
                {
                    x++;
                }
            }

            int[] intRows = new int[q.Count];

            y = 0;
            foreach (object intRow in q.Values)
            {
                intRows[y] = (int)intRow;
                y++;
            }


            return(intRows);
        }