We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Find the Combo box selected value inside table cell

Hi,


I am trying to find the combo box selected value inside the table cell. I have been using the following code. But it is not working. Can you please help me with this: (Attached template)

Aspose.Words.Tables.Table tblEngagementDetails = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true);

foreach (StructuredDocumentTag sdt in tblEngagementDetails.GetChild(NodeType.StructuredDocumentTag, i, true))
{
if (sdt.SdtType == SdtType.ComboBox)
{
SdtListItem secondItem = sdt.ListItems[2];
sdt.ListItems.SelectedValue = secondItem;
}
}

Hi Joe,

We are working on this issue and will update you soon.

Best Regards,

Hi Joe,

The control used in your document is neither a content control nor a form field. It is a ActiveX control which is not supported by Aspose.Words at the moment. A new feature request to support ActiveX has already been logged into our issue tracking system as WORDSNET-1877. We will keep you updated on this issue in this thread.

Currently ActiveX controls can be read as a Shape. so you need to replace StructuredDocumentTag with a Shape in your code.

If you want to use content controls, you can use the following code.

var doc = new Document("Sample.docx");

<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true, true))

{

if (sdt.SdtType == SdtType.DropDownList)

{

SdtListItem secondItem = sdt.ListItems[2];

sdt.ListItems.SelectedValue = secondItem;

Console.WriteLine(sdt.ListItems.SelectedValue.Value);

}

else if (sdt.SdtType == SdtType.ComboBox)

{

SdtListItem secondItem = sdt.ListItems[1];

sdt.ListItems.SelectedValue = secondItem;

Console.WriteLine(sdt.ListItems.SelectedValue.Value);

}

}

doc.Save(“AsposeOut.Docx”);

Best Regards,

The issues you have found earlier (filed as WORDSNET-1877) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(6)