How to insert a checkbox checked into my word document

I am not sure how to insert a checkbox checked into my word document

programaticly as I am genereting content to a word docx using vb.net(asp.net), I have tried copying a value from a label control and also chr(254) from a font control with wingdings set as font family perhaps there is an easy way?
thanks

This message was posted using Email2Forum by alexey.noskov.

Hi

Thanks for your inquiry. There are at least two ways of inserting checkboxes into the word document:

  1. Insert checkbox as MS Word FormField. Here is code example:
// Create document and DocumentBuidler object
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCheckBox("check1", true, 10);
builder.Writeln(" - Checked");
builder.InsertCheckBox("check2", false, 10);
builder.Writeln(" - Unchecked");
// Save output document.
doc.Save(@"Test001\out.doc");
  1. Insert wingding symbols:
// Create document and DocumentBuidler object
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PushFont();
builder.Font.Name = "Wingdings 2";
builder.Font.Size = 20;
builder.Write("\x0052");
builder.PopFont();
builder.Writeln(" - Checked");
builder.PushFont();
builder.Font.Name = "Wingdings 2";
builder.Font.Size = 20;
builder.Write("\x00A3");
builder.PopFont();
builder.Writeln(" - Unchecked");
// Save output document.
doc.Save(@"Test001\out.doc");

Hope this helps.
Best regards.

thank you for your response , but this is not exactly what I needed
I have a bookmark and I need to insert the checkbox into the bookmark
as in

Dim checkboxsection = docWord.Range.Bookmarks("checkboxsection")
checkboxsection.Text = ?

Hi

Thanks for your inquiry. You can just move DocumentBuilder cursor to the bookmark and insert checkbox. Please see the following code:

Document doc = new Document(@"Test001\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
// Move DocumentBuilder cursor to the bookmark.
builder.MoveToBookmark("mybk");
// Insert checkbox.
// ..........................

Best regards.