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

Possible bug when there is a fldCharType begin but no end #41

Closed
stadelmanma opened this issue Apr 18, 2017 · 2 comments
Closed

Possible bug when there is a fldCharType begin but no end #41

stadelmanma opened this issue Apr 18, 2017 · 2 comments

Comments

@stadelmanma
Copy link
Collaborator

In my docx files it seems as a result of the AUTOTEXT fields there will be a
<w:fldChar w:fldCharType="begin"/> tag but no <w:fldChar w:fldCharType="end"/>

This causes a nil value to be passed into the ComplexField.new method and then blow up in initialize because n.search is being called when n == nil.

It is possible that my docx files are somehow syntactically invalid but they have no display issues, opening and re-saving them has no effect, nor does a C/P of the contents into a fresh document. I have a fix here if this is actually a bug and not some special case I happen to be running into.

@senny
Copy link
Owner

senny commented Apr 19, 2017

Interesting... I have not come across such a template. We did insert all MergeFields ourselves so maybe this is something that was produced by an older version of Word. If Word recognizes the field and functionality is not restricted, I think it would be nice to support that case.

Would you mind opening a PR with the fix and also a test-case that contains a WordML sample? Ideally the sample would be extracted from your document so that we have something as close to a real thing as possible.

@stadelmanma
Copy link
Collaborator Author

@senny PR has been opened with a test and new fixture.

@senny senny closed this as completed in #42 Apr 21, 2017
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

No branches or pull requests

2 participants