[python-win32] Visio - not able to access shapesheet, set properties to shape

Padmasani Sowmia padmasanisowmia at yahoo.com
Mon Aug 27 23:46:57 CEST 2007


Hello,
  I am new to Python programming. I am trying to open Visio diagram and drop a shape programmatically along with some attributes that need to be set. 
  So far I have been successful in opening the file,
  dropping the shape object.
  Now, I have known properties in my application that I need to export it to this dropped object.
  Also when I pass the variable for a file name v1.Documents(variable).
  it is not working. Why? Any one please let me know what I am doing wrong and how this should be corrected.
  Thanks in advance,
  Here is my code:
  vpath = os.environ.get('TEMP')
  vfilename = os.path.join(vpath, ''mytemp.vst')
  v1 = win32com.client.Dispatch("Visio.Application")
  v1.visible =1
  visfile = v1.Documents.Open(vfilename) 
  #self.objsSelected
  fiobj = self.winparent.selected_object()
  
  loid = id2loid(fiobj.id)
   
  for vdoc in v1.Documents:
  #print vdoc.name
  #fyle_ext = vdocs[len(vdocs)-3:] 
  if vdoc.masters.count > 0:
  shapes = vdoc.masters
  if shapes.count > 0:
  for shp in shapes:
  usrsubtype = 'Rectangle'
  if shp.name==usrsubtype:
  pinX = 1.75
  pinY = 9.25
  #v1.ActivePage.Drop(shp.name, pinX, pinY)
  #v1.ActivePage.Drop(v1.Documents(vdoc.name).Masters(shp.name), pinX, pinY) 
  #v1.ActivePage.Drop(v1.Documents(vdoc).Masters(usrsubtype), pinX, pinY)
  #v1.ActivePage.Drop(vdoc.Masters(shp), pinX, pinY)
  #v1.ActivePage.Drop(usrsubtype, pinX, pinY)
  v1.ActivePage.Drop(v1.Documents("temp.vss").Masters(usrsubtype), pinX, pinY)
  v1.ActivePage.PageSheet.Cells("Prop.obj").Formula = loid 
  #v1.ActiveWindow.selection.Item(1).Cells("Prop.loid").Formula = loid
  #v1.ActiveWindow.selection.Item(1).Cells("Prop.NAME").Formula = fiobj.name
    
#print loid


Cheers,
Padmasani Sowmia 


       
---------------------------------
Shape Yahoo! in your own image.  Join our Network Research Panel today!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070827/027320b5/attachment.htm 


More information about the python-win32 mailing list