Interface ITableStyleElement
Represents Table Style Element
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface ITableStyleElement
Properties
BackColor
Gets or sets the background color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors BackColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.BackColor=ExcelKnownColors.Blue;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
BackColorRGB
Gets and sets the back ground RGB color.
Declaration
Color BackColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.BackColorRGB = System.Drawing.Color.FromArgb(255, 255, 0, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Bold
Gets or sets a boolean value indicating whether the font is bold.
Declaration
bool Bold { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.Bold = true;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
BottomBorderColor
Gets or sets the bottom border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors BottomBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.BottomBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.BottomBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
BottomBorderColorRGB
Gets or sets RGB color to bottom border.
Declaration
Color BottomBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.BottomBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.BottomBorderColorRGB = System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
BottomBorderStyle
Gets or sets the bottom border line style.
Declaration
ExcelLineStyle BottomBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.BottomBorderStyle=ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
FontColor
Gets or sets the Font color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors FontColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.FontColor=ExcelKnownColors.Red;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
FontColorRGB
Gets or sets RGB color to font.
Declaration
Color FontColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.FontColorRGB=System.Drawing.Color.FromArgb(255, 0, 0, 255);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
HorizontalBorderColor
Gets or sets the Horizontal Border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors HorizontalBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.HorizontalBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.HorizontalBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
HorizontalBorderColorRGB
Gets or sets RGB color to horizontal border.
Declaration
Color HorizontalBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.HorizontalBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.HorizontalBorderColorRGB=System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
HorizontalBorderStyle
Gets or sets the Horizontal border line style.
Declaration
ExcelLineStyle HorizontalBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.HorizontalBorderStyle = ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Italic
Gets or sets a boolean value indicating whether the font is italic.
Declaration
bool Italic { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.Italic = true;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
LeftBorderColor
Gets or sets the left border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors LeftBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.LeftBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.LeftBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
LeftBorderColorRGB
Gets or sets RGB color to left border.
Declaration
Color LeftBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.LeftBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.LeftBorderColorRGB = System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
LeftBorderStyle
Gets or sets the left border line style.
Declaration
ExcelLineStyle LeftBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.LeftBorderStyle=ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
PatternColor
Gets or sets the pattern color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors PatternColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.PatternStyle = ExcelPattern.DarkVertical;
tableStyleElement.PatternColor = ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
PatternColorRGB
Gets or sets RGB color to pattern.
Declaration
Color PatternColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.PatternStyle = ExcelPattern.DarkVertical;
tableStyleElement.PatternColorRGB = System.Drawing.Color.FromArgb(255, 255, 0, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
PatternStyle
Gets and sets the pattern style from table style element.
Declaration
ExcelPattern PatternStyle { get; set; }
Property Value
Type |
---|
ExcelPattern |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.PatternStyle=ExcelPattern.DarkVertical;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
RightBorderColor
Gets or sets the right border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors RightBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.RightBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.RightBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
RightBorderColorRGB
Gets or sets RGB color to right border.
Declaration
Color RightBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.RightBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.RightBorderColorRGB = System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
RightBorderStyle
Gets or sets the right border line style.
Declaration
ExcelLineStyle RightBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.RightBorderStyle=ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
StrikeThrough
Gets or sets a boolean value indicating whether the font is Strike.
Declaration
bool StrikeThrough { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.StrikeThrough=true;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
StripeSize
Gets or sets the table style element row and column strip size.
Declaration
int StripeSize { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumnStripe);
tableStyleElement.BackColor = ExcelKnownColors.Blue;
tableStyleElement.StripeSize = 2;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
TableStyleElementType
Gets the table style element type from related table style element.
Declaration
ExcelTableStyleElementType TableStyleElementType { get; }
Property Value
Type |
---|
ExcelTableStyleElementType |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
ExcelTableStyleElementType tableStyleElementType= tableStyleElements[0].TableStyleElementType;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
TopBorderColor
Gets or sets the Top Border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors TopBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.TopBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.TopBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
TopBorderColorRGB
Gets or sets RGB color to Top border.
Declaration
Color TopBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.TopBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.TopBorderColorRGB=System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
TopBorderStyle
Gets or sets the Top border line style.
Declaration
ExcelLineStyle TopBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.TopBorderStyle=ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Underline
Gets or sets the underline type from the table style element.
Declaration
ExcelUnderline Underline { get; set; }
Property Value
Type |
---|
ExcelUnderline |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.Underline =ExcelUnderline.Single;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
VerticalBorderColor
Gets or sets the Vertical Border color from predefined colors (ExcelKnownColors).
Declaration
ExcelKnownColors VerticalBorderColor { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.VerticalBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.VerticalBorderColor=ExcelKnownColors.Green;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
VerticalBorderColorRGB
Gets or sets RGB color to Vertical border.
Declaration
Color VerticalBorderColorRGB { get; set; }
Property Value
Type |
---|
Color |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.VerticalBorderStyle=ExcelLineStyle.Thick;
tableStyleElement.VerticalBorderColorRGB = System.Drawing.Color.FromArgb(255, 0, 255, 0);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
VerticalBorderStyle
Gets or sets the Vertical border line style.
Declaration
ExcelLineStyle VerticalBorderStyle { get; set; }
Property Value
Type |
---|
ExcelLineStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.VerticalBorderStyle = ExcelLineStyle.Thick;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Methods
Clear()
Delete the table style element from table style elements list collection.
Declaration
void Clear()
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.LeftBorderStyle=ExcelLineStyle.Thin;
tableStyleElement.LeftBorderColor=ExcelKnownColors.Red;
tableStyleElement.BackColor=ExcelKnownColors.Blue;
tableStyleElement.Clear();
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Clone()
Clone the table style element and return.
Declaration
ITableStyleElement Clone()
Returns
Type |
---|
ITableStyleElement |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
tableStyleElement.LeftBorderStyle=ExcelLineStyle.Thin;
tableStyleElement.LeftBorderColor=ExcelKnownColors.Red;
tableStyleElement.BackColor=ExcelKnownColors.Blue;
ITableStyleElement tableStyleElementClone = tableStyleElement.Clone();
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}