SlideShare a Scribd company logo
Introduction to OpenOffice.org scripting features Laurent Godard
Agenda Context  What is scripting ? Tools What does OpenOffice.org provide ? Scripting OpenOffice.org Presentation Basic Python
Scripting Possibility to pilot OpenOffice.org elements for our own needs Access its API/features by code This can be done From a code inside OpenOffice.org : macros From outside OpenOffice.org : connection line ooffice &quot;-accept=socket,host=localhost,port=2002;urp;&quot; setup.xcu <prop oor:name=&quot;ooSetupConnectionURL&quot;> Network connection on localhost and even network From components deployed at OOo level : Add-ons Once a connection is set up, scripting is almost the same
Context and definitions Many languages Java, C++, COM (VB, delphi), .Net, ... Language uses OOo API via UNO bridges Java C++ Python A P I UNO UNO UNO OpenOffice.org core ... UNO
Definitions API : Application Programming Interface Access to objects, properties and methods of OOo core No need to know OOo source code but only the API it exposes SDK : Software Development Kit Toolbox dedicated to developers to use OpenOffice.org API and build their programs UNO : Universal Network Object Description of objects that allow to communicate with API no matter the localization of objects The bridges for different languages allow its use in heterogeneous environments
Tools IDE  Integrated development environment OOo dialog builder graphical tool SDK What does it contains as documentation ? How to browse it ?  Helpers What are the coding facilities introduced in scripting languages ? Useful developments by community
Macro management Hierarchical organization
The basic IDE – code Syntax coloration Step by step debugging tool Call stack Variable values and object explorer
The basic IDE – dialogs Build your own dialogs with integrated tools
Complex dialogs Paolo Mantovani
IDE for other languages Javascript Beanshell  Nothing for Python, we have to use an external IDE and import the code into OOo
First Macro Hello Message No OOo interaction Basic language compliant
Going deeper Need to access OOo objects to create business helpers inside the office suite Where to find them ? The SDK provides many documentation on the API Developers guide Related OpenOffice.org projects http://extensions.openoffice.org http://api.openoffice.org  http://udk.openoffice.org http://framework.openoffice.org
The SDK (OOoBasic Use) A deployable archive http://api.openoffice.org around 30 Mb (100 Mb installed) In english IDL reference Developers guide  Examples OpenDocument and OpenOffice.org 1.x file specification Building tools and Java/C++ reference (not needed for basic) ...
IDL Reference Synthetic information For a given service and interface, enumerates all properties and methods it offers Some comment lines on each Hyperlink navigation allowing exploration of returned types  Index and navigation pages Alphabetical Hyperlink navigation allowing deep exploration Hyperlinks between IDL reference ans developers guide Ideal for finding its way in the API
IDL Reference (II)
Developers Guide Full documentation on UNO and API  more than 1000 pages HTML or PDF Cross hyperlink reference to IDL Numerous code examples (Java) and UML diagrams
OOoBasic coding simplifications ThisComponent, StarDesktop CreateUNOService, CreateUNOStruct ConvertToURL, convertFromURL Get and set methods are binded to properties in read and write mode  setString, getString methods to String property Collections are translated to arrays  getByIndex method calls not needed anymore Structures and named constant recognized com.sun.star.beans.PropertyValue Introspection : dbg_methods, dbg_properties
Xray - OOoBasic  Navigate recursively into the API, plugged to the IDL B. Marcelly
XRay – SDK binding http://www.ooomacros.org/dev.php#101416
First OOo API use Convert a document to PDF
Packaging as addon Can be distributed inside a document but then not integrated to OOo  Definition of an addon A deployable set of code containing information on its availability and access in OpenOffice.org in a standalone file Compressed file containing code, resources and configuration – a new filename extension defined : oxt (OOo 2.0.4) Developers guide chapter 4 Paolo's previous year presentation http://marketing.openoffice.org/ooocon2005/presentations/thursday_d4.pdf
addons.xcu OOo GUI integration XML file containing the toolbar and menu layout of the packaged code Defines icons resources Titles and Translations Associates code to be launched to each interface elements Toolbar Main menu and submenus Tools > Addons submenu  Help menu  Addon tool  http://www.ooomacros.org/dev.php#101618
Addon tool B. Marcelly
Deploy to user Using command line tool unopkg (OOo closed) <ooo>/program/unopkg Package manager  Tools > Package manager To all users in  share  directory or only at  user  level OOo installation directory share/uno_packages OpenOffice.org Packages OOo user directory user/uno_packages My Packages
Deploy to user
Access with command lines Macros can be accessed by launching a command line Example : automatically export a file to PDF soffice 'macro:///myLibrary.module.DocumentToPDF (&quot;/home/lgodard/source.odt&quot; ,  &quot;/home/lgodard/result.pdf&quot;)'
PyUNO Python bridge to OOo API Use for macros Use for external/remote scripting Deployable as addons Code simplifications similar to OOoBasic ones Object oriented so that we can create our own services  By overloading existing ones Creating a totally new (defining a new IDL) Simple as OOoBasic, powerful as Java ;) See Paolo's Mantovani examples http://www.paolo-mantovani.org/
Python example HelloWorld python script as a macro
PyXRAY All written in pyUNo using OOo graphical toolkit Points to the SDK offline and online http://www.indesko.com/sites/en/downloads/pyxray___a_tool_for/view Under development, need feed back
pyXRAY
Python for remotely driving OOo Open OOo in listen mode Command line <OOo>/program/soffice &quot;-accept=socket,host=localhost,port=2002;urp;&quot; Every time Configuration file  <Ooo>/share/registry/data/org/openoffice/Setup.xcu <prop oor:name=&quot;ooSetupConnectionURL&quot; oor:type=&quot;xs:string&quot;>   <value>socket,host=localhost,port=2002;urp;</value> </prop> Host & port allow remote scripting eg : oooconv A converter farm on an intranet (XML-RPC and asynchronous using twisted framework) http://svn.nuxeo.org/trac/pub/browser/OOo/oooconv
Example : doctests http://blogs.nuxeo.com/sections/blogs/laurent_godard/2006_04_13_testing-pyuno-programs-with-doctests
Using UNO services Overload existing services Creating your own IDL  Define your own service and callable methods More advanced use but powerful
PyUNO needs you Version 2.3.5 Following python versions would be great Need an editor or at least a binding Enhance addon management allowing several .py files in the extension file Use pyUNO to create more and more Extensions Extension project http://wiki.services.openoffice.org/wiki/Extensions_development_python  More helpers More documentation & feedback
Conclusion Create your daily business programs or helpers by implementing scripting Extensions A lot of tools and documentation available Extensions project and scripting framework Helps you starting http://wiki.services.openoffice.org/wiki/Extensions Distribute your useful tools, feel free to contribute dev@extensions.openoffice.org  A download site is being setup (any help ?) Tracks to follow at OOoCon 2006 Eg: Development track on wednesday afternoon (Juergen Schmidt about extensions infrastructure and Cedric Bosdonnat about URE for going further)
Thanks Illustrations from Ben Bois

