//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; ws.Range["A:A"].ColumnWidthInPixel = 32d; // ScrollBars can be horizontal and vertical ws.Range["B2"].Value = "A scroll bar can be horizontal or vertical."; var scrollBar1 = ws.Controls.AddScrollBar(28.3, 39, 257.4, 24.20); scrollBar1.LargeChange = 2; scrollBar1.Orientation = FormControlOrientation.Horizontal; scrollBar1.Max = 10; scrollBar1.Min = 1; scrollBar1.Value = 3; var scrollBar2 = ws.Controls.AddScrollBar(304.7, 23.7, 26.10, 136.10); scrollBar2.LargeChange = 2; scrollBar2.Orientation = FormControlOrientation.Vertical; scrollBar2.Max = 10; scrollBar2.Min = 1; scrollBar2.SmallChange = 1; scrollBar2.Value = 1; // Data binding ws.Range["B7"].Value = "It can be linked to a cell to bind the value."; ws.Range["B9:C9"].Value = (new object[,] { { "Value", 4d} }); var scrollBar3 = ws.Controls.AddScrollBar(26.5, 140, 255, 21); scrollBar3.LargeChange = 2; scrollBar3.Orientation = FormControlOrientation.Horizontal; scrollBar3.Max = 10; scrollBar3.Min = 1; scrollBar3.SmallChange = 1; scrollBar3.LinkedCell = ws.Range["C9"]; scrollBar3.Value = 1; // Save to an excel file workbook.Save("ScrollBarsBasicUsage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") ws.Range("A:A").ColumnWidthInPixel = 32.0R ' ScrollBars can be horizontal and vertical ws.Range!B2.Value = "A scroll bar can be horizontal or vertical." With ws.Controls.AddScrollBar(28.3, 39, 257.4, 24.2) .LargeChange = 2 .Orientation = FormControlOrientation.Horizontal .Max = 10 .Min = 1 .Value = 3 End With With ws.Controls.AddScrollBar(304.7, 23.7, 26.1, 136.1) .LargeChange = 2 .Orientation = FormControlOrientation.Vertical .Max = 10 .Min = 1 .SmallChange = 1 .Value = 1 End With ' Data binding ws.Range!B7.Value = "It can be linked to a cell to bind the value." ws.Range("B9:C9").Value = New Object(,) { {"Value", 4.0R} } With ws.Controls.AddScrollBar(26.5, 140, 255, 21) .LargeChange = 2 .Orientation = FormControlOrientation.Horizontal .Max = 10 .Min = 1 .SmallChange = 1 .LinkedCell = ws.Range!C9 .Value = 1 End With ' save to an excel file workbook.Save("ScrollBarsBasicUsage.xlsx")