A little off topic here, I've always taken issue with calling spellcasting an Ex ability. I will grant that the only time it's given a type it was given Ex, but I feel that was a mistake in both authorship and editing.
I always treat spellcasting as a "non-ability ability," by this I mean none of Na, Ex, Su, Sp, etc. I realize some people will call this a house rule, but it works. It eliminates that pesky problem where people try to argue Shapechange should grant them cleric spellcasting in Solar form. I also realize it doesn't make Shapechange any less broken, but it helps a little bit.
Check the Monster Manual, page 315 as well as 6. There it states that all special abilities (special attacks are a subset thereof) are all Su, Sp, or Ex. Spells are always listed as a special attack, so they must be a special ability, so they must be one of those types. As such, it can't be a non ability ability (in fact no ability lacks a type... abilities that are none of the above, such as run speed or claw attacks, are Na by default, as per the article "All About Polymorph" and PHB page 180). The specific quote from page 315: "A special ability is either extraordinary (Ex), spell-like (Sp), or supernatural (Su)." This is backed up by the SRD if you'd like to check there.
Since Sp and Su abilities are defined by how they're not spells, spells can't be one of those. Furthermore, because Invoke Magic works in Antimagic Fields, you still have your spellcasting ability in an antimagic field (it's just that none of your spells actually work) so the actual ability to cast spells itself must be non magical even if the spells themselves are magical (much like Wildshape is an Su ability that grants Na abilities like claw attacks). That means they must be Ex.
Also check the Rules of the Game article "All about polymorph" for more details on ability types if this isn't enough information. Page 180 of the PHB may help as well.
And if you don't like that spells are granted by Shapechange, do what I do: don't allow Shapechange anyway because it's a broken spell. Just because something's in the rules doesn't mean you as a DM have to allow it. But at the same time, just because something's overpowered doesn't mean it's not RAW.
JaronK