More Related Content

PDF
Web Programming UNIT VIII notes
PDF
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
PPTX
Introduction to python
PDF
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
PDF
Advanced Python Tutorial | Learn Advanced Python Concepts | Python Programmin...
PDF
Web programming UNIT II by Bhavsingh Maloth
PPT
Prelims Coverage for Int 213
PPTX
Golang for OO Programmers
Web Programming UNIT VIII notes
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
Introduction to python
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
Advanced Python Tutorial | Learn Advanced Python Concepts | Python Programmin...
Web programming UNIT II by Bhavsingh Maloth
Prelims Coverage for Int 213
Golang for OO Programmers

What's hot (20)

PPT
Smoothing Your Java with DSLs
PPT
Visual Studio .NET2010
PDF
Get started python programming part 1
PPTX
ColdBox i18N
PPT
Introduction to Python
PDF
Introduction of Python
PDF
web programming UNIT VIII python by Bhavsingh Maloth
PDF
Fundamentals of python
PPTX
PPTX
Presentation of Python, Django, DockerStack
PDF
Introduction to Go language
PDF
DOCX
Guidelines php 8 gig
PDF
Socket Programming In Python
PPTX
Python introduction towards data science
PDF
Introduction to python programming
PDF
Building Desktop RIAs With PHP And JavaScript
PPTX
Learn python – for beginners
PDF
Advanced PHP: Design Patterns - Dennis-Jan Broerse
 
Smoothing Your Java with DSLs
Visual Studio .NET2010
Get started python programming part 1
ColdBox i18N
Introduction to Python
Introduction of Python
web programming UNIT VIII python by Bhavsingh Maloth
Fundamentals of python
Presentation of Python, Django, DockerStack
Introduction to Go language
Guidelines php 8 gig
Socket Programming In Python
Python introduction towards data science
Introduction to python programming
Building Desktop RIAs With PHP And JavaScript
Learn python – for beginners
Advanced PHP: Design Patterns - Dennis-Jan Broerse
 
