Gardner, Dean wrote: > > Hi > > I have been looking at simple examples of controlling applications > like excel and word using python. All seems well until I read in a > word document with multiple lines. It then seems to pick out seemingly > random sections of the document to display. > > This is the class that is handling the opening etc of the document > Please show us the relevant parts of the program. Most of the methods you posted have nothing to do with the problem, and the crucial code for instantiating the class and calling its methods is missing, as is an example of the desired output vs the actual output. No can help without this. > > class word: > def __init__(self, filename=None): > """ > @ Opens a word document specified by the user > """ > print "Initiating and opening..."+str(filename) > > self.wdApp = win32com.client.Dispatch('Word.Application') > self.wdDoc = self.wdApp.Documents.Open(filename) > > def save(self, newfilename=None): > """ Saves the open document with > a user defined new filename > """ > if newfilename: > self.filename = newfilename > self.wdDoc.SaveAs(newfilename) > else: > self.wdDoc.Save() > > > def close(self): > > print "Preparing to close" > #self.wdDoc.Close() > self.wdDoc.Close() > self.wdApp.Quit() > > #del self.wdApp > > def show(self): > self.wdApp.Visible = 1 > > def hide(self): > self.wdApp.Visible = 0 > > > def getFileContents(self): > print "Get file contents" > docString = self.wdApp.Documents[0].Content > > return str(docString).decode('latin-1') > > *Dean Gardner > *Test Engineer > Barco > Bonnington Bond, 2 Anderson Place, Edinburgh EH6 5NP, UK > Tel + 44 (0) 131 472 5731 Fax + 44 (0) 131 472 4799 > _www.barco.com _ > [EMAIL PROTECTED] _ > Unless indicated otherwise, the information contained in this message > is privileged and confidential, and is intended only for the use of > the addressee(s) named above and others who have been specifically > authorized to receive it. If you are not the intended recipient, you > are hereby notified that any dissemination, distribution or copying of > this message and/or attachments is strictly prohibited. The company > accepts no liability for any damage caused by any virus transmitted by > this email. Furthermore, the company does not warrant a proper and > complete transmission of this information, nor does it accept > liability for any delays. If you have received this message in error, > please contact the sender and delete the message. Thank you. > > > - - - - - - - DISCLAIMER- - - - - - - - > > Unless indicated otherwise, the information contained in this message > is privileged and confidential, and is intended only for the use of > the addressee(s) named above and others who have been specifically > authorized to receive it. If you are not the intended recipient, you > are hereby notified that any dissemination, distribution or copying of > this message and/or attachments is strictly prohibited. The company > accepts no liability for any damage caused by any virus transmitted by > this email. Furthermore, the company does not warrant a proper and > complete transmission of this information, nor does it accept > liability for any delays. If you have received this message in error, > please contact the sender and delete the message. Thank you. > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
-- Bob Gailer 510-978-4454 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor