AlJohri / docx2pdf

MIT License
506 stars 96 forks source link

Windows support for WPS Office #31

Closed pushthepushpop closed 3 years ago

pushthepushpop commented 3 years ago

Didnt have MS Word installed, and I ran it with WPS Office in Windows. In one installation, everything ran fine.

However in another installation, it ran and converted the files into pdf, but threw out an error.

https://i.stack.imgur.com/I7ngM.png

I was thinking if there is any way to fix this?

AlJohri commented 3 years ago

I think this is the same issue described here: https://blog.csdn.net/zcydhr/article/details/106172836

Translated:

AttributeError: word.Application.Quit In fact, one of the most important factors leading to this problem is the parameter error in word = Dispatch(). If you want to call >a word document, then the parameter in brackets needs to be kwps.Application, that is, word = Dispatch('kwps.Application' ), at >this time, if you execute it again, there will be no error prompt.

so my guess is, this line win32com.client.Dispatch("Word.Application") needs to say kwps.Application instead of Word.Application

is this something you can test out on your end? I don't have WPS Office installed

pushthepushpop commented 3 years ago

Yes it fixed the error message! Thanks a lot.