//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //Open an excel file var fileStream = this.GetResourceStream("xlsx\\WebsiteFlowChart.xlsx"); workbook.Open(fileStream); IWorksheet worksheet = workbook.Worksheets[0]; //Get "Idea" IShape idea = worksheet.Shapes["Idea"]; idea.Fill.TwoColorGradient(GrapeCity.Documents.Excel.Drawing.GradientStyle.FromCenter, 1); idea.Fill.GradientStops[0].Position = 0.33; idea.Fill.GradientStops[0].Color.RGB = System.Drawing.Color.FromArgb(0, 112, 192); idea.Fill.GradientStops[1].Position = 1; idea.Fill.GradientStops[1].Color.RGB = System.Drawing.Color.White; //Set gradient path type as "Path" idea.Fill.GradientPathType = PathShapeType.Path; //Get "Functionality" IShape functionality = worksheet.Shapes["Functionality"]; functionality.Fill.TwoColorGradient(GrapeCity.Documents.Excel.Drawing.GradientStyle.FromCenter, 1); functionality.Fill.GradientStops[0].Position = 0.33; functionality.Fill.GradientStops[0].Color.RGB = System.Drawing.Color.FromArgb(0, 112, 192); functionality.Fill.GradientStops[1].Position = 1; functionality.Fill.GradientStops[1].Color.RGB = System.Drawing.Color.White; //Set gradient path type as "Path" functionality.Fill.GradientPathType = PathShapeType.Path; // Save to an excel file workbook.Save("ConfigGradientFillWithPathShape.xlsx");
' Create a new Workbook Dim workbook As New Workbook 'Open an excel file Dim fileStream = GetResourceStream("xlsx\WebsiteFlowChart.xlsx") workbook.Open(fileStream) Dim worksheet As IWorksheet = workbook.Worksheets(0) 'Get "Idea" With worksheet.Shapes("Idea").Fill .TwoColorGradient(GradientStyle.FromCenter, 1) .GradientStops(0).Position = 0.33 .GradientStops(0).Color.RGB = System.Drawing.Color.FromArgb(0, 112, 192) .GradientStops(1).Position = 1 .GradientStops(1).Color.RGB = System.Drawing.Color.White 'Set gradient path type as "Path" .GradientPathType = PathShapeType.Path End With 'Get "Functionality" With worksheet.Shapes("Functionality").Fill .TwoColorGradient(GradientStyle.FromCenter, 1) .GradientStops(0).Position = 0.33 .GradientStops(0).Color.RGB = System.Drawing.Color.FromArgb(0, 112, 192) .GradientStops(1).Position = 1 .GradientStops(1).Color.RGB = System.Drawing.Color.White 'Set gradient path type as "Path" .GradientPathType = PathShapeType.Path End With ' save to an excel file workbook.Save("ConfigGradientFillWithPathShape.xlsx")