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 Zip::File#glob to match any document.xml #104

Merged
merged 1 commit into from
May 5, 2021
Merged

Use Zip::File#glob to match any document.xml #104

merged 1 commit into from
May 5, 2021

Conversation

WaKeMaTTa
Copy link
Contributor

Fixes #103

@@ -30,8 +30,7 @@ def initialize(path_or_io, options = {})
@zip = Zip::File.open_buffer(path_or_io)
end

document = @zip.find_entry('word/document.xml')
document ||= @zip.find_entry('word/document2.xml')
document = @zip.glob('word/document*.xml').first
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the specification of Office Open XML file format.
Is there no docx file which have some xml files with prefix 'word/document'?
The PR #73 tries to deal with all the xml.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specifications can be found here: http://officeopenxml.com/anatomyofOOXML.php


If we want to be more clean, we should load [Content_Types].xml and check the name of the document.

I will work on a new PR that will use [Content_Types].xml to define all XML.

@satoryu satoryu merged commit ff957f0 into ruby-docx:master May 5, 2021
@WaKeMaTTa WaKeMaTTa deleted the patch-1 branch May 22, 2021 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENOENT error because internal doc is word/document22.xml
2 participants