예제 #1
0
        /// <summary>
        /// Creates an auto-filter on the specified range and
        /// freezes the top row of that range.
        /// </summary>
        /// <param name="range">The range.</param>
        /// <exception cref="ArgumentNullException"><paramref name="range"/> is null.</exception>
        public static void SetAutoFilterAndFreezeTopRow(
            this Range range)
        {
            if (range == null)
            {
                throw new ArgumentNullException(nameof(range));
            }

            range.SetAutoFilter();

            var cellToFreezeAt = range.Worksheet.Cells[range.GetRowNumbers().First(), 0];

            cellToFreezeAt.SetFreezePanes(PaneKinds.Row);
        }