Ad

Viewers also liked (13)

PDF
Agile Testing Pasadena JUG Aug2009
PDF
Introducing Django-Servee
PDF
Introduction to Enterprise 2.0
PDF
Django Uni-Form
KEY
Db tips & tricks django meetup
PPTX
The .NET developer's introduction to IronPython
KEY
Advanced Django ORM techniques
PPT
Django Forms: Best Practices, Tips, Tricks
PPT
Innovations Techniques Au Service Du Test De Recette Automatisé
PDF
Ingénierie des exigences - Principes de base de GenSpec (la théorie derrière ...
PDF
Energy Saving With Plugwise
PDF
5 Appel D Offres Et Cahier Des Charges
KEY
DjangoCon 2010 Scaling Disqus
Agile Testing Pasadena JUG Aug2009
Introducing Django-Servee
Introduction to Enterprise 2.0
Django Uni-Form
Db tips & tricks django meetup
The .NET developer's introduction to IronPython
Advanced Django ORM techniques
Django Forms: Best Practices, Tips, Tricks
Innovations Techniques Au Service Du Test De Recette Automatisé
Ingénierie des exigences - Principes de base de GenSpec (la théorie derrière ...
Energy Saving With Plugwise
5 Appel D Offres Et Cahier Des Charges
DjangoCon 2010 Scaling Disqus
Ad

Similar to Scripting in OpenOffice.org (20)

PDF
Socket programming-in-python
PPTX
API Documentation Workshop tcworld India 2015
PPTX
API workshop: Introduction to APIs (TC Camp)
PPT
The future of server side JavaScript
PDF
Bending the odoo learning curve - Odoo Experience 2015
PPTX
Pymongo password change made easy
PPT
Introduction to Software Development
PDF
Build Great Networked APIs with Swift, OpenAPI, and gRPC
PDF
Gwt and JSR 269's Pluggable Annotation Processing API
ODP
Benefits of Extensions
ODP
Benefits of Extensions
PPTX
Introduction to Google App Engine with Python
PPT
Zpugdccherry 101105081729-phpapp01
PPT
Cmpe202 01 Research
PPTX
Web Dev 21-01-2024.pptx
PDF
Introduction to Apigility
PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
PPT
Django, What is it, Why is it cool?
PDF
Pyhton-1a-Basics.pdf
Socket programming-in-python
API Documentation Workshop tcworld India 2015
API workshop: Introduction to APIs (TC Camp)
The future of server side JavaScript
Bending the odoo learning curve - Odoo Experience 2015
Pymongo password change made easy
Introduction to Software Development
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Gwt and JSR 269's Pluggable Annotation Processing API
Benefits of Extensions
Benefits of Extensions
Introduction to Google App Engine with Python
Zpugdccherry 101105081729-phpapp01
Cmpe202 01 Research
Web Dev 21-01-2024.pptx
Introduction to Apigility
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Django, What is it, Why is it cool?
Pyhton-1a-Basics.pdf

More from Alexandro Colorado (20)

ODP
Bitcuners revolucion blockchain
ODP
Presentacion Krita
ODP
Bitcuners porque bitcoins
ODP
ChamiloCon Enseñando con Tecnología
ODP
Curso de desarrollo web para principiantes
ODP
ChamiloCon: Recursos de Software Libre
ODP
Krita - Tu tambien puedes pintar un arbol Feliz
ODP
Gobernancia y particionacion en comunidades de Software Libre v2
PDF
Blender - FLISOL Cancun 2014
ODP
The Hitchhicker's Guide to Opensource
ODP
OpenERP: El ecosistema de negocios
ODP
Aprendiendo GnuPG
ODP
Catalogo decursos
ODP
Practicas virtuales v2.2
ODP
Introducción al curso de Extensiones de OpenOffice
ODP
Comunidades software libre
ODP
Practicas virtuales v2
ODP
Practicas virtuales
ODP
Economia digital
Bitcuners revolucion blockchain
Presentacion Krita
Bitcuners porque bitcoins
ChamiloCon Enseñando con Tecnología
Curso de desarrollo web para principiantes
ChamiloCon: Recursos de Software Libre
Krita - Tu tambien puedes pintar un arbol Feliz
Gobernancia y particionacion en comunidades de Software Libre v2
Blender - FLISOL Cancun 2014
The Hitchhicker's Guide to Opensource
OpenERP: El ecosistema de negocios
Aprendiendo GnuPG
Catalogo decursos
Practicas virtuales v2.2
Introducción al curso de Extensiones de OpenOffice
Comunidades software libre
Practicas virtuales v2
Practicas virtuales
Economia digital

Recently uploaded (20)

PDF
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
PDF
IFRS Notes in your pocket for study all the time
PPTX
5 Stages of group development guide.pptx
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PDF
Business model innovation report 2022.pdf
DOCX
Euro SEO Services 1st 3 General Updates.docx
PDF
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
PDF
Power and position in leadershipDOC-20250808-WA0011..pdf
PDF
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
PDF
Ôn tập tiếng anh trong kinh doanh nâng cao
PDF
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
PDF
MSPs in 10 Words - Created by US MSP Network
PPTX
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh
PDF
Chapter 5_Foreign Exchange Market in .pdf
PDF
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
PDF
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
PPTX
Principles of Marketing, Industrial, Consumers,
PDF
How to Get Business Funding for Small Business Fast
PDF
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
IFRS Notes in your pocket for study all the time
5 Stages of group development guide.pptx
Roadmap Map-digital Banking feature MB,IB,AB
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
Business model innovation report 2022.pdf
Euro SEO Services 1st 3 General Updates.docx
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
Power and position in leadershipDOC-20250808-WA0011..pdf
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
Ôn tập tiếng anh trong kinh doanh nâng cao
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
MSPs in 10 Words - Created by US MSP Network
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh
Chapter 5_Foreign Exchange Market in .pdf
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
Principles of Marketing, Industrial, Consumers,
How to Get Business Funding for Small Business Fast
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise

Scripting in OpenOffice.org

  • 1. Introduction to OpenOffice.org scripting features Laurent Godard
  • 2. Agenda Context What is scripting ? Tools What does OpenOffice.org provide ? Scripting OpenOffice.org Presentation Basic Python
  • 3. Scripting Possibility to pilot OpenOffice.org elements for our own needs Access its API/features by code This can be done From a code inside OpenOffice.org : macros From outside OpenOffice.org : connection line ooffice &quot;-accept=socket,host=localhost,port=2002;urp;&quot; setup.xcu <prop oor:name=&quot;ooSetupConnectionURL&quot;> Network connection on localhost and even network From components deployed at OOo level : Add-ons Once a connection is set up, scripting is almost the same
  • 4. Context and definitions Many languages Java, C++, COM (VB, delphi), .Net, ... Language uses OOo API via UNO bridges Java C++ Python A P I UNO UNO UNO OpenOffice.org core ... UNO
  • 5. Definitions API : Application Programming Interface Access to objects, properties and methods of OOo core No need to know OOo source code but only the API it exposes SDK : Software Development Kit Toolbox dedicated to developers to use OpenOffice.org API and build their programs UNO : Universal Network Object Description of objects that allow to communicate with API no matter the localization of objects The bridges for different languages allow its use in heterogeneous environments
  • 6. Tools IDE Integrated development environment OOo dialog builder graphical tool SDK What does it contains as documentation ? How to browse it ? Helpers What are the coding facilities introduced in scripting languages ? Useful developments by community
  • 8. The basic IDE – code Syntax coloration Step by step debugging tool Call stack Variable values and object explorer
  • 9. The basic IDE – dialogs Build your own dialogs with integrated tools
  • 11. IDE for other languages Javascript Beanshell Nothing for Python, we have to use an external IDE and import the code into OOo
  • 12. First Macro Hello Message No OOo interaction Basic language compliant
  • 13. Going deeper Need to access OOo objects to create business helpers inside the office suite Where to find them ? The SDK provides many documentation on the API Developers guide Related OpenOffice.org projects http://extensions.openoffice.org http://api.openoffice.org http://udk.openoffice.org http://framework.openoffice.org
  • 14. The SDK (OOoBasic Use) A deployable archive http://api.openoffice.org around 30 Mb (100 Mb installed) In english IDL reference Developers guide Examples OpenDocument and OpenOffice.org 1.x file specification Building tools and Java/C++ reference (not needed for basic) ...
  • 15. IDL Reference Synthetic information For a given service and interface, enumerates all properties and methods it offers Some comment lines on each Hyperlink navigation allowing exploration of returned types Index and navigation pages Alphabetical Hyperlink navigation allowing deep exploration Hyperlinks between IDL reference ans developers guide Ideal for finding its way in the API
  • 17. Developers Guide Full documentation on UNO and API more than 1000 pages HTML or PDF Cross hyperlink reference to IDL Numerous code examples (Java) and UML diagrams
  • 18. OOoBasic coding simplifications ThisComponent, StarDesktop CreateUNOService, CreateUNOStruct ConvertToURL, convertFromURL Get and set methods are binded to properties in read and write mode setString, getString methods to String property Collections are translated to arrays getByIndex method calls not needed anymore Structures and named constant recognized com.sun.star.beans.PropertyValue Introspection : dbg_methods, dbg_properties
  • 19. Xray - OOoBasic Navigate recursively into the API, plugged to the IDL B. Marcelly
  • 20. XRay – SDK binding http://www.ooomacros.org/dev.php#101416
  • 21. First OOo API use Convert a document to PDF
  • 22. Packaging as addon Can be distributed inside a document but then not integrated to OOo Definition of an addon A deployable set of code containing information on its availability and access in OpenOffice.org in a standalone file Compressed file containing code, resources and configuration – a new filename extension defined : oxt (OOo 2.0.4) Developers guide chapter 4 Paolo's previous year presentation http://marketing.openoffice.org/ooocon2005/presentations/thursday_d4.pdf
  • 23. addons.xcu OOo GUI integration XML file containing the toolbar and menu layout of the packaged code Defines icons resources Titles and Translations Associates code to be launched to each interface elements Toolbar Main menu and submenus Tools > Addons submenu Help menu Addon tool http://www.ooomacros.org/dev.php#101618
  • 24. Addon tool B. Marcelly
  • 25. Deploy to user Using command line tool unopkg (OOo closed) <ooo>/program/unopkg Package manager Tools > Package manager To all users in share directory or only at user level OOo installation directory share/uno_packages OpenOffice.org Packages OOo user directory user/uno_packages My Packages
  • 27. Access with command lines Macros can be accessed by launching a command line Example : automatically export a file to PDF soffice 'macro:///myLibrary.module.DocumentToPDF (&quot;/home/lgodard/source.odt&quot; , &quot;/home/lgodard/result.pdf&quot;)'
  • 28. PyUNO Python bridge to OOo API Use for macros Use for external/remote scripting Deployable as addons Code simplifications similar to OOoBasic ones Object oriented so that we can create our own services By overloading existing ones Creating a totally new (defining a new IDL) Simple as OOoBasic, powerful as Java ;) See Paolo's Mantovani examples http://www.paolo-mantovani.org/
  • 29. Python example HelloWorld python script as a macro
  • 30. PyXRAY All written in pyUNo using OOo graphical toolkit Points to the SDK offline and online http://www.indesko.com/sites/en/downloads/pyxray___a_tool_for/view Under development, need feed back
  • 32. Python for remotely driving OOo Open OOo in listen mode Command line <OOo>/program/soffice &quot;-accept=socket,host=localhost,port=2002;urp;&quot; Every time Configuration file <Ooo>/share/registry/data/org/openoffice/Setup.xcu <prop oor:name=&quot;ooSetupConnectionURL&quot; oor:type=&quot;xs:string&quot;>   <value>socket,host=localhost,port=2002;urp;</value> </prop> Host & port allow remote scripting eg : oooconv A converter farm on an intranet (XML-RPC and asynchronous using twisted framework) http://svn.nuxeo.org/trac/pub/browser/OOo/oooconv
  • 33. Example : doctests http://blogs.nuxeo.com/sections/blogs/laurent_godard/2006_04_13_testing-pyuno-programs-with-doctests
  • 34. Using UNO services Overload existing services Creating your own IDL Define your own service and callable methods More advanced use but powerful
  • 35. PyUNO needs you Version 2.3.5 Following python versions would be great Need an editor or at least a binding Enhance addon management allowing several .py files in the extension file Use pyUNO to create more and more Extensions Extension project http://wiki.services.openoffice.org/wiki/Extensions_development_python More helpers More documentation & feedback
  • 36. Conclusion Create your daily business programs or helpers by implementing scripting Extensions A lot of tools and documentation available Extensions project and scripting framework Helps you starting http://wiki.services.openoffice.org/wiki/Extensions Distribute your useful tools, feel free to contribute dev@extensions.openoffice.org A download site is being setup (any help ?) Tracks to follow at OOoCon 2006 Eg: Development track on wednesday afternoon (Juergen Schmidt about extensions infrastructure and Cedric Bosdonnat about URE for going further)