COP/ExcelComponents/Models/ExcelCellStyle.cs
2024-07-29 20:21:07 +04:00

93 lines
1.8 KiB
C#

using OfficeOpenXml.Style;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.VisualStyles;
namespace ExcelComponents.Models
{
public class ExcelCellStyle
{
public bool WrapText {get; set;}
public ExcelHorizontalAlignment HorizontalAlignment { get; set;}
public ExcelVerticalAlignment VerticalAlignment { get; set;}
public bool NoBorder { get; set;}
private ExcelBorderStyle topBorderStyle;
public ExcelBorderStyle TopBorderStyle {
get
{
if (NoBorder)
{
return ExcelBorderStyle.None;
}
return topBorderStyle;
}
set
{
topBorderStyle = value;
}
}
private ExcelBorderStyle bottomBorderStyle;
public ExcelBorderStyle BottomBorderStyle
{
get
{
if (NoBorder)
{
return ExcelBorderStyle.None;
}
return bottomBorderStyle;
}
set
{
bottomBorderStyle = value;
}
}
private ExcelBorderStyle leftBorderStyle;
public ExcelBorderStyle LeftBorderStyle
{
get
{
if (NoBorder)
{
return ExcelBorderStyle.None;
}
return leftBorderStyle;
}
set
{
leftBorderStyle = value;
}
}
private ExcelBorderStyle rightBorderStyle;
public ExcelBorderStyle RightBorderStyle
{
get
{
if (NoBorder)
{
return ExcelBorderStyle.None;
}
return rightBorderStyle;
}
set
{
rightBorderStyle = value;
}
}
public ExcelCellStyle()
{
WrapText = false;
NoBorder = true;
HorizontalAlignment = ExcelHorizontalAlignment.Center;
VerticalAlignment = ExcelVerticalAlignment.Center;
topBorderStyle = ExcelBorderStyle.Thin;
bottomBorderStyle = ExcelBorderStyle.Thin;
leftBorderStyle = ExcelBorderStyle.Thin;
rightBorderStyle = ExcelBorderStyle.Thin;
}
}
}