Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PausableBasicAlgorithm/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/AddressUtility.cs @ 13401

Last change on this file since 13401 was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 1000 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Text.RegularExpressions;
6
7namespace OfficeOpenXml.Utils
8{
9    public static class AddressUtility
10    {
11        public static string ParseEntireColumnSelections(string address)
12        {
13            string parsedAddress = address;
14            var matches = Regex.Matches(address, "[A-Z]+:[A-Z]+");
15            foreach (Match match in matches)
16            {
17                AddRowNumbersToEntireColumnRange(ref parsedAddress, match.Value);
18            }
19            return parsedAddress;
20        }
21
22        private static void AddRowNumbersToEntireColumnRange(ref string address, string range)
23        {
24            var parsedRange = string.Format("{0}{1}", range, ExcelPackage.MaxRows);
25            var splitArr = parsedRange.Split(new char[] { ':' });
26            address = address.Replace(range, string.Format("{0}1:{1}", splitArr[0], splitArr[1]));
27        }
28    }
29}
Note: See TracBrowser for help on using the repository browser.