【问题标题】:Google document viewer with rails带导轨的 Google 文档查看器
【发布时间】:2011-07-09 14:58:40
【问题描述】:

我正在尝试在我的 Ruby on Rails 网站上嵌入 Google 文档查看器 (http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html),但它一直显示“抱歉,不支持查看此类文档”。我的 Rails 代码使用如下所示的 send_file 调用:

send_file(File.join(@document.path, @document.filename), {:filename => @document.name, :type => @document.filetype})

在服务器日志中,我可以看到文件正在发送,但文档查看器没有显示它。有谁知道我该如何解决这个问题?

【问题讨论】:

  • 你会尝试不同的文件格式吗?

标签: ruby-on-rails ruby documentviewer sendfile


【解决方案1】:

我也在努力。

我的代码中有人尝试在帮助程序中将日历与 this 关联起来,这是一个日历,不是文档,但也许它可以给我们一个想法。

 def current_user_calendar
    GCal4Ruby::Calendar.to_iframe(current_user.email, :width => "500", :height => "200", :viewMode => "AGENDA").html_safe
  end

  def best_calendar
    if current_user.can_show?(:system_calendar)
      id = Settings.calendar_id
    else
      id = current_user.email
    end
    GCal4Ruby::Calendar.to_iframe(id, :width => "1120", :mode => "week").html_safe
  end

【讨论】:

    猜你喜欢
    • 2019-06-16
    • 1970-01-01
    • 2011-02-17
    • 1970-01-01
    • 1970-01-01
    • 2011-06-22
    • 1970-01-01
    • 1970-01-01
    • 2012-08-19
    相关资源
    最近更新 更多