コード例 #1
0
 public void ColumnIndexToLabel()
 {
     Assert.AreEqual(SheetReference.ColumnIndex2Label(247), "IM");
     Assert.AreEqual(SheetReference.ColumnIndex2Label(233), "HY");
     Assert.AreEqual(SheetReference.ColumnIndex2Label(226), "HR");
     Assert.AreEqual(SheetReference.ColumnIndex2Label(702), "ZZ");
     Assert.AreEqual(SheetReference.ColumnIndex2Label(515), "SU");
     Assert.AreEqual(SheetReference.ColumnIndex2Label(285), "JY");
 }
コード例 #2
0
        public void CheckSheetReference()
        {
            _formulaEngine.ResetParser();
            Formula       f    = _formulaEngine.CreateFormula("=IF(Outputs!Z50<>0;TRUE;FALSE)");
            CellReference cell = (CellReference)f.References[0];

            Assert.AreEqual(cell.Sheet.Name, "Outputs");
            Assert.AreEqual(SheetReference.ColumnIndex2Label(cell.ColumnIndex), "Z");
            Assert.AreEqual(cell.RowIndex, 50);
        }
コード例 #3
0
 /// <summary>
 ///     Gets the label for a column index
 /// </summary>
 /// <param name="columnIndex">The index whose label you wish to get</param>
 /// <returns>A string with the colum label</returns>
 /// <remarks>This function is handy when you have a column index and you want to get its associated label.</remarks>
 /// <example>
 ///     <list type="table">
 ///         <listheader>
 ///             <term>Column index</term><description>Resultant label</description>
 ///         </listheader>
 ///         <item>
 ///             <term>1</term><description>"A"</description>
 ///         </item>
 ///         <item>
 ///             <term>14</term><description>"N"</description>
 ///         </item>
 ///         <item>
 ///             <term>123</term><description>"DS"</description>
 ///         </item>
 ///         <item>
 ///             <term>256</term><description>"IV"</description>
 ///         </item>
 ///     </list>
 /// </example>
 public static string ColumnIndex2Label(int columnIndex)
 {
     return(SheetReference.ColumnIndex2Label(columnIndex));
 }