/// <summary> /// Get the width of the specified column. /// </summary> /// <param name="Unit">The unit of the width to be returned.</param> /// <param name="ColumnName">The column name, such as "A".</param> /// <returns>The width in the specified unit type.</returns> public double GetWidth(SLMeasureUnitTypeValues Unit, string ColumnName) { int iColumnIndex = -1; iColumnIndex = SLTool.ToColumnIndex(ColumnName); return(this.GetWidth(Unit, iColumnIndex, iColumnIndex)); }
/// <summary> /// Get the width of the specified columns. /// </summary> /// <param name="Unit">The unit of the width to be returned.</param> /// <param name="StartColumnName">The column name of the start column.</param> /// <param name="EndColumnName">The column name of the end column.</param> /// <returns>The width in the specified unit type.</returns> public double GetWidth(SLMeasureUnitTypeValues Unit, string StartColumnName, string EndColumnName) { int iStartColumnIndex = -1; int iEndColumnIndex = -1; iStartColumnIndex = SLTool.ToColumnIndex(StartColumnName); iEndColumnIndex = SLTool.ToColumnIndex(EndColumnName); return(this.GetWidth(Unit, iStartColumnIndex, iEndColumnIndex)); }
/// <summary> /// Sort data by column. /// </summary> /// <param name="StartCellReference">The cell reference of the start cell of the cell range to be sorted, such as "A1". This is typically the top-left cell.</param> /// <param name="EndCellReference">The cell reference of the end cell of the cell range to be sorted, such as "A1". This is typically the bottom-right cell.</param> /// <param name="SortByColumnName">The column name of the column to be sorted by, such as "AA".</param> /// <param name="SortAscending">True to sort in ascending order. False to sort in descending order.</param> public void Sort(string StartCellReference, string EndCellReference, string SortByColumnName, bool SortAscending) { int iStartRowIndex = -1; int iStartColumnIndex = -1; int iEndRowIndex = -1; int iEndColumnIndex = -1; int iSortByColumnIndex = -1; if (SLTool.FormatCellReferenceToRowColumnIndex(StartCellReference, out iStartRowIndex, out iStartColumnIndex) && SLTool.FormatCellReferenceToRowColumnIndex(EndCellReference, out iEndRowIndex, out iEndColumnIndex)) { iSortByColumnIndex = SLTool.ToColumnIndex(SortByColumnName); this.Sort(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex, true, iSortByColumnIndex, SortAscending); } }
/// <summary> /// Get the column index given a cell reference or column name. /// </summary> /// <param name="Input">A cell reference such as "A1" or column name such as "A". If the input is invalid, then -1 is returned.</param> /// <returns>The column index.</returns> public static int ToColumnIndex(string Input) { return(SLTool.ToColumnIndex(Input)); }