Diffs de docs MS Word

Soluci├│n 1: convertir a odf

Lanzar el proceso de openoffice

soffice "-accept=socket,host=localhost,port=2002;urp;"
# openoffice.org -accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"

Abrir doc con pyuno y guardar como *odf*

   1 import uno
   2 local = uno.getComponentContext()
   3 resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local)
   4 
   5 context = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
   6 desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
   7 
   8 doc = desktop.loadComponentFromURL("file:///home/lm/test.doc" ,"_blank", 0, ())
   9 doc.storeAsURL("file:///home/lm/test.odf", () )

┬┐Guardar como MS Word?

   1 # guardar como word
   2 from com.sun.star.beans import PropertyValue 
   3 myProps=PropertyValue() 
   4 myProps.Name="FilterName" 
   5 myProps.Value="MS Word 97" 
   6 document.storeAsURL("file:///home/lm/test.doc", (myProps,) )

Otras soluciones

(ver hilo: http://mail.python.org/pipermail/python-es/2010-December/028833.html)

LuisMiguel/DiffsMSWord (last edited 2011-01-31 22:07:13 by LmMorillas)