public static bool EvaluateSmartArtShape(IQuestion question, string filename, SmartArtShapes _smartArtShape)
{
WordInterop.Application wordApplication = GetOrCreateWordApplication(question.ObjectStore);
try
{
wordApplication.ScreenUpdating = false;
WordInterop.WdAlertLevel displayAlertLevel = wordApplication.DisplayAlerts;
wordApplication.DisplayAlerts = WordInterop.WdAlertLevel.wdAlertsNone;
WordInterop.Document wordDocument = wordApplication.Documents.Open(filename);
bool result = false;
WordInterop.Shape tempSmartShape = null;
WordInterop.Shapes ws = wordDocument.Shapes;
foreach (WordInterop.Shape s in ws)
{
if (s.HasSmartArt == MsoTriState.msoTrue)
{
tempSmartShape = s;
SmartArt _smartArt = tempSmartShape.SmartArt;
string _smartArtName = _smartArt.Layout.Name;
if (_smartArtName.Replace(" ", "").Trim().ToLower() == _smartArtShape.ToString().Trim().ToLower())
result = true;
break;
}
}
wordDocument.Close();
return result;
}
catch (Exception)
{
Cleanup(question.ObjectStore, true);
}
return false;
}