// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); String rngG2 = "Graphics API"; ws.getRange("$G$2").setValue(rngG2); Object rngD6E6 = new Object[][] { { "Sharpness", 0d} }; ws.getRange("$D$6:$E$6").setValue(rngD6E6); Object rngA13A21 = new Object[][] { { "Resolutions"}, { "640x480"}, { "800x600"}, { "1280x720"}, { "1366x768"}, { "1680x1050"}, { "1920x1080"}, { "2560x1440"}, { "3840x2160"} }; ws.getRange("$A$13:$A$21").setValue(rngA13A21); Object rngB13B14 = new Object[][] { { "Selected"}, { 6d} }; ws.getRange("$B$13:$B$14").setValue(rngB13B14); Object rngD13D17 = new Object[][] { { "DLSS"}, { "Off"}, { "Fast"}, { "Balanced"}, { "Quality"} }; ws.getRange("$D$13:$D$17").setValue(rngD13D17); Object rngE13E14 = new Object[][] { { "Selected"}, { 2d} }; ws.getRange("$E$13:$E$14").setValue(rngE13E14); Object rngG13G16 = new Object[][] { { "Graphics API"}, { "DirectX 12"}, { "DirectX 11"}, { "Vulkan 1.3"} }; ws.getRange("$G$13:$G$16").setValue(rngG13G16); Object rngH13H14 = new Object[][] { { "Selected"}, { 1d} }; ws.getRange("$H$13:$H$14").setValue(rngH13H14); ws.getRange("$E$4").setFormula2("=INDEX(D14:D17,E14+1,1)"); IBorders uiBorders = ws.getRange("$A$1:$G$10").getBorders(); uiBorders.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Light1); uiBorders.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thin); uiBorders.get(BordersIndex.EdgeLeft).setThemeColor(ThemeColor.Light1); uiBorders.get(BordersIndex.EdgeLeft).setLineStyle(BorderLineStyle.Thin); uiBorders.get(BordersIndex.EdgeRight).setThemeColor(ThemeColor.Light1); uiBorders.get(BordersIndex.EdgeRight).setLineStyle(BorderLineStyle.Thin); uiBorders.get(BordersIndex.EdgeTop).setThemeColor(ThemeColor.Light1); uiBorders.get(BordersIndex.EdgeTop).setLineStyle(BorderLineStyle.Thin); IBorders outBorders = ws.getRange("$A$1:$H$11").getBorders(); outBorders.get(BordersIndex.InsideHorizontal).setThemeColor(ThemeColor.Light1); outBorders.get(BordersIndex.InsideHorizontal).setLineStyle(BorderLineStyle.Thin); outBorders.get(BordersIndex.InsideVertical).setThemeColor(ThemeColor.Light1); outBorders.get(BordersIndex.InsideVertical).setLineStyle(BorderLineStyle.Thin); IBorders noBorders = ws.getRange("$E$6").getBorders(); noBorders.get(BordersIndex.EdgeBottom).clear(); noBorders.get(BordersIndex.EdgeLeft).clear(); noBorders.get(BordersIndex.EdgeRight).clear(); noBorders.get(BordersIndex.EdgeTop).clear(); noBorders.get(BordersIndex.InsideHorizontal).clear(); noBorders.get(BordersIndex.InsideVertical).clear(); ws.getRange("$1:$1").setRowHeight(20.4d); ws.getRange("$2:$2,$4:$4,$6:$10,$12:$13").setRowHeight(16.8d); ws.getRange("$3:$3").setRowHeight(7.8d); ws.getRange("$5:$5").setRowHeight(10.2d); ws.getRange("$11:$11").setRowHeight(17.4d); final double ColScale = 0.88; ws.getRange("$A:$A").setColumnWidthInPixel(ColScale * 116d); ws.getRange("$G:$G").setColumnWidthInPixel(ColScale * 109d); ws.getRange("$H:$H").setColumnWidthInPixel(ColScale * 73d); ws.getRange("$I:$I").setColumnWidthInPixel(ColScale * 39d); ws.getRange("$L:$L").setColumnWidthInPixel(ColScale * 99d); final double WidthScale = 0.895; ILabel ctl1 = ws.getControls().addLabel(12.6 * ColScale, 20.4, 49.19 * WidthScale, 18.6); ctl1.setText("Resolution"); IDropDown ctl2 = ws.getControls().addDropDown(88.2 * ColScale, 21.59, 99.60 * WidthScale, 14.40); ctl2.setItemsSourceRange(ws.getRange("$A$14:$A$21")); ctl2.setLinkedCell(ws.getRange("$B$14")); ctl2.setSelectedIndex(5); IGroupBox ctl3 = ws.getControls().addGroupBox(4.8 * ColScale, 5.4, 475.34 * WidthScale, 160.79); ctl3.setText("Display options"); ws.getPageSetup().setPrintArea(ctl3.getTopLeftCell().getAddress()+":"+ctl3.getBottomRightCell().getAddress()); IButton ctl4 = ws.getControls().addButton(199.8 * ColScale, 21, 127.80 * WidthScale, 17.40); ctl4.setText("Use native resolution"); ctl4.setPrintObject(true); ILabel ctl5 = ws.getControls().addLabel(13.8 * ColScale, 45.6, 19.2 * WidthScale, 13.2); ctl5.setText("DLSS"); ICheckBox ctl6 = ws.getControls().addCheckBox(12 * ColScale, 73.8, 172.2 * WidthScale, 14.40); ctl6.setText("Ray tracing - global light"); ICheckBox ctl7 = ws.getControls().addCheckBox(12 * ColScale, 90, 172.2 * WidthScale, 14.39); ctl7.setValue(true); ctl7.setText("Ray tracing - shadows"); ICheckBox ctl8 = ws.getControls().addCheckBox(12 * ColScale, 107.39, 172.2 * WidthScale, 14.40); ctl8.setValue(true); ctl8.setText("Ray tracing - reflection"); ICheckBox ctl9 = ws.getControls().addCheckBox(12 * ColScale, 124.19, 172.2 * WidthScale, 14.40); ctl9.setText("Ray tracing - refraction"); IScrollBar ctl10 = ws.getControls().addScrollBar(89.4 * ColScale, 46.8, 151.2 * WidthScale, 12.60); ctl10.setLargeChange(1); ctl10.setOrientation(FormControlOrientation.Horizontal); ctl10.setMax(3); ctl10.setMin(0); ctl10.setSmallChange(1); ctl10.setLinkedCell(ws.getRange("$E$14")); ctl10.setValue(2); ICheckBox ctl11 = ws.getControls().addCheckBox(12 * ColScale, 139.79, 172.2 * WidthScale, 14.40); ctl11.setValue(true); ctl11.setText("Ray tracing - ambient light"); ISpinner ctl12 = ws.getControls().addSpinner(250.2 * ColScale, 72.6, 18 * WidthScale, 15); ctl12.setMax(100); ctl12.setMin(0); ctl12.setLinkedCell(ws.getRange("$E$6")); ctl12.setValue(0); IOptionButton ctl13 = ws.getControls().addOptionButton(198.6 * ColScale, 107, 81.6 * WidthScale, 16.79); ctl13.setText("Windowed"); IOptionButton ctl14 = ws.getControls().addOptionButton(198.6 * ColScale, 121.8, 115.20 * WidthScale, 17.39); ctl14.setValue(true); ctl14.setText("Full screen (borderless)"); IOptionButton ctl15 = ws.getControls().addOptionButton(198.6 * ColScale, 138, 104.4 * WidthScale, 17.39); ctl15.setText("Full screen (monopoly)"); IGroupBox ctl16 = ws.getControls().addGroupBox(196.8 * ColScale, 97.2, 123 * WidthScale, 59.99); ctl16.setText("Window mode"); IListBox ctl17 = ws.getControls().addListBox(360 * ColScale, 41.40, 103.94 * WidthScale, 41.39); ctl17.setItemsSourceRange(ws.getRange("$G$14:$G$16")); ctl17.setLinkedCell(ws.getRange("$H$14")); ctl17.setSelectedIndex(0); IButton ctl18 = ws.getControls().addButton(360 * ColScale, 91.8, 103.94 * WidthScale, 19.79); ctl18.setText("Test settings"); ctl18.setPrintObject(true); IButton ctl19 = ws.getControls().addButton(360 * ColScale, 138.6, 103.94 * WidthScale, 19.80); ctl19.setText("OK"); ctl19.setPrintObject(true); IButton ctl20 = ws.getControls().addButton(360 * ColScale, 114.6, 103.94 * WidthScale, 19.79); ctl20.setText("Cancel"); ctl20.setPrintObject(true); // Save to a pdf file workbook.save("FormControlPdfDisplayOptionsDialog.pdf");