【问题标题】:Change the language of Office Online Doc Viewer via URL parameters通过 URL 参数更改 Office Online Doc Viewer 的语言
【发布时间】:2021-05-07 00:23:58
【问题描述】:

所以,我使用 Google Doc Viewer 来显示 .docx 文档,它工作正常,但有时加载时间过长并且超时。我试过微软的,它看起来很快,但我的问题是我需要它是西班牙语的。

对于 Google Doc Viewer,我使用以下语法:

<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>

如您所见,hl=es_LA 表示语言。最终结果在语言方面显示如下:

微软的语法是:

<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>

我尝试在查询参数中添加langlanguage,但没有任何区别。我总是得到英文。

有没有办法按照使用 Google Doc Viewer 配置语言的方式来配置语言,还是采用默认的操作系统语言/浏览器语言进行嵌入?

【问题讨论】:

  • @JingXian 你能扩展一下吗?我找到了UI_LLCC 选项,但我似乎找不到如何将它添加到我的 URL,我尝试了不同的方式,但它不起作用。我需要的语言环境是es-ES,所以我尝试了?UI_LLCC=es-ES&amp;url=... 之类的方法,但没有成功。在示例中,我看到了这个&lt;ui=UI_LLCC&amp;&gt;,但我不确定如何在 URL 中使用它。有任何想法吗?我没有使用任何集成或 ASP,我只是使用 iframe 嵌入。

标签: html url query-parameters office-app


【解决方案1】:

要通过 URL 参数更改 Office Online Doc Viewer 的语言,您需要添加 ui=your_locale

在您的情况下,该 URL 将是 https://view.officeapps.live.com/op/embed.aspx?src=https://myserver/file.docx&amp;amp;wdStartOn=1&amp;amp;wdPrint=0&amp;amp;wdEmbedCode=0&amp;amp;ui=es-ES

【讨论】:

  • 我试过了,但它对查看器的语言环境没有任何作用。
  • @MihailMinkov 嗯,我使用了ui=ru-Ru,它对我有用。试试这个例子:view.officeapps.live.com/op/embed.aspx?src=https://… 界面应该是俄语的。然后尝试删除ui=ru-Ru,它应该变成英文了。
  • 好的,这确实有效,显然问题是 url 编码的 &amp;amp; 我将它们更改为 &amp; 并且它有效。谢谢!
猜你喜欢
  • 2020-04-26
  • 2021-10-25
  • 2011-07-24
  • 1970-01-01
  • 2014-04-23
  • 1970-01-01
  • 2020-06-17
  • 1970-01-01
  • 2023-04-01
相关资源
最近更新 更多