Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/SqRefUtility.cs @ 13329

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

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 1.3 KB
RevLine 
[12074]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Text.RegularExpressions;
6
7namespace OfficeOpenXml.Utils
8{
9    /// <summary>
10    /// Class for handling translation between ExcelAddresses and sqref addresses.
11    /// </summary>
12    public static class SqRefUtility
13    {
14       /// <summary>
15       /// Transforms an address to a valid sqRef address.
16       /// </summary>
17       /// <param name="address">The address to transform</param>
18       /// <returns>A valid SqRef address</returns>
19       public static string ToSqRefAddress(string address)
20       {
21           Require.Argument(address).IsNotNullOrEmpty(address);
22           address = address.Replace(",", " ");
23           address = new Regex("[ ]+").Replace(address, " ");
24           return address;
25       }
26
27       /// <summary>
28       /// Transforms an sqRef address into a excel address
29       /// </summary>
30       /// <param name="address">The address to transform</param>
31       /// <returns>A valid excel address</returns>
32       public static string FromSqRefAddress(string address)
33       {
34           Require.Argument(address).IsNotNullOrEmpty(address);
35           address = address.Replace(" ", ",");
36           return address;
37       }
38    }
39}
Note: See TracBrowser for help on using the repository browser.