//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); GrapeCity.Documents.Excel.Workbook workbookWithShape = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbookWithShape.Worksheets[0]; // Add a shape in worksheet GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddShape(GrapeCity.Documents.Excel.Drawing.AutoShapeType.Parallelogram, 1, 1, 200, 100); shape.Line.DashStyle = GrapeCity.Documents.Excel.Drawing.LineDashStyle.Dash; shape.Line.Style = GrapeCity.Documents.Excel.Drawing.LineStyle.Single; shape.Line.Weight = 2; shape.Line.Color.ObjectThemeColor = ThemeColor.Accent6; shape.Line.Transparency = 0.3; // jsonString contains shapes String jsonString = workbookWithShape.ToJson(); // GcExcel can load json string contains shapes now workbook.FromJson(jsonString); //save to an excel file workbook.Save("loadandsavejsonwithshapes.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim workbookWithShape As New Excel.Workbook() Dim worksheet As IWorksheet = workbookWithShape.Worksheets(0) 'Add a shape in worksheet Dim shape As IShape = worksheet.Shapes.AddShape(AutoShapeType.Parallelogram, 1, 1, 200, 100) shape.Line.DashStyle = LineDashStyle.Dash shape.Line.Style = LineStyle.Single shape.Line.Weight = 2 shape.Line.Color.ObjectThemeColor = ThemeColor.Accent6 shape.Line.Transparency = 0.3 'jsonString contains shapes Dim jsonString As String = workbookWithShape.ToJson() 'GcExcel can load json string contains shapes now workbook.FromJson(jsonString) ' save to an excel file workbook.Save("loadandsavejsonwithshapes.xlsx")