Esempio n. 1
0
        public IXLRangeRows Rows(String rows)
        {
            var retVal   = new XLRangeRows();
            var rowPairs = rows.Split(',');

            foreach (string tPair in rowPairs.Select(pair => pair.Trim()))
            {
                String firstRow;
                String lastRow;
                if (tPair.Contains(':') || tPair.Contains('-'))
                {
                    string[] rowRange = XLHelper.SplitRange(tPair);

                    firstRow = rowRange[0];
                    lastRow  = rowRange[1];
                }
                else
                {
                    firstRow = tPair;
                    lastRow  = tPair;
                }
                foreach (IXLRangeRow row in Rows(Int32.Parse(firstRow), Int32.Parse(lastRow)))
                {
                    retVal.Add(row);
                }
            }
            return(retVal);
        }
Esempio n. 2
0
        public IXLRangeColumns Columns(String columns)
        {
            var retVal      = new XLRangeColumns();
            var columnPairs = columns.Split(',');

            foreach (string tPair in columnPairs.Select(pair => pair.Trim()))
            {
                String firstColumn;
                String lastColumn;
                if (tPair.Contains(':') || tPair.Contains('-'))
                {
                    string[] columnRange = XLHelper.SplitRange(tPair);

                    firstColumn = columnRange[0];
                    lastColumn  = columnRange[1];
                }
                else
                {
                    firstColumn = tPair;
                    lastColumn  = tPair;
                }

                Int32 tmp;
                if (Int32.TryParse(firstColumn, out tmp))
                {
                    foreach (IXLRangeColumn col in Columns(Int32.Parse(firstColumn), Int32.Parse(lastColumn)))
                    {
                        retVal.Add(col);
                    }
                }
                else
                {
                    foreach (IXLRangeColumn col in Columns(firstColumn, lastColumn))
                    {
                        retVal.Add(col);
                    }
                }
            }
            return(retVal);
        }