Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mail merge embedding in LibreOffice Writer

Bb2fd3b5456ad0012799b2045f4cd212?s=47 Miklos V
January 30, 2016
160

Mail merge embedding in LibreOffice Writer

FOSDEM 2016, , Brussels

Bb2fd3b5456ad0012799b2045f4cd212?s=128

Miklos V

January 30, 2016
Tweet

Transcript

  1. Mail merge embedding in LibreOffice Writer By Miklos Vajna Software

    Engineer at Collabora Productivity 2016-01-30 @CollaboraOffice www.CollaboraOffice.com
  2. 2 / 19 FOSDEM 2016, Brussels | Miklos Vajna About

    Miklos • From Hungary • More blurb: http://vmiklos.hu/ • Google Summer of Code 2010/2011 • Rewrite of the Writer RTF import/export • Writer developer since Feb 2012 • Contractor at Collabora since Sept 2013
  3. Embedding a mail merge data source definition

  4. 4 / 19 FOSDEM 2016, Brussels | Miklos Vajna Embedded

    objects • Cross-platform for native data models • Windows-only: OLE • Bitmap (replacement image) + native data • In Writer: text embedded object • Part of the document body (anchored, etc.)
  5. 5 / 19 FOSDEM 2016, Brussels | Miklos Vajna Mail

    merge data source definition • Typical use-case: • Real data source • Base document (wrapper): data source definition • Global inside LibreOffice • Mail merge uses a data source from this list
  6. 6 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #1 • Save your document template • Tools → Mail Merge Wizard • Select Address list → e.g. a .ods file • Edit document
  7. 7 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #2 • Insert mail merge fields • Return to the wizard
  8. 8 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #3 • Save merged document • Save as single document • Click on save document • Close the merged result, no need to save
  9. 9 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #4 • Embedded data source is registered • Close the mail template • Data source definition disappears
  10. 10 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #5 • Open the mail template • Embedded data source definition is registered again
  11. How is this implemented?

  12. 12 / 19 FOSDEM 2016, Brussels | Miklos Vajna Embedding

    a Base document • dbaccess::ODatabaseDocument • Does not inherit from SfxBaseModel • dbaccess::ODatabaseContext is the global manager • No SwOLENode, just OCommonEmbeddedObject • SwDBManager's StoreEmbeddedDataSource() is the implementation
  13. 13 / 19 FOSDEM 2016, Brussels | Miklos Vajna ODF

    filter • Newly handled parameters: • TargetStorage • StreamRelPath • BaseURI • dbaxml::ODBFilter is the importer • dbaxml::ODBExport is the export • loadFromStorage() not implemented, storeToStorage() needed fixing
  14. 14 / 19 FOSDEM 2016, Brussels | Miklos Vajna Embedding

    without a text embedded object • ODatabaseContext owns the doc model • In ODF, settings.xml refers the storage of the XML streams • It gets registered on load • It gets removed on close
  15. 15 / 19 FOSDEM 2016, Brussels | Miklos Vajna Mail

    merge wizard • SwDBManager's LoadAndRegisterDataSource() does the creation • The Writer document has to be saved, so it has a storage • The embedded model then can be a sub- storage
  16. 16 / 19 FOSDEM 2016, Brussels | Miklos Vajna Address

    book wizard • Another user interface to create data source definitions • Code in extensions/source/abpilot/
  17. 17 / 19 FOSDEM 2016, Brussels | Miklos Vajna Relative

    references, testing • Feature: relative references • So .odt and .ods can travel together • But ../ would refer to the non-embedded parent model • Have to support even ../../ • If the parent doc moves → need to re- save the embedded doc • SwUiWriterTest's testEmbeddedDataSource()
  18. 18 / 19 FOSDEM 2016, Brussels | Miklos Vajna Thanks

    • Collabora is an open source consulting company • What we do and share with the community has to be paid by someone • LHM sponsored this work
  19. 19 / 19 FOSDEM 2016, Brussels | Miklos Vajna Summary

    • Mail merge embedding allows mail merge with just two (ODT and e.g. ODS) documents • Available in LibreOffice 5.1 • Improves experience for those who migrate from Microsoft Office • One more long-standing problem solved • Thanks for listening! :-) • Slides: http://vmiklos.hu/odp