I've using Pandoc 1.9.1 on Windows with Word 2007 and I'm running into some problems and I think it's the reference.docx file. If I use the stock reference.docx file it produces a valid word document without error. If I touch the reference.docx file (change a style, resave, whatever) any documents created with that will give the error: 'The file FILENAME cannot be opened because there are problems with the contents.' If I choose the 'Recover' option I see an error 'Styles 1'. Looking at the styles.xml inside the reference docx file it seems like there may be some issues.
The 'Date' styleid has a name set to 'Authors'. I'm thinking this might be relevant: I tried modifying reference.docx in Word, and saving as newref.docx. I then created a document r2.docx using pandoc -o r2.docx -reference-docx=newref.docx Tried to open this in Word, got the error, quit Word without recovering.
It appears that Track Changes in Word 2016 no longer displays in the margin balloons the time when an edit was made, only the date. I have come to depend on that timestamp for my work.
Then I edited r2.docx in emacs, went into the file.rel/rels, and changed ' to '. After that I was able to open the file in Word without problems. This (plus the linked page) suggests to me that the problem is with Word, not pandoc.
Word is actually breaking.rel/rels when you save the new reference docx. If this is right, then I'm not sure there's anything to fix in pandoc. But I'm not sure. I've got an MS Office 2010 Trial since my last message here, so I am updating this issue. I get the same error message while trying to load a generated docx file based on hardly modified reference.docx (all I did is: added a space after 'Hello World!'
, deleted that space and saved the file): 'The file is corrupt and cannot be opened'. If I click 'Ok', then the docx is repaired and everything works like a charm. Minimal example for the issue:. my 'modified' reference docx:. markdown file:. image file. I am having a similar issue.
When I try to open the generated Word doc in 2007 (Windows) it tells me that 'one or more of the footnotes in the document are missing or corrupt' (the markdown file does not have any footnotes in it). When I open the recovered file Word says it repaired 'Style 1' at the beginning of the document. I am using 1.10.1 on Mac (Mountain Lion). The command I use generate the file is: pandoc -reference-docx=/Users/klaus/Dropbox/Elements/Templates/reference.docx -f markdown+pipetables -t docx 'pandoc-test.md' -o 'pandoc-test.docx' The original markdown text file, the reference.docx template, and the generated docx can be found here. I can confirm this on my Mac.
If I edit a copy of reference.docx with Word 2011, then save the result and use it as a reference-docx with pandoc, I get a corrupted file. This was using pandoc's README as input, which has footnotes. When I tried again with a source file without footnotes, I did not get a corrupted file. I noticed that in the modified reference.docx saved by Word, the file word/styles.xml contains w:styleId='FootnoteReference1' where the original reference.docx contains w:styleId='FootnoteReference' This change could account for the corruption. I have no idea why Word changes the style ID from FootnoteReference to FootnoteReference1, but possibly it's because Word already has a default style with id FootnoteReference. I tried changing the ID in the modified reference.docx, but it didn't solve the problem.
There may be other problems of this sort. I've seen this problem for a while either with table or footnote in the generated docx file. I think this problem might be relate to the versions of Word XML format.
Evidences are(Tested under Win7 64bit, Word 2012):. pandoc with a template docx file created with Word 2012, pandoc will fail to recognize it as valid docx file. Unzip and re-zip the reference.docx, and then open it in Word 2012, an error message pops up. Same actions on other docx files edited with Word 2012 won't get the error message. Best, Chen, Huashan On Mon, Feb 25, 2013 at 2:44 PM, singingfish wrote: I think I've seen problems with table and/or figure captions as well. — Reply to this email directly or view it on GitHub.
Tables work fine in all my tests. But an image with caption would have the same problem as an image. 'pandoc will fail to recognize it as a valid docx file': What error message, exactly, do you get from pandoc? And what exactly are you doing - modifying the standard reference.docx with Word 2012? Have you tried checking the 'compatibility mode' box when you save, and does that make any difference? 'unzip and re-zip' - I have a really hard time seeing how this could make a difference.
Are you sure you are rezipping with the same directory structure? What commands are you using, exactly, to do this test? I tried it with Word 2011 and had no problems. Does the unmodified reference.docx open all right in Word 2012?
Moving forward with this issue: The way to debug this is by using tiny files that reproduce the problem, the first with just one footnote, the second with just one image. By examining the difference between the 'rescued' docx and the original, we may be able to figure out what is going on. Bigger picture: Given that Word seems to make arbitrary changes in the document when resaving it, I wonder whether it would be better to scrap the 'reference.docx' idea entirely and instead allow a 'styles.xml' file to be specified on the command line. The disadvantage of this, of course, is that it would be much harder for people to modify the styles. But at least it would work! First-pass/numbering.xml 2016-02-07 22:65064 +0300 second-pass/numbering.xml 2016-02-07 22:65064 +0300 @@ -163,10 +163,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. I am having the same problem with Word flagging documents converted based on my reference.docx as corrupt that seems to have been going on for several years.
If I create a clean reference.docx using pandoc, I can use it to create new Word documents that open cleanly. But if I edit and save the reference.docx using Word 2016, my converted documents are flagged as corrupt. Using pandoc 1.17.0.2 and Word 2016 for Mac 15.20. Have the same problem if I edit reference.docx using Word 2011 for Mac 14.6.2. It would help if you said exactly what you changed in the reference.docx (even better if you uploaded it so we could test ourselves). ibcrosby Mar 31 16 13:04 : I am having the same problem with Word flagging documents converted based on my reference.docx as corrupt that seems to have been going on for several years. If I create a clean reference.docx using pandoc, I can use it to create new Word documents that open cleanly.
But if I edit and save the reference.docx using Word 2016, my converted documents are flagged as corrupt. Using pandoc 1.17.0.2 and Word 2016 for Mac 15.20. Have the same problem if I edit reference.docx using Word 2011 for Mac 14.6.2. — You are receiving this because you were mentioned. Reply to this email directly or 1view it on GitHub References. I'm having a similar problem.
![Mac Mac](http://cdn.osxdaily.com/wp-content/uploads/2016/03/set-date-time-automatically-mac-610x523.jpg)
I'm completely new to pandoc, so installed the latest version (1.19.1) about a months ago. I also have Microsoft Word 2010. At first I tried some conversions from markdown to docx using default pandoc settings - everything worked perfectly. Today I decided to create my custom reference.docx. I followed all the steps in pandoc manuals.
What I did:. Created reference.docx using pandoc -print-default-data-file reference.docx reference.docx. Opened it in Word and edited only styles, didn't touch any text at all.
I only changed the most basic styles: title, body, footnote, headings 1-4. When I convert my.md file using this changed reference.docx, I get the following error: 'The file cannot be opened because there are problems with the content'. When I click 'Details' I see: 'Microsoft Word could not open this file because some parts are missing or invalid'. Then, Word offers to repair the content, I click 'yes', and my file opens just fine, with all the formatting I set up in reference.docx.
It also displays 'Show Repairs' window that says 'Endnote 1'. If I click 'go to', it says 'This bookmark does not exist'.
Funnily enough, my document does not have any endnotes. I tried creating a new reference.docx using pandoc as before. If I don't change it, it works perfectly - but, of course, it doesn't have the styles I need. As soon as I change any style at all, the same error returns. Unlike some previous posters, my problem does not seem to be related to footnotes. I tried converting test document with or without footnotes, but it doesn't make any difference - still the same error.
The error seems to be about endnotes, which I don't use! After Word repairs the document, I can use it just fine, and all formatting looks OK, but this error is annoying, and I'm worried about longer and more complex documents. I'm having a similar problem. I'm completely new to pandoc, so installed the latest version (1.19.1) about a months ago. I also have Microsoft Word 2010.
At first I tried some conversions from markdown to docx using default pandoc settings - everything worked perfectly. Today I decided to create my custom reference.docx. I followed all the steps in pandoc manuals. What I did: 1. Created reference.docx using pandoc -print-default-data-file reference.docx reference.docx. Opened it in Word and edited only styles, didn't touch any text at all.
I only changed the most basic styles: title, body, footnote, headings 1-4. When I convert my.md file using this changed reference.docx, I get the following error: 'The file cannot be opened because there are problems with the content'. When I click 'Details' I see: 'Microsoft Word could not open this file because some parts are missing or invalid'. Then, Word offers to repair the content, I click 'yes', and my file opens just fine, with all the formatting I set up in reference.docx. It also displays 'Show Repairs' window that says 'Endnote 1'. If I click 'go to', it says 'This bookmark does not exist'. Funnily enough, my document does not have any endnotes.
I tried creating a new reference.docx using pandoc as before. If I don't change it, it works perfectly - but, of course, it doesn't have the styles I need. As soon as I change any style at all, the same error returns. Unlike some previous posters, my problem does not seem to be related to footnotes. I tried converting test document with or without footnotes, but it doesn't make any difference - still the same error. The error seems to be about endnotes, which I don't use! After Word repairs the document, I can use it just fine, and all formatting looks OK, but this error is annoying, and I'm worried about longer and more complex documents.
— You are receiving this because you were mentioned. Reply to this email directly, 1view it on GitHub, or 2mute the thread. References 1. Which version of pandoc are you using? It looks like it was fixed in 2.2 (see ) - I just tested on a Mac with a fresh installation of pandoc (2.2.1) with:.
pandoc -print-default-data-file reference.docx custom-reference.docx. Open custom-reference.docx in Word 2016 and save under new name. pandoc -reference-doc=custom-reference-saved-from-word.docx test.md -o test.docx. Open test.docx in Word 2016 - it opened fine. When I settings.xml inside test.docx and download.docx, I noticed that download.docx had.
Pandoc 1.12.4.2 Compiled with texmath 0.6.6.1, highlighting-kate 0.5.8.5. Though the generated reference doc from pandoc (even the older version) didn't have endnote - Word added styles for endnote when you saved after changing it. Newer versions of pandoc.
Pandoc didn't add relevant entries and files for this endnote style when generating docs based on the saved file, causing the error. In case you cannot update the version you have in your system, could you try this workaround:. Install the current version of pandoc on another system.
Create another reference.doc based on the one you have - f.ex.: pandoc -reference-doc=current-reference-saved-from-word.docx simple.md -o new-reference.docx. Use that new-reference.docx in your current system (with old pandoc).