Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a template from another directory #62

Open
galievruslan opened this issue Oct 26, 2017 · 1 comment
Open

Use a template from another directory #62

galievruslan opened this issue Oct 26, 2017 · 1 comment

Comments

@galievruslan
Copy link

Hello

I'm using the version of htmltoword 0.5.1

My controller code

class ReportsController < ApplicationController
  respond_to :docx
  def run
    @report = Report.find(params[:id])
  end

  def execute
    @report = Report.find(params[:id])
    @params = params
    @user = current_user
    if @report.format == 'html'
      render @report.template.path
    elsif @report.format == 'docx'
      file_name = @report.name + '.' + @report.format
      render docx: @report.template.path, filename: file_name
    elsif @report.format == 'xlsx'
      file_name = @report.name + '.' + @report.format
      render file: @report.template.path
    end
  end
end

Reports are created and their templates are downloaded with carrierwave to the folder
/uploads/report_templates/13/REPORT_NAME

But if I use the code I wrote above, then the application gives an error 404.
Tell me how it can be fixed or bypassed?

@deepak496
Copy link

My problem is that it is not picking a single css whether defined externally or even inline. Can anybody tell me do we need to do something else as well apart from including the gem in the gemfile. What are the steps to successfully implementing docx with proper css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants