Exemple #1
0
        /// <summary>
        /// Метод получающий информацию об заданной ячейке
        /// </summary>
        /// <param name="CellAddr">Адрес ячейки(пока без проверки на рэндж)</param>
        /// <returns></returns>
        public static CellInfo GetCellInfo(string CellAddr)
        {
            CellInfo res = new CellInfo();

            if (workSheet != null)
            {
                res.Row = workSheet.Range[CellAddr].Row;
                res.Column = workSheet.Range[CellAddr].Column;
                res.ColumnWidth = workSheet.Range[CellAddr].Width;
                res.RowHeight = workSheet.Range[CellAddr].Height;
                res.Interior = workSheet.Range[CellAddr].Interior;
                res.Font = workSheet.Range[CellAddr].Font;
                res.HorizontalAlignment = workSheet.Range[CellAddr].HorizontalAlignment;
                res.VerticalAlignment = workSheet.Range[CellAddr].VerticalAlignment;
            }

            return res;
        }
Exemple #2
0
        /// <summary>
        /// Метод устанавливающий настройку ячейки
        /// </summary>
        /// <param name="cell"></param>
        public static void SetCellDecor(CellInfo cell)
        {
            if (workSheet != null)
            {
                //--Font settings
                workSheet.Cells[cell.Row, cell.Column].Font.Name = cell.Font.Name;
                workSheet.Cells[cell.Row, cell.Column].Font.Size = cell.Font.Size;
                workSheet.Cells[cell.Row, cell.Column].Font.Bold = cell.Font.Bold;
                workSheet.Cells[cell.Row, cell.Column].Font.Italic = cell.Font.Italic;
                workSheet.Cells[cell.Row, cell.Column].Font.Underline = cell.Font.Underline;
                workSheet.Cells[cell.Row, cell.Column].Font.Background = cell.Font.Background;
                workSheet.Cells[cell.Row, cell.Column].Font.Color = cell.Font.Color;
                workSheet.Cells[cell.Row, cell.Column].Font.ColorIndex = cell.Font.ColorIndex;
                workSheet.Cells[cell.Row, cell.Column].Font.FontStyle = cell.Font.FontStyle;
                workSheet.Cells[cell.Row, cell.Column].Font.Strikethrough = cell.Font.Strikethrough;
                workSheet.Cells[cell.Row, cell.Column].Font.ThemeFont = cell.Font.ThemeFont;
                workSheet.Cells[cell.Row, cell.Column].Font.TintAndShade = cell.Font.TintAndShade;
                //--Interior settings
                workSheet.Cells[cell.Row, cell.Column].Interior.Color = cell.Interior.Color;
                workSheet.Cells[cell.Row, cell.Column].Interior.ColorIndex = cell.Interior.ColorIndex;
                workSheet.Cells[cell.Row, cell.Column].Interior.Pattern = cell.Interior.Pattern;
                workSheet.Cells[cell.Row, cell.Column].Interior.PatternColor = cell.Interior.PatternColor;
                workSheet.Cells[cell.Row, cell.Column].Interior.PatternColorIndex = cell.Interior.PatternColorIndex;
                workSheet.Cells[cell.Row, cell.Column].Interior.PatternTintAndShade = cell.Interior.PatternTintAndShade;

                workSheet.Cells[cell.Row, cell.Column].HorizontalAlignment = cell.HorizontalAlignment;
                workSheet.Cells[cell.Row, cell.Column].VerticalAlignment = cell.VerticalAlignment;
            }
        }