@Tsvetkov, Daniil , thanks for the feedback, based on my test, I also reproduced the same error with you when I used the XPS file created with Office 365, Excel version 2208. BTW, I could run the code without a problem when I used the XPS file created with office 2016. Therefore, I think it is the office version problem instead of the code problem.
I recommend that you could do the version rollback by using the following command in the Run:
"C:\Program Files\Common Files\microsoft shared\ClickToRun\officec2rclient.exe" /update user updatetoversion=16.0.14931.20132 ->this is version 2202
Hope this could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.