Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/15 12:07:08 (9 years ago)
Author:
mkommend
Message:

#2341: Merged all EPPlus changes into stable.

Location:
stable
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.ExtLibs

  • stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3

    • Property svn:ignore set to
      obj
      bin
  • stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellBase.cs

    r12074 r12707  
    481481            return GetRowCol(address, out row, out col, throwException, out fixedRow, out fixedCol);
    482482        }
    483         internal static bool GetRowCol(string address, out int row, out int col, bool throwException, out bool fixedRow, out bool fixedCol)
    484         {
     483        internal static bool GetRowCol(string address, out int row, out int col, bool throwException, out bool fixedRow, out bool fixedCol) {
    485484            bool colPart = true;
    486             string sRow = "", sCol = "";
     485            int colStartIx = 0;
     486            int colLength = 0;
    487487            col = 0;
     488            row = 0;
    488489            fixedRow = false;
    489490            fixedCol = false;
    490             if (address.IndexOf(':') > 0)  //If it is a mult-cell address use
    491             {
    492                 address = address.Substring(0, address.IndexOf(':'));
    493             }
     491
    494492            if (address.EndsWith("#REF!"))
    495493            {
     
    502500            if (sheetMarkerIndex >= 0)
    503501            {
    504                 address = address.Substring(sheetMarkerIndex + 1);
    505             }
    506 
    507             address = address.ToUpper(CultureInfo.InvariantCulture);
    508             for (int i = 0; i < address.Length; i++)
    509             {
    510                 if ((address[i] >= 'A' && address[i] <= 'Z') && colPart && sCol.Length <= 3)
    511                 {
    512                     sCol += address[i];
    513                 }
    514                 else if (address[i] >= '0' && address[i] <= '9')
    515                 {
    516                     sRow += address[i];
     502                colStartIx = sheetMarkerIndex + 1;
     503            }
     504
     505            for (int i = colStartIx; i < address.Length; i++)
     506            {
     507                char c = address[i];
     508                if (colPart && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) && colLength <= 3)
     509                {
     510                    col *= 26;
     511                    col += ((int)c) - 64;
     512                    colLength++;
     513                }
     514                else if (c >= '0' && c <= '9')
     515                {
     516                    row *= 10;
     517                    row += ((int)c) - 48;
    517518                    colPart = false;
    518519                }
    519                 else if (address[i] == '$')
    520                 {
    521                     if (i == 0)
    522                         fixedCol = true;
    523                     else
     520                else if (c == '$')
     521                {
     522                    if (i == colStartIx)
     523                    {
     524                        colStartIx++;
     525                        fixedCol = true;
     526                    }
     527                    else
     528                    {
     529                        colPart = false;
    524530                        fixedRow = true;
    525                 }
    526                 else
    527                 {
     531                    }
     532                }
     533                else if (c == ':')
     534                {
     535                    break;
     536                }
     537                else
     538                {
     539                    row = 0;
     540                    col = 0;
    528541                    if (throwException)
    529542                    {
     
    532545                    else
    533546                    {
    534                         row = 0;
    535                         col = 0;
    536547                        return false;
    537548                    }
    538549                }
    539550            }
    540 
    541             // Get the column number
    542             if (sCol != "")
    543             {
    544                 col = GetColumn(sCol);
    545             }
    546             else
    547             {
    548                 col = 0;
    549                 int.TryParse(sRow, out row);
    550                 return row>0;
    551             }
    552             // Get the row number
    553             if (sRow == "") //Blank, fullRow
    554             {
    555                 //if (throwException)
    556                 //{
    557                 //    throw (new Exception(string.Format("Invalid Address format {0}", address)));
    558                 //}
    559                 //else
    560                 //{                   
    561                 row = 0;
    562                 return col > 0;
    563                 //}
    564             }
    565             else
    566             {
    567                 return int.TryParse(sRow, out row);
    568             }
     551            return row != 0 || col != 0;
    569552        }
    570553
Note: See TracChangeset for help on using the changeset viewer.