//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1"].Style = workbook.Styles["Good"]; worksheet.Range["A1"].Value = "Good"; // Create and modify a style based on current existing style IStyle myGood = workbook.Styles.Add("MyGood", workbook.Styles["Good"]); myGood.Font.Bold = true; myGood.Font.Italic = true; worksheet.Range["B1"].Style = workbook.Styles["MyGood"]; worksheet.Range["B1"].Value = "MyGood"; // Save to an excel file workbook.Save("CreateStyleBasedOn.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) worksheet.Range!A1.Style = workbook.Styles("Good") worksheet.Range!A1.Value = "Good" ' Create and modify a style based on current existing style Dim myGood As IStyle = workbook.Styles.Add("MyGood", workbook.Styles("Good")) myGood.Font.Bold = True myGood.Font.Italic = True worksheet.Range!B1.Style = workbook.Styles("MyGood") worksheet.Range!B1.Value = "MyGood" ' save to an excel file workbook.Save("CreateStyleBasedOn.xlsx")