Sets _format attribute only if it wasn't set previously by the user.

Fixes #8787