Guest User

Untitled

a guest
Dec 12th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import win32com.client
  2. docx = "C:\\Users\\xwk\\Desktop\\12.docx"
  3. pdf1 = "C:\\Users\\xwk\\Desktop\\12.pdf"
  4. xlsx = "C:\\Users\\xwk\\Desktop\\22.xlsx"
  5. pdf2 = "C:\\Users\\xwk\\Desktop\\22.pdf"
  6. wpsFormatPdf = 17
  7. wps = win32com.client.Dispatch("KWPS.Application")
  8. doc = wps.Documents.Open(docx)
  9. doc.SaveAs(pdf1, wpsFormatPdf)
  10. doc.Close()
  11. wps.Quit()
  12.  
  13. et = win32com.client.Dispatch('KET.Application.9')
  14. workbook = et.Workbooks.Open(xlsx)
  15. workbook.ExportAsFixedFormat(0, pdf2)
  16. workbook.Close()
  17. et.Quit()
Add Comment
Please, Sign In to add comment