How to store and retrieve the attachment alignment?

How to store and retrieve the attachment alignment?