//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); #region Fill data IWorksheet ws = workbook.Worksheets["Sheet1"]; var rngG2 = "Graphics API"; ws.Range["$G$2"].Value = rngG2; var rngD6E6 = new object[,] { { "Sharpness", 0d} }; ws.Range["$D$6:$E$6"].Value = rngD6E6; var rngA13A21 = new object[,] { { "Resolutions"}, { "640x480"}, { "800x600"}, { "1280x720"}, { "1366x768"}, { "1680x1050"}, { "1920x1080"}, { "2560x1440"}, { "3840x2160"} }; ws.Range["$A$13:$A$21"].Value = rngA13A21; var rngB13B14 = new object[,] { { "Selected"}, { 6d} }; ws.Range["$B$13:$B$14"].Value = rngB13B14; var rngD13D17 = new object[,] { { "DLSS"}, { "Off"}, { "Fast"}, { "Balanced"}, { "Quality"} }; ws.Range["$D$13:$D$17"].Value = rngD13D17; var rngE13E14 = new object[,] { { "Selected"}, { 2d} }; ws.Range["$E$13:$E$14"].Value = rngE13E14; var rngG13G16 = new object[,] { { "Graphics API"}, { "DirectX 12"}, { "DirectX 11"}, { "Vulkan 1.3"} }; ws.Range["$G$13:$G$16"].Value = rngG13G16; var rngH13H14 = new object[,] { { "Selected"}, { 1d} }; ws.Range["$H$13:$H$14"].Value = rngH13H14; ws.Range["$E$4"].Formula2 = "=INDEX(D14:D17,E14+1,1)"; var uiBorders = ws.Range["$A$1:$G$10"].Borders; uiBorders[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Light1; uiBorders[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thin; uiBorders[BordersIndex.EdgeLeft].ThemeColor = ThemeColor.Light1; uiBorders[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Thin; uiBorders[BordersIndex.EdgeRight].ThemeColor = ThemeColor.Light1; uiBorders[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Thin; uiBorders[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Light1; uiBorders[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Thin; var outBorders = ws.Range["$A$1:$H$11"].Borders; outBorders[BordersIndex.InsideHorizontal].ThemeColor = ThemeColor.Light1; outBorders[BordersIndex.InsideHorizontal].LineStyle = BorderLineStyle.Thin; outBorders[BordersIndex.InsideVertical].ThemeColor = ThemeColor.Light1; outBorders[BordersIndex.InsideVertical].LineStyle = BorderLineStyle.Thin; var noBorders = ws.Range["$E$6"].Borders; noBorders[BordersIndex.EdgeBottom].Clear(); noBorders[BordersIndex.EdgeLeft].Clear(); noBorders[BordersIndex.EdgeRight].Clear(); noBorders[BordersIndex.EdgeTop].Clear(); noBorders[BordersIndex.InsideHorizontal].Clear(); noBorders[BordersIndex.InsideVertical].Clear(); ws.Range["$1:$1"].RowHeight = 20.4d; ws.Range["$2:$2,$4:$4,$6:$10,$12:$13"].RowHeight = 16.8d; ws.Range["$3:$3"].RowHeight = 7.8d; ws.Range["$5:$5"].RowHeight = 10.2d; ws.Range["$11:$11"].RowHeight = 17.4d; const double ColScale = 0.88; ws.Range["$A:$A"].ColumnWidthInPixel = ColScale * 116d; ws.Range["$G:$G"].ColumnWidthInPixel = ColScale * 109d; ws.Range["$H:$H"].ColumnWidthInPixel = ColScale * 73d; ws.Range["$I:$I"].ColumnWidthInPixel = ColScale * 39d; ws.Range["$L:$L"].ColumnWidthInPixel = ColScale * 99d; const double WidthScale = 0.895; #endregion var ctl1 = ws.Controls.AddLabel(12.6 * ColScale, 20.4, 49.19 * WidthScale, 18.6); ctl1.Text = "Resolution"; var ctl2 = ws.Controls.AddDropDown(88.2 * ColScale, 21.59, 99.60 * WidthScale, 14.40); ctl2.ItemsSourceRange = ws.Range["$A$14:$A$21"]; ctl2.LinkedCell = ws.Range["$B$14"]; ctl2.SelectedIndex = 5; var ctl3 = ws.Controls.AddGroupBox(4.8 * ColScale, 5.4, 475.34 * WidthScale, 160.79); ctl3.Text = "Display options"; ws.PageSetup.PrintArea = $"{ctl3.TopLeftCell.Address}:{ctl3.BottomRightCell.Address}"; var ctl4 = ws.Controls.AddButton(199.8 * ColScale, 21, 127.80 * WidthScale, 17.40); ctl4.Text = "Use native resolution"; ctl4.PrintObject = true; var ctl5 = ws.Controls.AddLabel(13.8 * ColScale, 45.6, 19.2 * WidthScale, 13.2); ctl5.Text = "DLSS"; var ctl6 = ws.Controls.AddCheckBox(12 * ColScale, 73.8, 172.2 * WidthScale, 14.40); ctl6.Text = "Ray tracing - global light"; var ctl7 = ws.Controls.AddCheckBox(12 * ColScale, 90, 172.2 * WidthScale, 14.39); ctl7.Value = true; ctl7.Text = "Ray tracing - shadows"; var ctl8 = ws.Controls.AddCheckBox(12 * ColScale, 107.39, 172.2 * WidthScale, 14.40); ctl8.Value = true; ctl8.Text = "Ray tracing - reflection"; var ctl9 = ws.Controls.AddCheckBox(12 * ColScale, 124.19, 172.2 * WidthScale, 14.40); ctl9.Text = "Ray tracing - refraction"; var ctl10 = ws.Controls.AddScrollBar(89.4 * ColScale, 46.8, 151.2 * WidthScale, 12.60); ctl10.LargeChange = 1; ctl10.Orientation = FormControlOrientation.Horizontal; ctl10.Max = 3; ctl10.Min = 0; ctl10.SmallChange = 1; ctl10.LinkedCell = ws.Range["$E$14"]; ctl10.Value = 2; var ctl11 = ws.Controls.AddCheckBox(12 * ColScale, 139.79, 172.2 * WidthScale, 14.40); ctl11.Value = true; ctl11.Text = "Ray tracing - ambient light"; var ctl12 = ws.Controls.AddSpinner(250.2 * ColScale, 72.6, 18 * WidthScale, 15); ctl12.Max = 100; ctl12.Min = 0; ctl12.LinkedCell = ws.Range["$E$6"]; ctl12.Value = 0; var ctl13 = ws.Controls.AddOptionButton(198.6 * ColScale, 107, 81.6 * WidthScale, 16.79); ctl13.Text = "Windowed"; var ctl14 = ws.Controls.AddOptionButton(198.6 * ColScale, 121.8, 115.20 * WidthScale, 17.39); ctl14.Value = true; ctl14.Text = "Full screen (borderless)"; var ctl15 = ws.Controls.AddOptionButton(198.6 * ColScale, 138, 104.4 * WidthScale, 17.39); ctl15.Text = "Full screen (monopoly)"; var ctl16 = ws.Controls.AddGroupBox(196.8 * ColScale, 97.2, 123 * WidthScale, 59.99); ctl16.Text = "Window mode"; var ctl17 = ws.Controls.AddListBox(360 * ColScale, 41.40, 103.94 * WidthScale, 41.39); ctl17.ItemsSourceRange = ws.Range["$G$14:$G$16"]; ctl17.LinkedCell = ws.Range["$H$14"]; ctl17.SelectedIndex = 0; var ctl18 = ws.Controls.AddButton(360 * ColScale, 91.8, 103.94 * WidthScale, 19.79); ctl18.Text = "Test settings"; ctl18.PrintObject = true; var ctl19 = ws.Controls.AddButton(360 * ColScale, 138.6, 103.94 * WidthScale, 19.80); ctl19.Text = "OK"; ctl19.PrintObject = true; var ctl20 = ws.Controls.AddButton(360 * ColScale, 114.6, 103.94 * WidthScale, 19.79); ctl20.Text = "Cancel"; ctl20.PrintObject = true;
' Create a new Workbook Dim workbook As New Workbook #Region "Fill data" Dim ws As IWorksheet = workbook.Worksheets("Sheet1") Dim rngG2 = "Graphics API" ws.Range("$G$2").Value = rngG2 Dim rngD6E6 = New Object(,) { {"Sharpness", 0R} } ws.Range("$D$6:$E$6").Value = rngD6E6 Dim rngA13A21 = New Object(,) { {"Resolutions"}, {"640x480"}, {"800x600"}, {"1280x720"}, {"1366x768"}, {"1680x1050"}, {"1920x1080"}, {"2560x1440"}, {"3840x2160"} } ws.Range("$A$13:$A$21").Value = rngA13A21 Dim rngB13B14 = New Object(,) { {"Selected"}, {6.0R} } ws.Range("$B$13:$B$14").Value = rngB13B14 Dim rngD13D17 = New Object(,) { {"DLSS"}, {"Off"}, {"Fast"}, {"Balanced"}, {"Quality"} } ws.Range("$D$13:$D$17").Value = rngD13D17 Dim rngE13E14 = New Object(,) { {"Selected"}, {2.0R} } ws.Range("$E$13:$E$14").Value = rngE13E14 Dim rngG13G16 = New Object(,) { {"Graphics API"}, {"DirectX 12"}, {"DirectX 11"}, {"Vulkan 1.3"} } ws.Range("$G$13:$G$16").Value = rngG13G16 Dim rngH13H14 = New Object(,) { {"Selected"}, {1.0R} } ws.Range("$H$13:$H$14").Value = rngH13H14 ws.Range("$E$4").Formula2 = "=INDEX(D14:D17,E14+1,1)" Dim uiBorders = ws.Range("$A$1:$G$10").Borders uiBorders(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Light1 uiBorders(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thin uiBorders(BordersIndex.EdgeLeft).ThemeColor = ThemeColor.Light1 uiBorders(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Thin uiBorders(BordersIndex.EdgeRight).ThemeColor = ThemeColor.Light1 uiBorders(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Thin uiBorders(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Light1 uiBorders(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Thin Dim outBorders = ws.Range("$A$1:$H$11").Borders outBorders(BordersIndex.InsideHorizontal).ThemeColor = ThemeColor.Light1 outBorders(BordersIndex.InsideHorizontal).LineStyle = BorderLineStyle.Thin outBorders(BordersIndex.InsideVertical).ThemeColor = ThemeColor.Light1 outBorders(BordersIndex.InsideVertical).LineStyle = BorderLineStyle.Thin Dim noBorders = ws.Range("$E$6").Borders noBorders(BordersIndex.EdgeBottom).Clear() noBorders(BordersIndex.EdgeLeft).Clear() noBorders(BordersIndex.EdgeRight).Clear() noBorders(BordersIndex.EdgeTop).Clear() noBorders(BordersIndex.InsideHorizontal).Clear() noBorders(BordersIndex.InsideVertical).Clear() ws.Range("$1:$1").RowHeight = 20.4R ws.Range("$2:$2,$4:$4,$6:$10,$12:$13").RowHeight = 16.8R ws.Range("$3:$3").RowHeight = 7.8R ws.Range("$5:$5").RowHeight = 10.2R ws.Range("$11:$11").RowHeight = 17.4R Const ColScale = 0.88 ws.Range("$A:$A").ColumnWidthInPixel = ColScale * 116.0R ws.Range("$G:$G").ColumnWidthInPixel = ColScale * 109.0R ws.Range("$H:$H").ColumnWidthInPixel = ColScale * 73.0R ws.Range("$I:$I").ColumnWidthInPixel = ColScale * 39.0R ws.Range("$L:$L").ColumnWidthInPixel = ColScale * 99.0R Const WidthScale = 0.895 #End Region ws.Controls.AddLabel(12.6 * ColScale, 20.4, 49.19 * WidthScale, 18.6). Text = "Resolution" With ws.Controls.AddDropDown(88.2 * ColScale, 21.59, 99.6 * WidthScale, 14.4) .ItemsSourceRange = ws.Range("$A$14:$A$21") .LinkedCell = ws.Range("$B$14") .SelectedIndex = 5 End With Dim groupBox1 = ws.Controls.AddGroupBox(4.8 * ColScale, 5.4, 475.34 * WidthScale, 160.79) groupBox1.Text = "Display options" ws.PageSetup.PrintArea = $"{groupBox1.TopLeftCell.Address}:{groupBox1.BottomRightCell.Address}" With ws.Controls.AddButton(199.8 * ColScale, 21, 127.8 * WidthScale, 17.4) .Text = "Use native resolution" .PrintObject = True End With ws.Controls.AddLabel(13.8 * ColScale, 45.6, 19.2 * WidthScale, 13.2). Text = "DLSS" ws.Controls.AddCheckBox(12 * ColScale, 73.8, 172.2 * WidthScale, 14.4). Text = "Ray tracing - global light" With ws.Controls.AddCheckBox(12 * ColScale, 90, 172.2 * WidthScale, 14.39) .Value = True .Text = "Ray tracing - shadows" End With With ws.Controls.AddCheckBox(12 * ColScale, 107.39, 172.2 * WidthScale, 14.4) .Value = True .Text = "Ray tracing - reflection" End With Dim ctl9 = ws.Controls.AddCheckBox(12 * ColScale, 124.19, 172.2 * WidthScale, 14.4) ctl9.Text = "Ray tracing - refraction" With ws.Controls.AddScrollBar(89.4 * ColScale, 46.8, 151.2 * WidthScale, 12.6) .LargeChange = 1 .Orientation = FormControlOrientation.Horizontal .Max = 3 .Min = 0 .SmallChange = 1 .LinkedCell = ws.Range("$E$14") .Value = 2 End With With ws.Controls.AddCheckBox(12 * ColScale, 139.79, 172.2 * WidthScale, 14.4) .Value = True .Text = "Ray tracing - ambient light" End With With ws.Controls.AddSpinner(250.2 * ColScale, 72.6, 18 * WidthScale, 15) .Max = 100 .Min = 0 .LinkedCell = ws.Range("$E$6") .Value = 0 End With ws.Controls.AddOptionButton(198.6 * ColScale, 107, 81.6 * WidthScale, 16.79). Text = "Windowed" With ws.Controls.AddOptionButton(198.6 * ColScale, 121.8, 115.2 * WidthScale, 17.39) .Value = True .Text = "Full screen (borderless)" End With ws.Controls.AddOptionButton(198.6 * ColScale, 138, 104.4 * WidthScale, 17.39). Text = "Full screen (monopoly)" ws.Controls.AddGroupBox(196.8 * ColScale, 97.2, 123 * WidthScale, 59.99). Text = "Window mode" With ws.Controls.AddListBox(360 * ColScale, 41.4, 103.94 * WidthScale, 41.39) .ItemsSourceRange = ws.Range("$G$14:$G$16") .LinkedCell = ws.Range("$H$14") .SelectedIndex = 0 End With With ws.Controls.AddButton(360 * ColScale, 91.8, 103.94 * WidthScale, 19.79) .Text = "Test settings" .PrintObject = True End With With ws.Controls.AddButton(360 * ColScale, 138.6, 103.94 * WidthScale, 19.8) .Text = "OK" .PrintObject = True End With With ws.Controls.AddButton(360 * ColScale, 114.6, 103.94 * WidthScale, 19.79) .Text = "Cancel" .PrintObject = True End With ' save to a pdf file workbook.Save("FormControlPdfDisplayOptionsDialog.pdf")