Mail merge embedding in LibreOffice Writer By Miklos Vajna - - PowerPoint PPT Presentation

mail merge embedding in libreoffice writer
SMART_READER_LITE
LIVE PREVIEW

Mail merge embedding in LibreOffice Writer By Miklos Vajna - - PowerPoint PPT Presentation

Mail merge embedding in LibreOffice Writer By Miklos Vajna Software Engineer at Collabora Productivity 2016-01-30 @CollaboraOffice www.CollaboraOffice.com About Miklos From Hungary More blurb: http://vmiklos.hu/ Google Summer of


slide-1
SLIDE 1

Mail merge embedding in LibreOffice Writer

By Miklos Vajna

Software Engineer at Collabora Productivity 2016-01-30 @CollaboraOffice www.CollaboraOffice.com

slide-2
SLIDE 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
slide-3
SLIDE 3

Embedding a mail merge data source definition

slide-4
SLIDE 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.)
slide-5
SLIDE 5

5 / 19 FOSDEM 2016, Brussels | Miklos Vajna

Mail merge data source defjnition

  • Typical use-case:
  • Real data source
  • Base document (wrapper): data source

definition

  • Global inside LibreOffice
  • Mail merge uses a data source from this list
slide-6
SLIDE 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
slide-7
SLIDE 7

7 / 19 FOSDEM 2016, Brussels | Miklos Vajna

Results #2

  • Insert mail merge fields
  • Return to the wizard
slide-8
SLIDE 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
slide-9
SLIDE 9

9 / 19 FOSDEM 2016, Brussels | Miklos Vajna

Results #4

  • Embedded data source is registered
  • Close the mail template
  • Data source definition disappears
slide-10
SLIDE 10

10 / 19 FOSDEM 2016, Brussels | Miklos Vajna

Results #5

  • Open the mail template
  • Embedded data source definition is

registered again

slide-11
SLIDE 11

How is this implemented?

slide-12
SLIDE 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

slide-13
SLIDE 13

13 / 19 FOSDEM 2016, Brussels | Miklos Vajna

ODF fjlter

  • Newly handled parameters:
  • TargetStorage
  • StreamRelPath
  • BaseURI
  • dbaxml::ODBFilter is the importer
  • dbaxml::ODBExport is the export
  • loadFromStorage() not implemented,

storeToStorage() needed fixing

slide-14
SLIDE 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
slide-15
SLIDE 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

slide-16
SLIDE 16

16 / 19 FOSDEM 2016, Brussels | Miklos Vajna

Address book wizard

  • Another user interface to create data

source definitions

  • Code in extensions/source/abpilot/
slide-17
SLIDE 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()

slide-18
SLIDE 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
slide-19
SLIDE 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 LibreOffjce 5.1
  • Improves experience for those who migrate from

Microsoft Offjce

  • One more long-standing problem solved
  • Thanks for listening! :-)
  • Slides: http://vmiklos.hu/odp