Prefill Dropdown List Controls in Word DOCX Document with Dynamics Dataset | Combo Box List Items LINQ Reporting Engine C# .NET

Hi,

For now, in Word, I have a static dropdown list.
for example, I can have a dropdown with several business centre to be selected.
image.png (35.1 KB)

Is that possible, to prefill it with a list?,
such as <<[BusinessCentreList]>>, using the Linq Reporting Engine

Regards,
Zhenyu

@zhenyu.wang,

One way of adding Drop-Down List Content Control (StructuredDocumentTag) in Word document and dynamically populating it with some choices is as follows:

Document doc = new Document("C:\\Temp\\input.docx");

StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.DropDownList, MarkupLevel.Inline);

for (int i = 0; i < 5; i++)
    sdt.ListItems.Add(new SdtListItem("Display Text " + i, i.ToString()));

sdt.ListItems.SelectedValue = sdt.ListItems[0];

doc.LastSection.Body.LastParagraph.AppendChild(sdt);

doc.Save("C:\\Temp\\20.10.docx");

Hi Hafeez,

Thanks for a quick reply.

However that solution is NOT Linq Reporting Engine
I prefer something like <<[]>> directly in Word document.

for that solution, I need to change code every time when generating Word document.

Also what if

  • in some Word document, I need 3 drop down list controls
  • in other Word documents, I need different 5 drop down list controls

Regards,
Zhenyu

@zhenyu.wang,

We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-21363. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

The issues you have found earlier (filed as WORDSNET-21363) have been fixed in this Aspose.Words for .NET 21.2 update and this Aspose.Words for Java 21.2 update.