Change to indirect speech: He said, "What a beautiful painting!"
AHe exclaimed what a beautiful painting it is.
BHe exclaimed that it was a beautiful painting. ✓
CHe said that what a beautiful painting it was.
DHe told that it was a beautiful painting.
Explanation
Option B (He exclaimed that it was a beautiful painting.) correctly applies the required reporting structure and tense/pronoun changes.