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

Xml parsing error #67

Closed
robingram opened this issue Jan 23, 2018 · 1 comment
Closed

Xml parsing error #67

robingram opened this issue Jan 23, 2018 · 1 comment

Comments

@robingram
Copy link

Hi, I'm trying to get Word generation working with v0.7.0 but the docx file generated always seems to be corrupt. I get the same error every time when trying to open the document in Word:

Xml parsing error
Location: Part: /word/document.xml, Line: 14, Column 6

I've unpacked the docx and examined the file and it seems fine to my uneducated eye. This is line 14:

<w:r xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">

I've tried opening in Word on both Mac and Windows with the same result.

I was initially trying this with an existing rails 5.1 app but when I hit this error I tried on clean installations of rails 5.1 and 4.2 with the same result. I based my controller action on the most basic examples from the docs too but still no joy:

respond_to :docx
def show
  respond_to do |format|
    format.docx do
      render docx: 'my_file.docx', content: '<html><body>some html</body></html>'
    end
  end
end

Any ideas?

@robingram
Copy link
Author

Looks like this was due to invalid HTML in the documented example. I fixed it by changing the HTML in the Rails example to match that of the straight Ruby example, i.e. change:

'<html><body>some html</body></html>'

to:

'<html><head></head><body><p>Hello</p></body></html>'

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

1 participant