antonmihaylov / OpenXmlTemplates

Word .docx templating system that is designer (no scripting tags) and server-friendly (no word installation required)
GNU Lesser General Public License v3.0
89 stars 25 forks source link

Error: The provided SdtElement is not a content control #12

Closed dgwaldo closed 4 years ago

dgwaldo commented 4 years ago

Hitting that error again, this time my template starts off with an SdtRow... Is there a better way to check for this? Looks like all these elements use SdtElement as the base class... Are some SdtElement not content controls?

return e is SdtBlock || e is SdtRun || e is SdtCell || e is SdtRow;

antonmihaylov commented 4 years ago

That makes sense actually.

According to https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.sdtelement?view=openxml-2.8.1

you have all the SdtElements listed there, except SdtRunRuby. I'm not sure what it is, but most likely another version of an StdRun.

I think it would be safe to say that checking for is SdtElement is a good idea.