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

Change close method to discard changes #33

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

RussSchultz
Copy link
Contributor

In our company's design flow, they generate docx files marked as 'ReadOnly' by some internal Word mechanism. If you open the file manually, Word prompts if you want to open it read only or not. The method of opening by docx2pdf apparently makes Word think you've opened it as write and wants to save changes.

Something recently changed in Word (I guess) that changes the error to docx2pdf such that it crashes it if you cancel the save window that pops up. This causes the script to bomb and not iterate over the batch items.

Changing doc.Close() to doc.Close(0) tell word to discard changes. I would use the proper enum for the option (wdDoNotSaveChanges) but I couldn't be arsed to figure out where in python-land that might be defined.

In our company's design flow, they generate docx files marked as 'ReadOnly' by some internal Word mechanism.    If you open the file manually, Word prompts if you want to open it read only or not.    The method of opening by docx2pdf apparently makes Word think you've opened it as write and wants to save changes. 

Something recently changed in Word (I guess) that changes the error to docx2pdf such that it crashes it if you cancel the save window that pops up.   This causes the script to bomb and not iterate over the batch items.

Changing doc.Close() to doc.Close(0) tell word to discard changes.   I would use the proper enum for the option (wdDoNotSaveChanges) but I couldn't be arsed to figure out where in python-land that might be defined.
@AlJohri
Copy link
Owner

AlJohri commented Jun 22, 2021

thanks @schnort this looks great!

@AlJohri AlJohri merged commit 4b77f6c into AlJohri:master Jun 22, 2021
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.

2 participants