// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); String rngB1 = "Document Solutions for Excel Product Feedback - Form Controls"; ws.getRange("$B$1").setValue(rngB1); Object rngB3I3 = new Object[][] { { "Please take a moment to let us know your feedback about Form Controls in Document Solutions for Excel. Your feedback is valuable and will help us to improve our product and better serve our customers.", null, null, null, null, null, null, null} }; ws.getRange("$B$3:$I$3").setValue(rngB3I3); String rngB5 = "1. How difficult is it to use the Form Controls in Document Solutions for Excel?"; ws.getRange("$B$5").setValue(rngB5); Object rngD7I7 = new Object[][] { { "Very difficult", "Difficult", "Neutral", "Easy", "Very easy", "I've never tried to use the feature because I don't know how."} }; ws.getRange("$D$7:$I$7").setValue(rngD7I7); Object rngB8B13 = new Object[][] { { "Create and initialize controls"}, { "Access controls in a worksheet"}, { "Read/write properties"}, { "Copy/cut controls"}, { "Range based data binding"}, { "Port existing code that uses Excel Form Controls"} }; ws.getRange("$B$8:$B$13").setValue(rngB8B13); String rngB15 = "2. What new features would you like to see in the Form Controls in Document Solutions for Excel?"; ws.getRange("$B$15").setValue(rngB15); String rngB21 = "3. Please rank the following in order of importance"; ws.getRange("$B$21").setValue(rngB21); Object rngB23C25 = new Object[][] { { 1d, "Compatibility of files exported by Microsoft Excel"}, { 2d, "New features"}, { 3d, "Performance"} }; ws.getRange("$B$23:$C$25").setValue(rngB23C25); String rngB27 = "4. Which programming language are you primarily using to access Form Controls with Document Solutions for Excel?"; ws.getRange("$B$27").setValue(rngB27); Object rngI28I30 = new Object[][] { { ".NET languages (C#, VB.NET, F#, C++/CLI,...)"}, { "JVM languages (Java, Kotlin,...)"}, { "Scripting languages (PowerShell, Python,...)"} }; ws.getRange("$I$28:$I$30").setValue(rngI28I30); String rngE29 = "Other:"; ws.getRange("$E$29").setValue(rngE29); String rngB31 = "5. Would you like to suggest this feature to your colleagues?"; ws.getRange("$B$31").setValue(rngB31); Object rngA33B33 = new Object[][] { { 5d, "Very unlikely"} }; ws.getRange("$A$33:$B$33").setValue(rngA33B33); String rngI33 = "Very likely"; ws.getRange("$I$33").setValue(rngI33); Object rngB37I37 = new Object[][] { { "6. Thank you for taking our survey. Your feedback is important and will help us create a better product for you and other developers.", null, null, null, null, null, null, null} }; ws.getRange("$B$37:$I$37").setValue(rngB37I37); String rngB39 = "Name"; ws.getRange("$B$39").setValue(rngB39); String rngB41 = "Email"; ws.getRange("$B$41").setValue(rngB41); IRange style1 = ws.getRange("$A$8:$A$13,$A$29,$E$32,$A$33"); style1.setNumberFormat(";;;"); IRange style2 = ws.getRange("$B$23:$B$25"); style2.setNumberFormat("\"P\"0"); IFont style3 = ws.getRange("$B$1:$I$1").getFont(); style3.setThemeColor(ThemeColor.Dark2); style3.setBold(true); style3.setSize(15d); IFont style4 = ws.getRange("$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37").getFont(); style4.setThemeColor(ThemeColor.Dark2); style4.setBold(true); style4.setSize(13d); IFont style5 = ws.getRange("$I$28:$I$30").getFont(); style5.setThemeColor(ThemeColor.Light1); IBorders style6 = ws.getRange("$B$1:$I$1").getBorders(); style6.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Accent1); style6.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thick); IBorders style7 = ws.getRange("$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37").getBorders(); style7.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Accent1); style7.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thick); IBorders style8 = ws.getRange("$C$39,$C$41").getBorders(); style8.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Light2); style8.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Medium); style8.get(BordersIndex.EdgeLeft).setThemeColor(ThemeColor.Light2); style8.get(BordersIndex.EdgeLeft).setLineStyle(BorderLineStyle.Medium); style8.get(BordersIndex.EdgeRight).setThemeColor(ThemeColor.Light2); style8.get(BordersIndex.EdgeRight).setLineStyle(BorderLineStyle.Medium); style8.get(BordersIndex.EdgeTop).setThemeColor(ThemeColor.Light2); style8.get(BordersIndex.EdgeTop).setLineStyle(BorderLineStyle.Medium); IBorders style9 = ws.getRange("$E$19,$F$29").getBorders(); style9.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Light2); style9.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Medium); style9.get(BordersIndex.EdgeLeft).setThemeColor(ThemeColor.Light2); style9.get(BordersIndex.EdgeLeft).setLineStyle(BorderLineStyle.Medium); style9.get(BordersIndex.EdgeTop).setThemeColor(ThemeColor.Light2); style9.get(BordersIndex.EdgeTop).setLineStyle(BorderLineStyle.Medium); IBorders style10 = ws.getRange("$F$19,$G$29").getBorders(); style10.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Light2); style10.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Medium); style10.get(BordersIndex.EdgeTop).setThemeColor(ThemeColor.Light2); style10.get(BordersIndex.EdgeTop).setLineStyle(BorderLineStyle.Medium); IBorders style11 = ws.getRange("$G$19,$H$29").getBorders(); style11.get(BordersIndex.EdgeBottom).setThemeColor(ThemeColor.Light2); style11.get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Medium); style11.get(BordersIndex.EdgeRight).setThemeColor(ThemeColor.Light2); style11.get(BordersIndex.EdgeRight).setLineStyle(BorderLineStyle.Medium); style11.get(BordersIndex.EdgeTop).setThemeColor(ThemeColor.Light2); style11.get(BordersIndex.EdgeTop).setLineStyle(BorderLineStyle.Medium); IRange style12 = ws.getRange("$B$3:$I$3"); style12.setHorizontalAlignment(HorizontalAlignment.Left); style12.setVerticalAlignment(VerticalAlignment.Center); style12.setWrapText(true); style12.setAddIndent(false); IRange style13 = ws.getRange("$B$8,$C$23:$C$25,$E$29"); style13.setVerticalAlignment(VerticalAlignment.Center); style13.setAddIndent(false); IRange style14 = ws.getRange("$B$9:$B$13,$B$23:$B$25"); style14.setHorizontalAlignment(HorizontalAlignment.Left); style14.setVerticalAlignment(VerticalAlignment.Center); style14.setAddIndent(false); IRange style15 = ws.getRange("$B$37:$I$37"); style15.setHorizontalAlignment(HorizontalAlignment.Left); style15.setWrapText(true); style15.setAddIndent(false); IRange style16 = ws.getRange("$D$7:$H$7,$E$19:$G$19,$F$29:$H$29"); style16.setHorizontalAlignment(HorizontalAlignment.Center); style16.setAddIndent(false); IRange style17 = ws.getRange("$I$7"); style17.setWrapText(true); style17.setAddIndent(false); ws.getRange("$B$3:$I$3").merge(); ws.getRange("$E$19:$G$19").merge(); ws.getRange("$B$37:$I$37").merge(); ws.getRange("$F$29:$H$29").merge(); ws.getRange("$1:$1").setRowHeight(20.4d); ws.getRange("$3:$3").setRowHeight(32.4d); ws.getRange("$5:$5,$15:$15,$27:$27,$31:$31").setRowHeight(18d); ws.getRange("$7:$7").setRowHeight(57.6d); ws.getRange("$8:$9,$11:$13").setRowHeight(24d); ws.getRange("$10:$10").setRowHeight(25.2d); ws.getRange("$17:$21,$39:$39").setRowHeight(18.6d); ws.getRange("$23:$25").setRowHeight(24.6d); ws.getRange("$28:$28,$38:$38").setRowHeight(15.6d); ws.getRange("$29:$29").setRowHeight(27d); ws.getRange("$37:$37").setRowHeight(37.8d); ws.getRange("$40:$40").setRowHeight(10.2d); ws.getRange("$41:$41").setRowHeight(19.8d); ws.getRange("$A:$A").setColumnWidthInPixel(36d); ws.getRange("$B:$B").setColumnWidthInPixel(57d); ws.getRange("$C:$C").setColumnWidthInPixel(260d); ws.getRange("$D:$D").setColumnWidthInPixel(107d); ws.getRange("$I:$I").setColumnWidthInPixel(139d); ws.getRange("$J:$J").setColumnWidthInPixel(48d); // Group: Create and initialize controls ws.getControls().addGroupBox(266.55, 175.8, 370, 20.4).setText(""); ws.getControls().addOptionButton(299.95, 178.2, 26.4, 16.19).setText(""); ws.getControls().addOptionButton(361.8, 178.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(407.8, 178.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(455.2, 177.6, 26.4, 16.2).setText(""); ws.getControls().addOptionButton(507.4, 178.2, 23.39, 16.19).setText(""); IOptionButton optA8 = ws.getControls().addOptionButton(580, 177.6, 26.39, 16.2); optA8.setLinkedCell(ws.getRange("$A$8")); optA8.setText(""); // Group: Access controls in a worksheet ws.getControls().addGroupBox(266.55, 199.8, 370, 20.4).setText(""); ws.getControls().addOptionButton(299.95, 202.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(361.8, 202.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(407.8, 202.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(455.2, 201.6, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(507.4, 202.2, 23.39, 16.19).setText(""); IOptionButton optA9 = ws.getControls().addOptionButton(580, 201.6, 26.39, 16.19); optA9.setLinkedCell(ws.getRange("$A$9")); optA9.setText(""); // Group: Read/write properties ws.getControls().addGroupBox(266.55, 223.8, 370, 20.4).setText(""); ws.getControls().addOptionButton(299.95, 226.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(361.8, 226.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(407.8, 226.2, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(455.2, 225.6, 26.39, 16.19).setText(""); ws.getControls().addOptionButton(507.4, 226.2, 23.39, 16.19).setText(""); IOptionButton optA10 = ws.getControls().addOptionButton(580, 225.6, 26.39, 16.19); optA10.setLinkedCell(ws.getRange("$A$10")); optA10.setText(""); // Group: Copy/cut controls ws.getControls().addGroupBox(266.55, 249, 370, 20.39).setText(""); ws.getControls().addOptionButton(299.95, 251.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(361.8, 251.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(407.8, 251.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(455.2, 250.79, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(507.4, 251.4, 23.39, 16.2).setText(""); IOptionButton optA11 = ws.getControls().addOptionButton(580, 250.79, 26.39, 16.2); optA11.setLinkedCell(ws.getRange("$A$11")); optA11.setText(""); // Group: Range based data binding ws.getControls().addGroupBox(266.55, 273, 370, 20.4).setText(""); ws.getControls().addOptionButton(299.95, 275.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(361.8, 275.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(407.8, 275.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(455.2, 274.8, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(507.4, 275.4, 23.39, 16.2).setText(""); IOptionButton optA12 = ws.getControls().addOptionButton(580, 274.8, 26.39, 16.2); optA12.setLinkedCell(ws.getRange("$A$12")); optA12.setText(""); // Group: Port existing code that uses Excel Form Controls ws.getControls().addGroupBox(266.55, 297, 370, 20.4).setText(""); ws.getControls().addOptionButton(299.95, 299.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(361.8, 299.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(407.8, 299.4, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(455.2, 298.8, 26.39, 16.2).setText(""); ws.getControls().addOptionButton(507.4, 299.4, 23.39, 16.2).setText(""); IOptionButton optA13 = ws.getControls().addOptionButton(580, 298.8, 26.39, 16.2); optA13.setLinkedCell(ws.getRange("$A$13")); optA13.setText(""); ICheckBox ctl29 = ws.getControls().addCheckBox(28.8, 367.20, 66.75, 16.79); ctl29.setText("Rich text"); ICheckBox ctl30 = ws.getControls().addCheckBox(29.4, 385.80, 151.35, 16.79); ctl30.setText("Styles, such as color and lines"); ICheckBox ctl31 = ws.getControls().addCheckBox(29.4, 405.00, 151.35, 16.80); ctl31.setText("Scale"); ICheckBox ctl32 = ws.getControls().addCheckBox(174.15, 367.8, 175.04, 16.80); ctl32.setText("Alternative text"); ICheckBox ctl33 = ws.getControls().addCheckBox(174.15, 385.20, 175.04, 16.80); ctl33.setText("Grouping"); ICheckBox ctl34 = ws.getControls().addCheckBox(174.15, 404.40, 175.04, 16.79); ctl34.setText("Attach to macros"); ICheckBox ctl35 = ws.getControls().addCheckBox(345.6, 367.8, 165, 16.80); ctl35.setText("Use formula in buttons"); ICheckBox ctl36 = ws.getControls().addCheckBox(345.6, 385.80, 165, 16.79); ctl36.setText("Other (please specify)"); ISpinner ctl37 = ws.getControls().addSpinner(45.6, 476.40, 17.4, 21); ctl37.setMax(3); ctl37.setMin(1); ctl37.setSmallChange(1); ctl37.setLinkedCell(ws.getRange("$B$23")); ctl37.setValue(1); ISpinner ctl38 = ws.getControls().addSpinner(45.6, 501.00, 17.4, 20.99); ctl38.setMax(3); ctl38.setMin(1); ctl38.setSmallChange(1); ctl38.setLinkedCell(ws.getRange("$B$24")); ctl38.setValue(2); ISpinner ctl39 = ws.getControls().addSpinner(45.6, 525.60, 17.4, 21); ctl39.setMax(3); ctl39.setMin(1); ctl39.setSmallChange(1); ctl39.setLinkedCell(ws.getRange("$B$25")); ctl39.setValue(3); IDropDown ctl54 = ws.getControls().addDropDown(30, 599.40, 213.15, 20.39); ctl54.setDropDownLines(3); ctl54.setItemsSourceRange(ws.getRange("$I$28:$I$30")); ctl54.setSelectedIndex(-1); ctl54.setLinkedCell(ws.getRange("$A$29")); ctl54.setValue(0); IScrollBar ctl55 = ws.getControls().addScrollBar(31.2, 690.60, 576, 24.60); ctl55.setLargeChange(1); ctl55.setOrientation(FormControlOrientation.Horizontal); ctl55.setMax(10); ctl55.setMin(0); ctl55.setSmallChange(1); ctl55.setLinkedCell(ws.getRange("$A$33")); ctl55.setValue(8); IButton ctl56 = ws.getControls().addButton(265.35, 851.40, 127.04, 45); ctl56.setHorizontalTextAlignment(HorizontalAlignment.Center); ctl56.setOrientation(TickLabelOrientation.OrientationHorizontal); ctl56.setVerticalTextAlignment(VerticalAlignment.Center); ctl56.setDefaultButton(true); ctl56.setText("Submit"); ILabel ctl57 = ws.getControls().addLabel(292.35, 671.40, 60.60, 18.00); ctl57.setText("I'm not sure"); ILabel ctl58 = ws.getControls().addLabel(433.8, 672.60, 66.59, 18.60); ctl58.setText("Likely"); ILabel ctl59 = ws.getControls().addLabel(143.55, 672.00, 60.59, 18.60); ctl59.setText("Unlikely"); // Save to an excel file workbook.save("FeedbackForm.xlsx");