Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active December 22, 2020 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/9d4fbd7ab6289cf16422469d1dad533a to your computer and use it in GitHub Desktop.
Save bjoerntx/9d4fbd7ab6289cf16422469d1dad533a to your computer and use it in GitHub Desktop.
export class AppComponent {
public _http: HttpClient;
private _mergeData: any;
private _dsDocumentProcessing: DsDocumentProcessingModule;
constructor(http: HttpClient) {
this._http = http;
this._dsDocumentProcessing = new DsDocumentProcessingModule(this._http);
// dummy merge data
this._mergeData = [{
customer: [
{
name: "Peter Petersen",
company: "Software House",
},
{
name: "Jack Developer",
company: "Software Company",
}
],
}];
}
@HostListener('document:dsDocumentEditorLoaded')
onDsDocumentEditorLoaded() {
// attached textControlLoaded event
TXTextControl.addEventListener("textControlLoaded", () => {
// fill reporting drop-down structure with dummy merge data
this._dsDocumentProcessing.loadData(this._mergeData);
});
}
async onClickMergeDocument() {
// get the saved document from TXTextControl
let mergeBody: MergeBody = {
mergeData: this._mergeData,
template: await this._dsDocumentProcessing.saveDocument(),
mergeSettings: null
};
this._dsDocumentProcessing.mergeDocument(mergeBody, 'TX');
};
}
class MergeBody {
mergeData: any;
template: any;
mergeSettings: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment