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

Mail merge embedding in LibreOffice Writer

Miklos V
January 30, 2016
180

Mail merge embedding in LibreOffice Writer

FOSDEM 2016, , Brussels

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. 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.)
  4. 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
  5. 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
  6. 7 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

    #2 • Insert mail merge fields • Return to the wizard
  7. 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
  8. 9 / 19 FOSDEM 2016, Brussels | Miklos Vajna Results

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

    #5 • Open the mail template • Embedded data source definition is registered again
  10. 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
  11. 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
  12. 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
  13. 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
  14. 16 / 19 FOSDEM 2016, Brussels | Miklos Vajna Address

    book wizard • Another user interface to create data source definitions • Code in extensions/source/abpilot/
  15. 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()
  16. 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
  17. 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