Placed at the start of a sentence to state the speaker's emotional reaction to what follows: 'to my surprise / joy / regret, ...'. It front-loads the feeling before revealing the fact. It attaches to emotion words such as 驚いた, 嬉しい, 残念な, 困った.
[Emotion verb た-form / い-adj / な-adj な] + ことに(は)
驚いたことに、彼はもう帰っていた。
Odoroita koto ni, kare wa mou kaette ita.
To my surprise, he had already gone home.
驚いた + ことに front-loads the reaction of surprise
嬉しいことに、試験に合格した。
Ureshii koto ni, shiken ni goukaku shita.
To my joy, I passed the exam.
嬉しい (い-adj) + ことに = 'happily, ...'
残念なことに、試合は中止になった。
Zannen na koto ni, shiai wa chuushi ni natta.
Regrettably, the match was cancelled.
残念な (な-adj) + ことに = 'to my regret, ...'
• Comes at the very front of the sentence, before the fact being reacted to. • Only pairs with words expressing emotion or evaluation (surprise, joy, regret, worry). • Register: slightly formal/written; the optional は adds a touch more emphasis.
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones ~ことに(は) is tested against.
ことか is an exclamation of degree at the end of a sentence ('how very ~!'); ことに opens a sentence to state one's reaction before the fact.
ものだから gives an excuse/reason; ことに simply expresses the speaker's emotional reaction to the following fact.
Study Japanese grammar on LenGaki

Get the Android app
The app adds offline study, home-screen widgets, stroke-order tracing, speaking practice with pronunciation scoring, and an AI tutor that answers questions in context — none of which fits in a browser tab.