N3
ことに
To one's (surprise / joy / regret), What is (Adj) is that
珍しいことに、彼がいいレストランに連れていってくれた。
In a particularly rare occurrence, he took me to a good restaurant.
Explanation
「~ことに」 goes at the start of a sentence. It first states the speaker's strong feeling about what is coming (joy, regret, surprise, sadness), setting the emotional tone for what follows. It means 'what is... is that...'. It follows an adjective of feeling (na-adjective plus 「な」) or the 「た」 form of a verb: 「嬉しいことに、試験に合格した」 (Happily, I passed the exam); 「残念なことに、雨が降った」 (Unfortunately, it rained).
Mixed up with
「~ことに」 is at the start, as an adverbial: 「嬉しいことに、合格した」. 「~ことか」 is at the end, an exclamation that goes with 「どんなに」: 「どんなに嬉しかったことか」 (How happy I was!). Position and structure are completely different, and exams mix them up.
It needs the speaker's feeling or mental judgement before it, not a plain objective fact: 「×雨が降ったことに」 is wrong.