I try to replace some #PlaceholderText#´s with
StructuredDocumentTag´s. For that I also need to copy the Style.
Everything works fine except some Exception with few .odt Documents.
When I try to set the StyleIdentifier I get the Exception mentioned above.
There are a lot of styles listed in StyleIdentifier enum; however, these all styles are not required to be embedded in the document. MS Word creates these styles when it is necessary. The main purpose of StyleIdentifier is language independence i.e. the names of built-in styles in MS Word are localized for different languages and using a style identifier you can find the correct style regardless of the document language.
Regarding the exception, most likely it occurs because you document does not contain a specific style. You can use code like the following to check whether a style exists:
// Get style.
Style style = doc.Styles[StyleIdentifier.SubtleEmphasis];
// Check whether style exists
if (style != null)
{
// Do something
}