示例#1
0
        private void HandleSingleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
        {
            int col, row;

            _addressTranslator.ToColAndRow(addressInfo.StartCell, out col, out row);
            rangeAddress.FromCol = col;
            rangeAddress.ToCol   = col;
            rangeAddress.FromRow = row;
            rangeAddress.ToRow   = row;
        }
 private void HandleMultipleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
 {
     int fromCol, fromRow;
     _addressTranslator.ToColAndRow(addressInfo.StartCell, out fromCol, out fromRow);
     int toCol, toRow;
     _addressTranslator.ToColAndRow(addressInfo.EndCell, out toCol, out toRow, AddressTranslator.RangeCalculationBehaviour.LastPart);
     rangeAddress.FromCol = fromCol;
     rangeAddress.ToCol = toCol;
     rangeAddress.FromRow = fromRow;
     rangeAddress.ToRow = toRow;
 }
示例#3
0
        private void HandleMultipleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
        {
            int fromCol, fromRow;

            _addressTranslator.ToColAndRow(addressInfo.StartCell, out fromCol, out fromRow);
            int toCol, toRow;

            _addressTranslator.ToColAndRow(addressInfo.EndCell, out toCol, out toRow, AddressTranslator.RangeCalculationBehaviour.LastPart);
            rangeAddress.FromCol = fromCol;
            rangeAddress.ToCol   = toCol;
            rangeAddress.FromRow = fromRow;
            rangeAddress.ToRow   = toRow;
        }
示例#4
0
        public RangeAddress Create(string range)
        {
            Require.That(range).Named("range").IsNotNullOrEmpty();
            var addressInfo  = ExcelAddressInfo.Parse(range);
            var rangeAddress = new RangeAddress()
            {
                Address   = range,
                Worksheet = addressInfo.Worksheet
            };

            if (addressInfo.IsMultipleCells)
            {
                HandleMultipleCellAddress(rangeAddress, addressInfo);
            }
            else
            {
                HandleSingleCellAddress(rangeAddress, addressInfo);
            }
            return(rangeAddress);
        }
 private void SetCurrentWorksheet(ExcelAddressInfo addressInfo)
 {
     if (addressInfo.WorksheetIsSpecified)
     {
         _currentWorksheet = _package.Workbook.Worksheets[addressInfo.Worksheet];
     }
     else if (_currentWorksheet == null)
     {
         _currentWorksheet = _package.Workbook.Worksheets.First();
     }
 }
 private void HandleSingleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
 {
     int col, row;
     _addressTranslator.ToColAndRow(addressInfo.StartCell, out col, out row);
     rangeAddress.FromCol = col;
     rangeAddress.ToCol = col;
     rangeAddress.FromRow = row;
     rangeAddress.ToRow = row;
 }