I think I found an answer for you. Can’t vouch from experience, but assuming you are running the community/“built in to Nextcloud” version of document server, here’s a way to go about it:
If you are running your OnlyOffice separately (e.g., their provided docker image), then instructions for that will be different.