We have a scenario where the client is wanting a combobox in a generated Word document to have the color of the combobox change depending on the option selected (these combo boxes are repeated many times in the document so the colour change is important to the client.
Screenshot shows the Combobox in use. Below is the snippet of my code. Is there a way to do what I am after?
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
// In my source (an html document that was converted to a Word Document higher in the code) "#ddlApplies" is where I need to place a ComboBox
// It is in a table cell.
ReadOnlyCollection<FindResult> findResults = editor.FindAll("#ddlApplies", matchCase: false, matchWholeWord: false);
foreach (var item in findResults)
{
string foundVal = item.Runs[0].Text.Replace("#", "");
// The full run name consists of "#ddl|Identifier". In Furture dev we will use the Identifier (which is put in as the alias) to identify which control this is so we can read in the document and update other datasets
//var ddlContentControl = editor.InsertStructuredDocumentTag(SdtType.ComboBox);
ComboBoxProperties properties = new ComboBoxProperties();
// Complies --- Green
// Does not Comply --- Red
// Minor Variation --- Orange
// N/A -- Grey
properties.Items.Add(new ListItem() { DisplayText = "Complies", Value = "Complies" });
properties.Items.Add(new ListItem() { DisplayText = "Does not Comply", Value = "Does not Comply" });
properties.Items.Add(new ListItem() { DisplayText = "Minor Variation", Value = "Minor Variation" });
properties.Items.Add(new ListItem() { DisplayText = "N/A", Value = "N/A" });
// Setting the alias with the identifier.
properties.Alias = foundVal.Split("|")[1];
properties.Lock = Lock.SdtLocked;
properties.Placeholder = new Placeholder() {
PlaceholderText = "Select",
ShowPlaceholder = true
};
properties.OutlineAppearance = OutlineAppearance.BoundingBoxes;
//setting the properties
properties.RunProperties.CopyPropertiesFrom(item.Runs[0].Properties);
/***
Here is where I think I need to set things. But not sure how. Client wants each option to have a different colour. They would prefer the whole cell to change, but happy if I can just get the ComboBox to change.
***/
//inserting the Tag and setting the default value
editor.MoveToInlineStart(item.Runs[0]);
editor.InsertStructuredDocumentTag(properties, item.Runs[0], item.Runs[0]);
item.Runs[0].Text = "Select";
}