Bouke / docx-mailmerge

Mail merge for Office Open XML (docx) files without the need for Microsoft Office Word.
MIT License
274 stars 104 forks source link

KeyError #2

Closed aseck closed 11 years ago

aseck commented 11 years ago

Hi,

I'm trying to use docx-mailmerge for a personal project and I'm facing kind of doc format issue.

After generating a input.docx with Mac Ms Word 2011. I can't find any mergefield using document.get_merge_fields().

By generating an other input.docx with windows Ms Word 2007. I always get this error:

File "mailmerge.py", line 47, in __init__
    del part.getroot().attrib['{%(mc)s}Ignorable' % NAMESPACES]
KeyError: '{http://schemas.openxmlformats.org/markup-compatibility/2006}Ignorable'

Thanks for your help.

Bouke commented 11 years ago

The code surely could use a test suite testing against a range of MS Word versions/platforms. I've been working with MS Word 2011, so it's strange that you are running into said problem. Can you attach the document you've been trying to process? I'll try to find a way for testing the documents, as it should support all (variants of) MS Word Open XML.

aseck commented 11 years ago

Hi,

Please find attached the input.docx file.

Thanks in advance.

Abdourahmane SECK

15 Boulevard Djily Mbaye

BP 22352 - Dakar Ponty - Sénégal****

T +221 33 849 90 90****

F +221 33 822 97 10

2013/5/22 Bouke Haarsma notifications@github.com

The code surely could use a test suite testing against a range of MS Word versions/platforms. I've been working with MS Word 2011, so it's strange that you are running into said problem. Can you attach the document you've been trying to process? I'll try to find a way for testing the documents, as it should support all (variants of) MS Word Open XML.

— Reply to this email directly or view it on GitHubhttps://github.com/Bouke/docx-mailmerge/issues/2#issuecomment-18258665 .

Bouke commented 11 years ago

There seems to be no document attached.

aseck commented 11 years ago

I try again.

2013/5/22 Bouke Haarsma notifications@github.com

There seems to be no document attached.

— Reply to this email directly or view it on GitHubhttps://github.com/Bouke/docx-mailmerge/issues/2#issuecomment-18259078 .

Bouke commented 11 years ago

Still nothing. Try uploading it through GitHub's web interface instead of e-mail reply.

aseck commented 11 years ago

I can't upload docx format in the web interface. Only images are possible.

Bouke commented 11 years ago

Please send it by e-mail, my e-mail address is on my profile.

Bouke commented 11 years ago

I've fixed the KeyError, so that should be solved. However your file includes field names that don't appear to be valid. Please do not include spaces or quotes, as those will be rejected. I've included a clear error message when invalid field names are used. If you think a field name should be accepted, please let me now.

update: quotes are used by winword 2010 and should be handled correctly now