Qore jni Module 2.6.0
Loading...
Searching...
No Matches
WordDataProvider::WordWriteDataProvider Class Reference

Provides a data provider for writing Word documents (.docx format) More...

#include <WordWriteDataProvider.qc.dox.h>

Inherits DataProvider::AbstractDataProvider.

Public Member Methods

void constructor (string path, soft< hash< auto > > opts)
 Creates the WordWriteDataProvider with the output path and optionally an option hash.
 
void constructor (OutputStream stream, soft< hash< auto > > opts)
 Creates the WordWriteDataProvider with an output stream and optionally an option hash.
 
void setupWriter ()
 Sets up the writer.
 
string getName ()
 Returns the object name.
 
void destructor ()
 Destructor - ensures file is written.
 
soft< hash< auto > > createRecordImpl (hash< auto > rec, soft< hash< auto > > create_options)
 Creates a single record in the data provider.
 
void commit ()
 Commits (writes) the Word file.
 
binary getData ()
 Returns the data as binary.
 
int getCreatedCount ()
 Returns the number of records created.
 
hash< DataProviderInfo > getStaticInfoImpl ()
 Returns data provider static info.
 

Public Attributes

const auto ProviderInfo = ...
 Provider info.
 
const auto ConstructorOptions = ...
 Constructor options.
 

Private Attributes

soft< string > path
 The output path.
 
soft< OutputStream > stream
 The output stream.
 
string name
 The name of the object.
 
WordWriter writer
 The Word writer object.
 
soft< hash< auto > > opts
 The options.
 

Detailed Description

Provides a data provider for writing Word documents (.docx format)

Member Function Documentation

◆ commit()

void WordDataProvider::WordWriteDataProvider::commit ( )

Commits (writes) the Word file.

Call this method when you are done writing records to ensure the file is written. This is also called automatically in the destructor.

◆ constructor() [1/2]

void WordDataProvider::WordWriteDataProvider::constructor ( OutputStream  stream,
soft< hash< auto > >  opts 
)

Creates the WordWriteDataProvider with an output stream and optionally an option hash.

Parameters
streamthe output stream to write to
optsa hash of optional options
Exceptions
WORD-WRITE-OPTION-ERRORinvalid or unknown option; conflicting options

◆ constructor() [2/2]

void WordDataProvider::WordWriteDataProvider::constructor ( string  path,
soft< hash< auto > >  opts 
)

Creates the WordWriteDataProvider with the output path and optionally an option hash.

Parameters
paththe output file path
optsa hash of optional options
Exceptions
WORD-WRITE-OPTION-ERRORinvalid or unknown option; conflicting options

◆ createRecordImpl()

soft< hash< auto > > WordDataProvider::WordWriteDataProvider::createRecordImpl ( hash< auto >  rec,
soft< hash< auto > >  create_options 
)

Creates a single record in the data provider.

Parameters
recthe record to create
create_optionsno options are currently supported
Returns
the record created (echoes back the input)
Note
For paragraphs mode, the record should have "text" and optionally "style" keys. For table mode, the record should have key-value pairs matching the table columns.

◆ getData()

binary WordDataProvider::WordWriteDataProvider::getData ( )

Returns the data as binary.

Returns
the Word document contents as binary data
Note
This is an alternative to using path or stream - get the data directly

The documentation for this class was generated from the following file: