// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); ws.getRange("A:A").setColumnWidthInPixel(32d); // ScrollBars can be horizontal and vertical ws.getRange("B2").setValue("A scroll bar can be horizontal or vertical."); IScrollBar scrollBar1 = ws.getControls().addScrollBar(28.3, 39, 257.4, 24.20); scrollBar1.setLargeChange(2); scrollBar1.setOrientation(FormControlOrientation.Horizontal); scrollBar1.setMax(10); scrollBar1.setMin(1); scrollBar1.setValue(3); IScrollBar scrollBar2 = ws.getControls().addScrollBar(304.7, 23.7, 26.10, 136.10); scrollBar2.setLargeChange(2); scrollBar2.setOrientation(FormControlOrientation.Vertical); scrollBar2.setMax(10); scrollBar2.setMin(1); scrollBar2.setSmallChange(1); scrollBar2.setValue(1); // Data binding ws.getRange("B7").setValue("It can be linked to a cell to bind the value."); ws.getRange("B9:C9").setValue(new Object[][] { { "Value", 4d} }); IScrollBar scrollBar3 = ws.getControls().addScrollBar(26.5, 140, 255, 21); scrollBar3.setLargeChange(2); scrollBar3.setOrientation(FormControlOrientation.Horizontal); scrollBar3.setMax(10); scrollBar3.setMin(1); scrollBar3.setSmallChange(1); scrollBar3.setLinkedCell(ws.getRange("C9")); scrollBar3.setValue(1); // Save to an excel file workbook.save("ScrollBarsBasicUsage.xlsx");