On 6/23/06, w chun <[EMAIL PROTECTED]> wrote: > > 2. use the short form to instantiate a PropertyValue > > REPLACE: > PDF = PropertyValue("FilterName", 0, "writer_pdf_Export", 0) > WITH: > PDF = PropertyValue("FilterName", "writer_pdf_Export")
after trying this again, i discovered that this fails too. the only thing that worked for me was doing it the "manual" way: pdf = PropertyValue() pdf.Name = 'FilterName' pdf.Value = 'writer_pdf_Export' furthermore, if you need to specify multiple properties, then virtually duplicating these three lines up and down your code starts to get old: hdn = PropertyValue() hdn.Name = 'Hidden' hdn.Value = True pdf = PropertyValue() pdf.Name = 'FilterName' pdf.Value = 'writer_pdf_Export' ow = PropertyValue() ow.Name = 'Overwrite' ow.Value = True you can slightly improve on this with something like: props = [PropertyValue() for i in range(nprops)] props[0].Name = 'FilterName' props[0].Value = 'writer_pdf_Export' props[1].Name = 'Overwrite' props[1].Value = True props[2].Name = 'Hidden' props[2].Value = True instead, i put this all into a function, and it helped clean things up a bit: def makePropVal(x, y=True): pv = PropertyValue() pv.Name = x pv.Value = y return pv hdn = makePropVal('Hidden') pdf = makePropVal('FilterName', FTYPES[ftype]) ow = makePropVal('Overwrite') > 3. use storeToURL() as opposed to storeAsURL() > > REPLACE: > doc2.storeAsURL("file:///C:/alleclipse/OpenOffice/test2.pdf", (PDF,)) > > WITH: > doc2.storeToURL(unohelper.absolutize( > > unohelper.systemPathToFileUrl('C:/alleclipse/OpenOffice/test2.pdf'), > unohelper.systemPathToFileUrl('test2.pdf')), (PDF,)) correction (should be dir path as 1st arg): unohelper.systemPathToFileUrl('C:/alleclipse/OpenOffice'), unohelper.systemPathToFileUrl('test2.pdf')), (PDF,)) -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com -- http://mail.python.org/mailman/listinfo/python-list