//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; IShapes shapes = worksheet.Shapes; IShape rectangle = shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 100, 100); rectangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(169, 209, 142); IShape oval = shapes.AddShape(AutoShapeType.Oval, 50, 50, 100, 100); oval.Fill.Color.RGB = System.Drawing.Color.FromArgb(157, 195, 230); IShape triangle = shapes.AddShape(AutoShapeType.IsoscelesTriangle, 80, 80, 100, 100); triangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(255, 230, 153); // Set rectangle above oval rectangle.ZOrder(ZOrderType.BringForward); // Set triangle to bottom triangle.ZOrder(ZOrderType.SendToBack); // Save to an excel file workbook.Save("SetShapeZOrder.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shapes As IShapes = worksheet.Shapes Dim rectangle As IShape = shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 100, 100) rectangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(169, 209, 142) Dim oval As IShape = shapes.AddShape(AutoShapeType.Oval, 50, 50, 100, 100) oval.Fill.Color.RGB = System.Drawing.Color.FromArgb(157, 195, 230) Dim triangle As IShape = shapes.AddShape(AutoShapeType.IsoscelesTriangle, 80, 80, 100, 100) triangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(255, 230, 153) ' Set rectangle above oval rectangle.ZOrder(ZOrderType.BringForward) ' Set triangle to bottom triangle.ZOrder(ZOrderType.SendToBack) ' save to an excel file workbook.Save("SetShapeZOrder.xlsx")