You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My .docx file has a drop-down field that other users fill in, then send back to me for parsing. The dropdown is in a table. I would like to be able to extract the drop-down field.
Currently, I can iterate to the table tag and get the paragraph, but it's empty.
Description
In the underlying docx XML, the list is a ddList and it has a result value, which is an index into the list. There's a good example here of the specification and how to check the value.
Sample Code
Here's how much work it takes to get this value right now:
vartable= ...
var answersRow = table.getRow(1);// or whichever rowvarcellWithDropDown= answersRow.GetCell(3);// or whichever cell has the dropdown// Parse the value!vartc= cellWithDropDown.getCTTc90;varp= tc.Items.toArray().Single(t => t is CT_P)as CT_P;varr= p.Items.ToArray().Where(t => t is CT_R).Select(t => t as CT_R);r= r.Where(r2 => r2.items.ToArray().Any(t => t is CT_FldChar));List<CT_FldChar>fldChars=new();foreach(var r3 in r){
fldChars.AddRange(r.Items.ToArray().Where(t => t is CT_FldChar).Select(t => t as CT_FldChar));}varffData= fldChars.Single(t => t.ffData !=null).ffData;varddl= ffData.Items.Single(t => t is CT_FFDDList)as CT_FFDDList;varindex=int.Parse(ddl.result.val);varvalue= ddl.listEntry[index].val;// value now has the string value from the dropdown
The text was updated successfully, but these errors were encountered:
NPOI Version Used
2.6.2
File Type
Use Case
My .docx file has a drop-down field that other users fill in, then send back to me for parsing. The dropdown is in a table. I would like to be able to extract the drop-down field.
Currently, I can iterate to the table tag and get the paragraph, but it's empty.
Description
In the underlying docx XML, the list is a
ddList
and it has aresult
value, which is an index into the list. There's a good example here of the specification and how to check the value.Sample Code
Here's how much work it takes to get this value right now:
The text was updated successfully, but these errors were encountered: