Skip to content

Сan't convert large file (~100k rows in HTML) #79

@YuraAfanasyev

Description

@YuraAfanasyev

When I try to convert a large file (~100k rows in HTML), I get an error:
stack level too deep
my code is:

respond_to do |format|
  format.docx do
    render docx: 'report', filename: "report.docx"
  end
end

Small files are generated perfectly.

If I change the code to this:

respond_to do |format|
  format.docx do
    html = render_to_string template: 'report', formats: :docx
    result = Htmltoword::Document.create(html)
    send_data result, type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", filename: "report.docx"
  end
end

then the rails server is stopped with error:

/Users/developer/.rvm/gems/ruby-2.5.1@plutus/gems/htmltoword-1.1.0/lib/htmltoword/document.rb:104: [BUG] Illegal instruction at 0x00007fff7164f5e2
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0112 p:---- s:0851 e:000850 CFUNC  :transform
...

I tried using different versions of rails and ruby, but this does not work. Other gems, such as pandoc-ruby, convert such large files, but text formatting does not work in them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions