// Create a pdf file stream using FileStream outputStream = new FileStream("FormControlMapPdfFormField.pdf", FileMode.Create); //create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; ws.Range["$A$1"].Value = "Skirmish: Game Settings"; ws.Range["$D$3:$E$7"].Value = "Initial funds"; ws.Range["$G$3:$H$7"].Value = "Map preview"; ws.Range["$A$9:$A$11"].Value = new object[,] { { "Player"}, { "You"}, { "AI Player 1"} }; ws.Range["$B$9:$C$10"].Value = new object[,] { { "AI Level", null}, { "-", null} }; ws.Range["$D$9:$E$9"].Value = new object[,] { { "Side", "Color"} }; ws.Range["$F$9:$G$11"].Value = new object[,] { { "Team", null}, { "-", null}, { "-", null} }; ws.Range["$H$9"].Value = "Ready"; var a1Fnt = ws.Range["$A$1"].Font; a1Fnt.ThemeColor = ThemeColor.Accent4; a1Fnt.Name = "游ゴシック"; a1Fnt.Size = 16d; var a2Fnt = ws.Range["$A$2:$F$2"].Font; a2Fnt.Name = "游ゴシック"; a2Fnt.Size = 16d; var b1Fnt = ws.Range["$B$1:$H$1,$A$9:$A$11,$B$9:$H$9"].Font; b1Fnt.ThemeColor = ThemeColor.Accent4; b1Fnt.Name = "游ゴシック"; var a1Back = ws.Range["$A$1:$H$1,$A$9:$A$11,$B$9:$H$9"].Interior; a1Back.ThemeColor = ThemeColor.Dark1; a1Back.Pattern = Pattern.Solid; a1Back.PatternColor = Color.Black; a1Back.PatternColorIndex = -4105; var a3Back = ws.Range["$A$3:$B$7,$D$3:$E$7,$G$3:$H$7"].Interior; a3Back.Color = Color.FromArgb(unchecked((int)0xFFDDEBF7)); var a1Border = ws.Range["$A$1:$G$1,$A$3,$D$3,$G$3,$A$9"].Borders; a1Border[BordersIndex.EdgeLeft].ColorIndex = 57; a1Border[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Thin; a1Border[BordersIndex.EdgeTop].ColorIndex = 57; a1Border[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Thin; var a4Border = ws.Range["$A$4:$A$6,$D$4:$D$6,$G$4:$G$6"].Borders; a4Border[BordersIndex.EdgeLeft].ColorIndex = 57; a4Border[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Thin; var a7Border = ws.Range["$A$7,$D$7,$G$7,$A$11"].Borders; a7Border[BordersIndex.EdgeBottom].ColorIndex = 57; a7Border[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thin; a7Border[BordersIndex.EdgeLeft].ColorIndex = 57; a7Border[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Thin; var a10Border = ws.Range["$A$10"].Borders; a10Border[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Accent4; a10Border[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thin; a10Border[BordersIndex.EdgeLeft].ColorIndex = 57; a10Border[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Thin; a10Border[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Accent4; a10Border[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Thin; var b3Border = ws.Range["$B$3,$E$3,$H$3,$H$9"].Borders; b3Border[BordersIndex.EdgeRight].ColorIndex = 57; b3Border[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Thin; b3Border[BordersIndex.EdgeTop].ColorIndex = 57; b3Border[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Thin; var b4Border = ws.Range["$B$4:$B$6,$E$4:$E$6,$H$4:$H$6,$H$10"].Borders; b4Border[BordersIndex.EdgeRight].ColorIndex = 57; b4Border[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Thin; var b7Border = ws.Range["$B$7,$E$7,$H$7,$H$11"].Borders; b7Border[BordersIndex.EdgeBottom].ColorIndex = 57; b7Border[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thin; b7Border[BordersIndex.EdgeRight].ColorIndex = 57; b7Border[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Thin; var h1Border = ws.Range["$H$1,$B$9:$G$9"].Borders; h1Border[BordersIndex.EdgeTop].ColorIndex = 57; h1Border[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Thin; var b11Border = ws.Range["$B$11:$G$11"].Borders; b11Border[BordersIndex.EdgeBottom].ColorIndex = 57; b11Border[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thin; var a1 = ws.Range["$A$1"]; a1.HorizontalAlignment = HorizontalAlignment.Left; a1.AddIndent = false; var a2 = ws.Range["$A$2:$F$2"]; a2.VerticalAlignment = VerticalAlignment.Center; a2.AddIndent = false; var b1 = ws.Range["$B$1:$F$1,$G$1:$H$2,$A$3:$B$7,$A$9,$B$9:$C$11,$D$9:$E$9,$F$9:$G$11,$H$9"]; b1.HorizontalAlignment = HorizontalAlignment.Center; b1.AddIndent = false; var a10 = ws.Range["$A$10:$A$11"]; a10.HorizontalAlignment = HorizontalAlignment.Center; a10.VerticalAlignment = VerticalAlignment.Center; a10.AddIndent = false; var d3 = ws.Range["$D$3:$E$7,$G$3:$H$7"]; d3.HorizontalAlignment = HorizontalAlignment.Center; d3.VerticalAlignment = VerticalAlignment.Top; d3.AddIndent = false; ws.Range["$D$3:$E$7"].Merge(); ws.Range["$A$3:$B$7"].Merge(); ws.Range["$F$10:$G$10"].Merge(); ws.Range["$F$11:$G$11"].Merge(); ws.Range["$B$10:$C$10"].Merge(); ws.Range["$B$11:$C$11"].Merge(); ws.Range["$B$9:$C$9"].Merge(); ws.Range["$G$3:$H$7"].Merge(); ws.Range["$G$1:$H$1"].Merge(); ws.Range["$F$9:$G$9"].Merge(); ws.Range["$1:$1"].RowHeight = 24.6d; ws.Range["$2:$2"].RowHeight = 6d; ws.Range["$10:$10"].RowHeight = 19.8d; ws.Range["$11:$11"].RowHeight = 22.8d; ws.Range["$A:$A"].ColumnWidthInPixel = 111d; ws.Range["$B:$B"].ColumnWidthInPixel = 95d; ws.Range["$C:$C,$F:$F"].ColumnWidthInPixel = 11d; ws.Range["$D:$D"].ColumnWidthInPixel = 105d; ws.Range["$E:$E"].ColumnWidthInPixel = 83d; var ctl1 = ws.Controls.AddDropDown(179.55, 46.80, 102.63, 21.00); ctl1.Items.Add(new DropDownItem("10000")); ctl1.Items.Add(new DropDownItem("15000")); ctl1.Items.Add(new DropDownItem("20000")); ctl1.Items.Add(new DropDownItem("30000")); ctl1.SelectedIndex = 0; var ctl2 = ws.Controls.AddCheckBox(175.95, 70.20, 99.15, 17.40); ctl2.IsChecked = true; ctl2.Text = "Generate crates"; var ctl3 = ws.Controls.AddDropDown(85.65, 157.80, 72.45, 16.80); ctl3.Items.Add(new DropDownItem("Easy")); ctl3.Items.Add(new DropDownItem("Normal")); ctl3.Items.Add(new DropDownItem("Hard")); ctl3.Items.Add(new DropDownItem("Brutal")); ctl3.SelectedIndex = 2; var ctl4 = ws.Controls.AddCheckBox(175.95, 87.60, 99.15, 16.80); ctl4.IsChecked = true; ctl4.Text = "Tiberium grows"; var ctl5 = ws.Controls.AddDropDown(165.75, 138.00, 66.60, 15.60); ctl5.Items.Add(new DropDownItem("GDI")); ctl5.Items.Add(new DropDownItem("Nod")); ctl5.Items.Add(new DropDownItem("Scrin")); ctl5.SelectedIndex = 0; var ctl6 = ws.Controls.AddDropDown(165.75, 157.80, 66.00, 16.80); ctl6.Items.Add(new DropDownItem("GDI")); ctl6.Items.Add(new DropDownItem("Nod")); ctl6.Items.Add(new DropDownItem("Scrin")); ctl6.SelectedIndex = 1; var ctl7 = ws.Controls.AddCheckBox(380.40, 136.80, 19.20, 18.00); ctl7.Text = ""; var ctl8 = ws.Controls.AddCheckBox(380.40, 157.80, 19.20, 18.00); ctl8.IsChecked = true; ctl8.Text = ""; ; var ctl9 = ws.Controls.AddDropDown(243.90, 138.60, 51.00, 14.40); ctl9.Items.Add(new DropDownItem("Random")); ctl9.Items.Add(new DropDownItem("Red")); ctl9.Items.Add(new DropDownItem("Green")); ctl9.Items.Add(new DropDownItem("Blue")); ctl9.Items.Add(new DropDownItem("Yellow")); ctl9.Items.Add(new DropDownItem("Purple")); ctl9.SelectedIndex = 0; var ctl10 = ws.Controls.AddDropDown(243.90, 159.00, 51.00, 15.60); ctl10.Items.Add(new DropDownItem("Random")); ctl10.Items.Add(new DropDownItem("Red")); ctl10.Items.Add(new DropDownItem("Green")); ctl10.Items.Add(new DropDownItem("Blue")); ctl10.Items.Add(new DropDownItem("Yellow")); ctl10.Items.Add(new DropDownItem("Purple")); ctl10.SelectedIndex = 0; var ctl11 = ws.Controls.AddListBox(3.60, 34.20, 140.25, 67.80); ctl11.Items.Add(new ListBoxItem("Infinite Isle (2)")); ctl11.Items.Add(new ListBoxItem("Temple Prime (2)")); ctl11.Items.Add(new ListBoxItem("Industrial Strength (2)")); ctl11.Items.Add(new ListBoxItem("Hot Spring (2-4)")); ctl11.Items.Add(new ListBoxItem("Motherland (2-6)")); ctl11.SelectedIndex = 0; var shp1 = ws.Shapes.AddShape(AutoShapeType.Oval, 371.56, 49.40, 24.57, 31.17); shp1.Fill.Color.RGB = Color.FromArgb(unchecked((int)0xFFFFDB96)); shp1.Line.Color.RGB = Color.FromArgb(unchecked((int)0xFFFFC000)); shp1.Line.Weight = 0.5; var shp2 = ws.Shapes.AddShape(AutoShapeType.Oval, 330.44, 68.04, 26.36, 31.81); shp2.Fill.Color.RGB = Color.FromArgb(unchecked((int)0xFFFFDB96)); shp2.Line.Color.RGB = Color.FromArgb(unchecked((int)0xFFFFC000)); shp2.Line.Weight = 0.5; var shp3 = ws.Shapes.AddShape(AutoShapeType.Rectangle, 338.40, 67.06, 54.75, 15.07); shp3.Fill.Color.RGB = Color.FromArgb(unchecked((int)0xFFFFC000)); shp3.Line.Color.RGB = Color.White; shp3.Line.Weight = 1.5; shp3.Rotation = 36.5; var ctl12 = ws.Controls.AddOptionButton(334.42, 79.07, 14.92, 17.15); ctl12.IsChecked = true; ctl12.Text = "1"; var ctl13 = ws.Controls.AddOptionButton(378.22, 51.41, 14.92, 17.15); ctl13.Text = "2"; workbook.Save(outputStream, new PdfSaveOptions { FormFields = true }); // close the pdf stream outputStream.Close();
' Create a pdf file stream Dim outputStream = File.Create("FormControlMapPdfFormField.pdf") ' Create a new Workbook Dim workbook As New Workbook Dim ws = workbook.Worksheets("Sheet1") ws.Range("$A$1").Value = "Skirmish: Game Settings" ws.Range("$D$3:$E$7").Value = "Initial funds" ws.Range("$G$3:$H$7").Value = "Map preview" ws.Range("$A$9:$A$11").Value = New Object(,) { {"Player"}, {"You"}, {"AI Player 1"} } ws.Range("$B$9:$C$10").Value = New Object(,) { {"AI Level", Nothing}, {"-", Nothing} } ws.Range("$D$9:$E$9").Value = New Object(,) { {"Side", "Color"} } ws.Range("$F$9:$G$11").Value = New Object(,) { {"Team", Nothing}, {"-", Nothing}, {"-", Nothing} } ws.Range("$H$9").Value = "Ready" With ws.Range("$A$1").Font .ThemeColor = ThemeColor.Accent4 .Name = "游ゴシック" .Size = 16.0R End With With ws.Range("$A$2:$F$2").Font .Name = "游ゴシック" .Size = 16.0R End With With ws.Range("$B$1:$H$1,$A$9:$A$11,$B$9:$H$9").Font .ThemeColor = ThemeColor.Accent4 .Name = "游ゴシック" End With With ws.Range("$A$1:$H$1,$A$9:$A$11,$B$9:$H$9").Interior .ThemeColor = ThemeColor.Dark1 .Pattern = Pattern.Solid .PatternColor = Color.Black .PatternColorIndex = -4105 End With ws.Range("$A$3:$B$7,$D$3:$E$7,$G$3:$H$7").Interior.Color = Color.FromArgb(&HFFDDEBF7) With ws.Range("$A$1:$G$1,$A$3,$D$3,$G$3,$A$9").Borders .Item(BordersIndex.EdgeLeft).ColorIndex = 57 .Item(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeTop).ColorIndex = 57 .Item(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Thin End With With ws.Range("$A$4:$A$6,$D$4:$D$6,$G$4:$G$6").Borders .Item(BordersIndex.EdgeLeft).ColorIndex = 57 .Item(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Thin End With With ws.Range("$A$7,$D$7,$G$7,$A$11").Borders .Item(BordersIndex.EdgeBottom).ColorIndex = 57 .Item(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeLeft).ColorIndex = 57 .Item(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Thin End With With ws.Range("$A$10").Borders .Item(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Accent4 .Item(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeLeft).ColorIndex = 57 .Item(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Accent4 .Item(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Thin End With With ws.Range("$B$3,$E$3,$H$3,$H$9").Borders .Item(BordersIndex.EdgeRight).ColorIndex = 57 .Item(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeTop).ColorIndex = 57 .Item(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Thin End With With ws.Range("$B$4:$B$6,$E$4:$E$6,$H$4:$H$6,$H$10").Borders .Item(BordersIndex.EdgeRight).ColorIndex = 57 .Item(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Thin End With With ws.Range("$B$7,$E$7,$H$7,$H$11").Borders .Item(BordersIndex.EdgeBottom).ColorIndex = 57 .Item(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thin .Item(BordersIndex.EdgeRight).ColorIndex = 57 .Item(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Thin End With With ws.Range("$H$1,$B$9:$G$9").Borders .Item(BordersIndex.EdgeTop).ColorIndex = 57 .Item(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Thin End With With ws.Range("$B$11:$G$11").Borders .Item(BordersIndex.EdgeBottom).ColorIndex = 57 .Item(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thin End With With ws.Range("$A$1") .HorizontalAlignment = HorizontalAlignment.Left .AddIndent = False End With With ws.Range("$A$2:$F$2") .VerticalAlignment = VerticalAlignment.Center .AddIndent = False End With With ws.Range("$B$1:$F$1,$G$1:$H$2,$A$3:$B$7,$A$9,$B$9:$C$11,$D$9:$E$9,$F$9:$G$11,$H$9") .HorizontalAlignment = HorizontalAlignment.Center .AddIndent = False End With With ws.Range("$A$10:$A$11") .HorizontalAlignment = HorizontalAlignment.Center .VerticalAlignment = VerticalAlignment.Center .AddIndent = False End With With ws.Range("$D$3:$E$7,$G$3:$H$7") .HorizontalAlignment = HorizontalAlignment.Center .VerticalAlignment = VerticalAlignment.Top .AddIndent = False End With ws.Range("$D$3:$E$7").Merge() ws.Range("$A$3:$B$7").Merge() ws.Range("$F$10:$G$10").Merge() ws.Range("$F$11:$G$11").Merge() ws.Range("$B$10:$C$10").Merge() ws.Range("$B$11:$C$11").Merge() ws.Range("$B$9:$C$9").Merge() ws.Range("$G$3:$H$7").Merge() ws.Range("$G$1:$H$1").Merge() ws.Range("$F$9:$G$9").Merge() ws.Range("$1:$1").RowHeight = 24.6R ws.Range("$2:$2").RowHeight = 6.0R ws.Range("$10:$10").RowHeight = 19.8R ws.Range("$11:$11").RowHeight = 22.8R ws.Range("$A:$A").ColumnWidthInPixel = 111.0R ws.Range("$B:$B").ColumnWidthInPixel = 95.0R ws.Range("$C:$C,$F:$F").ColumnWidthInPixel = 11.0R ws.Range("$D:$D").ColumnWidthInPixel = 105.0R ws.Range("$E:$E").ColumnWidthInPixel = 83.0R With ws.Controls.AddDropDown(179.55, 46.8, 102.63, 21.0) With .Items .Add(New DropDownItem("10000")) .Add(New DropDownItem("15000")) .Add(New DropDownItem("20000")) .Add(New DropDownItem("30000")) End With .SelectedIndex = 0 End With With ws.Controls.AddCheckBox(175.95, 70.2, 99.15, 17.4) .IsChecked = True .Text = "Generate crates" End With With ws.Controls.AddDropDown(85.65, 157.8, 72.45, 16.8) With .Items .Add(New DropDownItem("Easy")) .Add(New DropDownItem("Normal")) .Add(New DropDownItem("Hard")) .Add(New DropDownItem("Brutal")) End With .SelectedIndex = 2 End With With ws.Controls.AddCheckBox(175.95, 87.6, 99.15, 16.8) .IsChecked = True .Text = "Tiberium grows" End With With ws.Controls.AddDropDown(165.75, 138.0, 66.6, 15.6) With .Items .Add(New DropDownItem("GDI")) .Add(New DropDownItem("Nod")) .Add(New DropDownItem("Scrin")) End With .SelectedIndex = 0 End With With ws.Controls.AddDropDown(165.75, 157.8, 66.0, 16.8) With .Items .Add(New DropDownItem("GDI")) .Add(New DropDownItem("Nod")) .Add(New DropDownItem("Scrin")) End With .SelectedIndex = 1 End With ws.Controls.AddCheckBox(380.4, 136.8, 19.2, 18.0).Text = "" With ws.Controls.AddCheckBox(380.4, 157.8, 19.2, 18.0) .IsChecked = True .Text = "" End With With ws.Controls.AddDropDown(243.9, 138.6, 51.0, 14.4) With .Items .Add(New DropDownItem("Random")) .Add(New DropDownItem("Red")) .Add(New DropDownItem("Green")) .Add(New DropDownItem("Blue")) .Add(New DropDownItem("Yellow")) .Add(New DropDownItem("Purple")) End With .SelectedIndex = 0 End With With ws.Controls.AddDropDown(243.9, 159.0, 51.0, 15.6) With .Items .Add(New DropDownItem("Random")) .Add(New DropDownItem("Red")) .Add(New DropDownItem("Green")) .Add(New DropDownItem("Blue")) .Add(New DropDownItem("Yellow")) .Add(New DropDownItem("Purple")) End With .SelectedIndex = 0 End With With ws.Controls.AddListBox(3.6, 34.2, 140.25, 67.8) With .Items .Add(New ListBoxItem("Infinite Isle (2)")) .Add(New ListBoxItem("Temple Prime (2)")) .Add(New ListBoxItem("Industrial Strength (2)")) .Add(New ListBoxItem("Hot Spring (2-4)")) .Add(New ListBoxItem("Motherland (2-6)")) End With .SelectedIndex = 0 End With With ws.Shapes.AddShape(AutoShapeType.Oval, 371.56, 49.4, 24.57, 31.17) .Fill.Color.RGB = Color.FromArgb(&HFFFFDB96) .Line.Color.RGB = Color.FromArgb(&HFFFFC000) .Line.Weight = 0.5 End With With ws.Shapes.AddShape(AutoShapeType.Oval, 330.44, 68.04, 26.36, 31.81) .Fill.Color.RGB = Color.FromArgb(&HFFFFDB96) .Line.Color.RGB = Color.FromArgb(&HFFFFC000) .Line.Weight = 0.5 End With With ws.Shapes.AddShape(AutoShapeType.Rectangle, 338.4, 67.06, 54.75, 15.07) .Fill.Color.RGB = Color.FromArgb(&HFFFFC000) .Line.Color.RGB = Color.White .Line.Weight = 1.5 .Rotation = 36.5 End With With ws.Controls.AddOptionButton(334.42, 79.07, 14.92, 17.15) .IsChecked = True .Text = "1" End With ws.Controls.AddOptionButton(378.22, 51.41, 14.92, 17.15).Text = "2" workbook.Save(outputStream, New PdfSaveOptions With {.FormFields = True}) ' close the pdf stream outputStream.Close()