We study theoretically the spin reorientation transition in thin epitaxial films of NiO grown on Ag and MgO. Experimentally, the Ni spins point out-of-plane for films grown on the MgO substrate and in-plane for those on the Ag substrate. We successfully explain these opposite trends in the ground state moments for the two cases and simulate the isotropic x-ray absorption spectrum (XAS) for bulk NiO, in good agreement with experiments, on the basis of cluster configuration interaction calculations based on a NiO6 cluster. {\textcopyright} 2008 American Institute of Physics.