コード例 #1
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;
        }
コード例 #2
0
ファイル: XLRangeColumn.cs プロジェクト: zhoushlu/ClosedXML
        public IXLRangeColumns Columns(string columns)
        {
            var retVal   = new XLRangeColumns();
            var rowPairs = columns.Split(',');

            foreach (string trimmedPair in rowPairs.Select(pair => pair.Trim()))
            {
                string firstRow;
                string lastRow;
                if (trimmedPair.Contains(':') || trimmedPair.Contains('-'))
                {
                    var rowRange = trimmedPair.Contains('-')
                                       ? trimmedPair.Replace('-', ':').Split(':')
                                       : trimmedPair.Split(':');

                    firstRow = rowRange[0];
                    lastRow  = rowRange[1];
                }
                else
                {
                    firstRow = trimmedPair;
                    lastRow  = trimmedPair;
                }

                retVal.Add(Range(firstRow, lastRow).FirstColumn());
            }

            return(retVal);
        }
コード例 #3
0
        public virtual IXLRangeColumns Columns(Int32 firstColumn, Int32 lastColumn)
        {
            var retVal = new XLRangeColumns();

            for (int co = firstColumn; co <= lastColumn; co++)
                retVal.Add(Column(co));
            return retVal;
        }
コード例 #4
0
        public virtual IXLRangeColumns Columns(Int32 firstColumn, Int32 lastColumn)
        {
            var retVal = new XLRangeColumns();

            for (int co = firstColumn; co <= lastColumn; co++)
            {
                retVal.Add(Column(co));
            }
            return(retVal);
        }
コード例 #5
0
        public IXLRangeColumns Columns(String columns)
        {
            var retVal      = new XLRangeColumns();
            var columnPairs = columns.Split(',');

            foreach (string pair in columnPairs)
            {
                AsRange().Columns(pair.Trim()).ForEach(retVal.Add);
            }
            return(retVal);
        }
コード例 #6
0
ファイル: XLRange.cs プロジェクト: hal1932/ClosedXML
 public IXLRangeColumns Columns(Func<IXLRangeColumn, Boolean> predicate = null)
 {
     var retVal = new XLRangeColumns();
     Int32 columnCount = ColumnCount();
     for (Int32 c = 1; c <= columnCount; c++)
     {
         var column = Column(c);
         if (predicate == null || predicate(column))
             retVal.Add(column);
         else
             column.Dispose();
     }
     return retVal;
 }
コード例 #7
0
        public virtual IXLRangeColumns Columns(Func <IXLRangeColumn, Boolean> predicate = null)
        {
            var   retVal      = new XLRangeColumns();
            Int32 columnCount = ColumnCount();

            for (Int32 c = 1; c <= columnCount; c++)
            {
                var column = Column(c);
                if (predicate == null || predicate(column))
                {
                    retVal.Add(column);
                }
            }
            return(retVal);
        }
コード例 #8
0
        public virtual XLRangeColumns ColumnsUsed(Boolean includeFormats, Func <IXLRangeColumn, Boolean> predicate = null)
        {
            XLRangeColumns columns     = new XLRangeColumns();
            Int32          columnCount = ColumnCount();

            for (Int32 co = 1; co <= columnCount; co++)
            {
                var column = Column(co);

                if (!column.IsEmpty(includeFormats) && (predicate == null || predicate(column)))
                {
                    columns.Add(column);
                }
            }
            return(columns);
        }
コード例 #9
0
        internal virtual XLRangeColumns ColumnsUsed(XLCellsUsedOptions options, Func <IXLRangeColumn, Boolean> predicate = null)
        {
            XLRangeColumns columns     = new XLRangeColumns();
            Int32          columnCount = ColumnCount();

            for (Int32 co = 1; co <= columnCount; co++)
            {
                var column = Column(co);

                if (!column.IsEmpty(options) && (predicate == null || predicate(column)))
                {
                    columns.Add(column);
                }
            }
            return(columns);
        }
コード例 #10
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);
        }
コード例 #11
0
ファイル: XLRange.cs プロジェクト: hal1932/ClosedXML
        public XLRangeColumns ColumnsUsed(Boolean includeFormats, Func<IXLRangeColumn, Boolean> predicate = null)
        {
            XLRangeColumns columns = new XLRangeColumns();
            Int32 columnCount = ColumnCount();
            for (Int32 co = 1; co <= columnCount; co++)
            {
                var column = Column(co);

                if (!column.IsEmpty(includeFormats) && (predicate == null || predicate(column)))
                    columns.Add(column);
                else
                    column.Dispose();
            }
            return columns;
        }
コード例 #12
0
ファイル: XLRangeColumn.cs プロジェクト: hal1932/ClosedXML
        public IXLRangeColumns Columns(string columns)
        {
            var retVal = new XLRangeColumns();
            var rowPairs = columns.Split(',');
            foreach (string trimmedPair in rowPairs.Select(pair => pair.Trim()))
            {
                string firstRow;
                string lastRow;
                if (trimmedPair.Contains(':') || trimmedPair.Contains('-'))
                {
                    var rowRange = trimmedPair.Contains('-')
                                       ? trimmedPair.Replace('-', ':').Split(':')
                                       : trimmedPair.Split(':');

                    firstRow = rowRange[0];
                    lastRow = rowRange[1];
                }
                else
                {
                    firstRow = trimmedPair;
                    lastRow = trimmedPair;
                }

                retVal.Add(Range(firstRow, lastRow).FirstColumn());
            }

            return retVal;
        }
コード例 #13
0
 public IXLRangeColumns Columns(String columns)
 {
     var retVal = new XLRangeColumns();
     var columnPairs = columns.Split(',');
     foreach (string pair in columnPairs)
         using (var asRange = AsRange())
             asRange.Columns(pair.Trim()).ForEach(retVal.Add);
     return retVal;
 }