worksheet.CellsExcle .net core导出Excle样式常用样式

ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("aspnetcore");
worksheet.Cells.Style.VerticalAlignment = ExcelVerticalAlignment.Center;//垂直居中
worksheet.Cells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;//水平居中

worksheet.Cells.Style.Font.Bold = true;//字体为粗体
worksheet.Cells.Style.Font.Name = "微软雅黑";//字体
worksheet.Cells.Style.Font.Size = 10;//字体大小
worksheet.Cells.Merge = true;//合并单元格

worksheet.Cells.Style.Border.Left.Style = ExcelBorderStyle.Thin;//边框
worksheet.Cells.Style.Border.Right.Style = ExcelBorderStyle.Thin;//边框
worksheet.Cells.Style.Border.Top.Style = ExcelBorderStyle.Thin;//边框
worksheet.Cells.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;//边框
worksheet.Cells.Style.WrapText = true;//自动换行

 worksheet.Cells.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(128, 128, 128));//设置单元格背景色

worksheet.Cells.Style.Font.Bold = true;//字体设置
worksheet.Cells.Style.Font.Color.SetColor(Color.Blue)//字体颜色设置 

你可能感兴趣的:(worksheet.CellsExcle .net core导出Excle样式常用样式)