Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

Word dropdown, set selection

$
0
0

Plain and simply, I have a c:\dropdowntest.docx file that has nothing but one single dropdown list. The dropdown list has two options, "Option1" and "Option2". The file is saved so that "Option1" is selected. How do I select the "Option2" by using the Open XML SDK in C#?

Here's a start for the code, so I'm for example able to refer to the dropdown list:

privatestaticvoidLoopElements(WordprocessingDocument wordDocument){List<SdtElement> sdtelements = wordDocument.MainDocumentPart.Document.Descendants<SdtElement>().ToList();foreach(var contentcontrol in sdtelements){var listitems = contentcontrol.Descendants<ListItem>().ToList();if(listitems.Count>0){SdtRun xStdRun =(SdtRun)contentcontrol;


Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>