this is a grammar lesson which called "Inversion"
the original sentence as you mentioned above is converted like this : I have never been so glad.
In this case simply the place of auxiliary verb is changed with the subject.
the purpose of this, here is to show and emphasis on the fact that, the subject is very surprised.