Advertisement
Guest User

Untitled

a guest
May 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2. from openpyxl import *
  3. from docx import Document
  4.  
  5.  
  6. # Visos excelio komandos
  7.  
  8. wb = Workbook('C:\Users\Domas\Desktop\sarasas1.xls')
  9. ws = wb.active
  10. names = ws['A']
  11. surnames = ws['B']
  12. name = ws.rows
  13. currentName = []
  14.  
  15. # Visos wordo komandos
  16.  
  17. document = Document('C:\Users\Domas\Desktop\sertifikatas.docx') # Viduj () - tavo sablono path
  18.  
  19. # Surasymas
  20.  
  21.  
  22. for each in name:
  23. currentName = name.names[each], name.surnames[each]
  24.  
  25. for paragraph in document.paragraphs:
  26. if '*' in paragraph.text:
  27. paragraph.text = '%s' % currentName
  28. document.save('%d, %s '% paragraph.zfill(3), currentName)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement