// Create a new workbook Workbook workbook = new Workbook(); // Open an excel file InputStream fileStream = this.getResourceStream("xlsx/WebsiteFlowChart.xlsx"); workbook.open(fileStream); IWorksheet worksheet = workbook.getWorksheets().get(0); //Get "Idea" IShape idea = worksheet.getShapes().get("Idea"); idea.getFill().twoColorGradient(GradientStyle.FromCenter, 1); idea.getFill().getGradientStops().get(0).setPosition(0.33); idea.getFill().getGradientStops().get(0).getColor().setRGB(Color.FromArgb(0, 112, 192)); idea.getFill().getGradientStops().get(1).setPosition(1); idea.getFill().getGradientStops().get(1).getColor().setRGB(Color.GetWhite()); //Set gradient path type as "Path" idea.getFill().setGradientPathType(PathShapeType.Path); //Get "Functionality" IShape functionality = worksheet.getShapes().get("Functionality"); functionality.getFill().twoColorGradient(GradientStyle.FromCenter, 1); functionality.getFill().getGradientStops().get(0).setPosition(0.33); functionality.getFill().getGradientStops().get(0).getColor().setRGB(Color.FromArgb(0, 112, 192)); functionality.getFill().getGradientStops().get(1).setPosition(1); functionality.getFill().getGradientStops().get(1).getColor().setRGB(Color.GetWhite()); //Set gradient path type as "Path" functionality.getFill().setGradientPathType(PathShapeType.Path); // Save to an excel file workbook.save("ConfigGradientFillWithPathShape.xlsx");
// Create a new workbook var workbook = Workbook() // Open an excel file val fileStream = this.getResourceStream("xlsx/WebsiteFlowChart.xlsx") workbook.open(fileStream!!) val worksheet = workbook.worksheets[0] //Get "Idea" val idea = worksheet.shapes["Idea"] idea.fill.twoColorGradient(GradientStyle.FromCenter, 1) idea.fill.gradientStops[0].position = 0.33 idea.fill.gradientStops[0].color.rgb = com.grapecity.documents.excel.Color.FromArgb(0, 112, 192) idea.fill.gradientStops[1].position = 1.0 idea.fill.gradientStops[1].color.rgb = com.grapecity.documents.excel.Color.GetWhite() //Set gradient path type as "Path" idea.fill.gradientPathType = PathShapeType.Path //Get "Functionality" val functionality = worksheet.shapes["Functionality"] functionality.fill.twoColorGradient(GradientStyle.FromCenter, 1) functionality.fill.gradientStops[0].position = 0.33 functionality.fill.gradientStops[0].color.rgb = com.grapecity.documents.excel.Color.FromArgb(0, 112, 192) functionality.fill.gradientStops[1].position = 1.0 functionality.fill.gradientStops[1].color.rgb = com.grapecity.documents.excel.Color.GetWhite() //Set gradient path type as "Path" functionality.fill.gradientPathType = PathShapeType.Path // Save to an excel file workbook.save("ConfigGradientFillWithPathShape.xlsx")