On 26/02/15 05:53, shouqiang1...@sina.com wrote:
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

As you can probably see your code came scrambled beyond
reasonable recognition. (We can guess but we can't be sure)

Can you repost in plain text please, not in HTML.

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

Also, since Python by default can't handle Word files can you tell us which library you are using to do this. In other words in the line:

fd = w.Documents.Open(desfile)

Where do w, Document, and Open() come from?
They are seemingly not a part of the standard Python library.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to