Structure of magnetic fields in spiral galaxies