|
24 | 24 | // Add text to the paragraph. |
25 | 25 | paragraph.AppendText("Gender:\tFemale "); |
26 | 26 | // Append checkbox content control to the paragraph for the "checked" option. |
27 | | - IInlineContentControl checkedCheckBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox); |
| 27 | + IInlineContentControl checkBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox); |
28 | 28 | // Set the checked state of the checkbox content control to display the tick symbol when selected |
29 | | - checkedCheckBox.ContentControlProperties.CheckedState = tickState; |
| 29 | + checkBox.ContentControlProperties.CheckedState = tickState; |
30 | 30 | // Set the unchecked state of the checkbox content control to display an empty box when not selected |
31 | | - checkedCheckBox.ContentControlProperties.UncheckedState = unTickState; |
| 31 | + checkBox.ContentControlProperties.UncheckedState = unTickState; |
32 | 32 | // Set the initial state of the "Female" checkbox to checked |
33 | | - checkedCheckBox.ContentControlProperties.IsChecked = true; |
| 33 | + checkBox.ContentControlProperties.IsChecked = true; |
34 | 34 |
|
35 | 35 | // Add text to the paragraph. |
36 | 36 | paragraph.AppendText("\tMale "); |
37 | 37 | // Append checkbox content control to the paragraph for the "unchecked" option. |
38 | | - IInlineContentControl uncheckedCheckBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox); |
| 38 | + checkBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox); |
39 | 39 | // Set the checked and unchecked states. |
40 | | - uncheckedCheckBox.ContentControlProperties.CheckedState = tickState; |
41 | | - uncheckedCheckBox.ContentControlProperties.UncheckedState = unTickState; |
| 40 | + checkBox.ContentControlProperties.CheckedState = tickState; |
| 41 | + checkBox.ContentControlProperties.UncheckedState = unTickState; |
42 | 42 | // Set the initial state of the "Male" checkbox to unchecked |
43 | | - uncheckedCheckBox.ContentControlProperties.IsChecked = false; |
| 43 | + checkBox.ContentControlProperties.IsChecked = false; |
44 | 44 |
|
45 | 45 | // Save the document. |
46 | 46 | using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.OpenOrCreate, FileAccess.ReadWrite)) |
|
0 commit comments