Hi We are using ASPOSE library to parse a word document containing dropdown values.
It looks like some tags are read OK , but others not. Eg : tag3 in code below. There is no issue with some documents, but some do fail.
Sample code tried :
public async Task<ActionResult> UploadProcess(HttpPostedFileBase files, Guid? reviewID)
{
var IsDocumentTagsExist = true;
if (reviewID.HasValue)
{
var model = new FileUploadModel();
//------
//-------
var fileData = await files.InputStream.CopyToArrayAsync();
IsReviewTagsExist = _reviewApi.CheckDocumentFormTags(fileData);
if (IsReviewTagsExist)
{
await _sampleApi.ProcessFileUploadAsync(model, fileData);
}
}
return Json(new { DocumentTagsExist = IsDocumentTagsExist }, "text/plain");
}
public bool CheckDocumentFormTags(byte[] fileData)
{
var IsDocumentTagsExist = false;
var IsTag1Exist = false;
var IsTag2Exist = false;
var IsTag3Exist = false;
var doc = new Document(new MemoryStream(fileData));
var sdtNodes = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);
foreach (StructuredDocumentTag sdt in sdtNodes)
{
switch (sdt.Tag.ToLower())
{
case "tag1":
//code to read values goes here
IsTag1Exist = true;
break;
case "tag2":
//code to read values goes here
IsTag2Exist = true;
break;
case "tag3": // ISSUE HERE , tag3 is not read.
//code to read values goes here
IsTag3Exist = true;
break;
default:
break;
}
}
}
thanks
george