- Code: Select all
Section workingSection = _agendaDocument.Sections[0];
Table table = workingSection.AddTable(false);
table.ResetCells(1, 2);
Paragraph cellOnePara = table.Rows[0].Cells[0].AddParagraph();
table.Rows[0].Cells[0].CellFormat.VerticalAlignment = VerticalAlignment.Top;
table.Rows[0].Cells[0].Width = 50;
cellOnePara.Text = "Title";
cellOnePara.ApplyStyle("HeadingStyle");
cellOnePara.Format.BeforeAutoSpacing = false;
cellOnePara.Format.BeforeSpacing = 0;
cellOnePara.Format.AfterAutoSpacing = false;
cellOnePara.Format.AfterSpacing = 5;
//Add checkbox content control
Paragraph cellTwoPara = table.Rows[0].Cells[1].AddParagraph();
table.Rows[0].Cells[1].CellFormat.VerticalAlignment = VerticalAlignment.Top;
string checkBoxHtml = @"<input type=""checkbox"" checked=""Checked"">";
cellTwoPara.AppendHTML(checkBoxHtml);
I have a another piece of code that works but the check box style is not according to our requirement. i just need to have a look of simple html checkbox ( both check and unchecked )
below is my working code that the look of the checkbox is not acceptable.
- Code: Select all
Section workingSection = _agendaDocument.Sections[0];
Table table = workingSection.AddTable(false);
table.ResetCells(1, 2);
Paragraph cellOnePara = table.Rows[0].Cells[0].AddParagraph();
table.Rows[0].Cells[0].CellFormat.VerticalAlignment = VerticalAlignment.Top;
table.Rows[0].Cells[0].Width = 50;
cellOnePara.Text = "Title";
cellOnePara.ApplyStyle("HeadingStyle");
cellOnePara.Format.BeforeAutoSpacing = false;
cellOnePara.Format.BeforeSpacing = 0;
cellOnePara.Format.AfterAutoSpacing = false;
cellOnePara.Format.AfterSpacing = 5;
//Add checkbox content control
StructureDocumentTagInline sdt = new StructureDocumentTagInline(_agendaDocument);
Paragraph cellTwoPara = table.Rows[0].Cells[1].AddParagraph();
table.Rows[0].Cells[1].CellFormat.VerticalAlignment = VerticalAlignment.Top;
sdt = new StructureDocumentTagInline(_agendaDocument);
cellTwoPara.ChildObjects.Add(sdt);
sdt.SDTProperties.SDTType = SdtType.CheckBox;
SdtCheckBox scb = new SdtCheckBox();
sdt.SDTProperties.ControlProperties = scb;
TextRange tr = new TextRange(_agendaDocument);
//tr.CharacterFormat.FontName = "MS Gothic";
//tr.CharacterFormat.FontSize = 20;
sdt.ChildObjects.Add(tr);
scb.Checked = true;
sdt.SDTProperties.Alias = "CheckoBox";
sdt.SDTProperties.Tag = "Checkbox";
Can you please advice me how to achive simple html looking checkbox ( please note that output type of the document is PDF )