//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); Stream fileStream = this.GetResourceStream("xlsx\\defaultValue.xlsx"); workbook.Open(fileStream); var worksheet = workbook.ActiveSheet; //set default value for standard reduction worksheet.Range["C4:C8"].DefaultValue = "=B4 - B4*0.12"; //set normal value for specific percent reduction worksheet.Range["C6"].Formula = "=B6 - B6*0.08"; worksheet.Range["C8"].Formula = "=B8 - B8*0.05"; //calculate total on default value and specific values worksheet.Range["C9"].Formula = "=SUM(C4:C8)"; // Save to an excel file workbook.Save("DefaultValue.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim fileStream As Stream = GetResourceStream("xlsx\defaultValue.xlsx") workbook.Open(fileStream) Dim worksheet = workbook.ActiveSheet 'set default value for standard reduction worksheet.Range("C4:C8").DefaultValue = "=B4 - B4*0.12" 'set normal value for specific percent reduction worksheet.Range("C6").Formula = "=B6 - B6*0.08" worksheet.Range("C8").Formula = "=B8 - B8*0.05" 'calculate total on default value and specific values worksheet.Range("C9").Formula = "=SUM(C4:C8)" ' save to an excel file workbook.Save("DefaultValue.xlsx")