//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //add table. IWorksheet worksheet = workbook.Worksheets[0]; ITable table = worksheet.Tables.Add(worksheet.Range["A1:F7"], true); worksheet.Range["A:F"].ColumnWidth = 15; //Add one custom table style. ITableStyle style = workbook.TableStyles.Add("test"); //set custom table style for table. table.TableStyle = style; //Use table style name get one build in table style. ITableStyle tableStyle = workbook.TableStyles["TableStyleMedium3"]; //set built-in table style for table. table.TableStyle = tableStyle;
' Create a new Workbook Dim workbook As New Workbook 'add table. Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim table As ITable = worksheet.Tables.Add(worksheet.Range("A1:F7"), True) worksheet.Range("A:F").ColumnWidth = 15 'Add one custom table style. Dim style As ITableStyle = workbook.TableStyles.Add("test") 'set custom table style for table. table.TableStyle = style 'Use table style name get one build in table style. Dim tableStyle As ITableStyle = workbook.TableStyles("TableStyleMedium3") 'set built-in table style for table. table.TableStyle = tableStyle ' save to an excel file workbook.Save("ApplyTableStyle.xlsx")