c# - Find out if item exists in Microsoft.Office.Interop.Word.Styles collection -


I'm trying to use an item on the collection of styles of a word document, I was wondering if anyone The way to know if an item with something is present without throwing an exception.

I am doing something like this now:

  newStyle = _document.Styles.get_Item (ref styleName);  

This works when the item exists, if it does not fail (I know that I can use an attempt / hold block, but I do not want to. < / P>

Thank you for your help

You need to loop on style and name it Check, and Exit Loop if you have a match.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -