htmlurlquery-stringoffice-app

Change the language of Office Online Doc Viewer via URL parameters


So, I am using Google Doc Viewer to show .docx documents and it works fine, but it sometimes takes too much time to load and times out. I tried the Microsoft one and it looks pretty fast, but my problem is I need it to be in Spanish.

In the case of Google Doc Viewer I am using this syntax:

<iframe src="https://docs.google.com/gview?embedded=true&hl=es_LA&url=https://myserver/file.docx" width="100%" height="350" style="border: solid 1px #DDD; margin-bottom: 1rem;"></iframe>

As you can see the hl=es_LA indicates the language. The final result shows something like this in terms of language: enter image description here

The syntax for the Microsoft one is:

<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=https://myserver/file.docx&amp;wdStartOn=1&amp;wdPrint=0&amp;wdEmbedCode=0" width="100%" height="350px" frameborder="0"></iframe>

I tried adding lang or language to the query parameters, but it didn't make any difference. I always get it in English.

Is there a way to configure the language the way it's configured with Google Doc Viewer or does it take the default OS language / Browser Language for the embedding?


Solution

  • To change the language of Office Online Doc Viewer via URL parameters you need to add ui=your_locale.

    In your case, the URL would be https://view.officeapps.live.com/op/embed.aspx?src=https://myserver/file.docx&amp;wdStartOn=1&amp;wdPrint=0&amp;wdEmbedCode=0&amp;ui=es-ES