[Tutor] Remove a blank row of a Table
shouqiang1989 at sina.com
shouqiang1989 at sina.com
Thu Feb 26 06:53:37 CET 2015
Hello, everybody: I came accross a question a few days
ago. I wrote a Python script to copy something to a table in a word
file. For some reaons, there are some blank rows. And I want to remove
the blank rows. I tried many ways, but all didn't work. Below is the
code. desfile='C:\\Daten\\TestCASE5\\Model_hill.doc'
fd = w.Documents.Open(desfile) lNam = textwrap.wrap(reportItem.PName)
maxLines = len(lNam) for idx in xrange (1,maxLines) :
if fd.Tables[6].Rows[idx].Cells[1] == None :
fd.Tables[6].Rows[idx].Remove()
else :
pass
Thanks in advance
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list