Howdy there
I have the below code
<code>
import win32com.client ,pythoncom
pythoncom.CoIni tializeEx(pytho ncom.COINIT_APA RTMENTTHREADED)
wordapp = win32com.client .Dispatch("Word .Application") # Create new Word Object
wordapp.Visible = 1 # Word Application should`t be visible
worddoc = wordapp.Documen ts.Add() # Create new Document Object
worddoc.Content .Text = "=rand(200,99)" +"/r"
worddoc.Content .MoveEnd
worddoc.SaveAs( "c:\wiggle.doc" )
worddoc.Close() # Close the Word Document (a save-Dialog pops up)
wordapp.Quit() # Close t
pythoncom.CoUni nitialize()
</code>
the problem i have is that it
saves the word doc with "=rand(200, 99)/r"
i think that i am expecting too much from the com or word to action this statement in word.
as pressing return after =rand(x,x) gives you "The quick brown fox jumps over the lazy dog." quite a few times :D hence filling up a document for testing purposes...
D2
I have the below code
<code>
import win32com.client ,pythoncom
pythoncom.CoIni tializeEx(pytho ncom.COINIT_APA RTMENTTHREADED)
wordapp = win32com.client .Dispatch("Word .Application") # Create new Word Object
wordapp.Visible = 1 # Word Application should`t be visible
worddoc = wordapp.Documen ts.Add() # Create new Document Object
worddoc.Content .Text = "=rand(200,99)" +"/r"
worddoc.Content .MoveEnd
worddoc.SaveAs( "c:\wiggle.doc" )
worddoc.Close() # Close the Word Document (a save-Dialog pops up)
wordapp.Quit() # Close t
pythoncom.CoUni nitialize()
</code>
the problem i have is that it
saves the word doc with "=rand(200, 99)/r"
i think that i am expecting too much from the com or word to action this statement in word.
as pressing return after =rand(x,x) gives you "The quick brown fox jumps over the lazy dog." quite a few times :D hence filling up a document for testing purposes...
D2
Comment