Docx Templater (rich text selection)

Do you have support for templating inside the document such as: https://docxtpl.readthedocs.io/en/latest/

I'm currently implementing everything manually, but I'm restricted by some API's functionalities, such as: after selecting a block of text, there is no way I can store the formatted text, the only way I interact with the data is through "documenteditor.selection.text", but I cannot preserve things such as bullets lists, paragraphs and rich formatted text without using the system's clipboard.

I just wanted to know if there's a way I can achive some of the templater's functionalities, such as repeating a block of text, either by a future templater implementation, or a way I can copy a block of documenteditor text without losing it's properties.

Thank you for your time!

1 Reply 1 reply marked as answer

HC Harini Chellappa Syncfusion Team August 28, 2020 01:53 PM UTC

Hi Raul, 

Syncfusion Greetings! 

You can draft the content in document editor and save it as SFDT string[template]. You can then insert the SFDT in current position using paste API of editor module. 

To get the SFDT string for the document in document editor. Please use the below API 

this.$refs.container.ej2Instances.documentEditor.serialize() 
 
 
To insert the SFDT in current position, please use the below API 

//pass the sfdt string, which extracts the document and inserts paragraph and table with its properties   
this.$refs.container.ej2Instances.documentEditor.editor.paste(sfdtstring)  
 
 
Note: you can insert a document (extracts the document and insert contains paragraph and table) at current cursor position using paste API.  

Please refer the below documentation on paste & serialize API 



Regards, 

Harini C 


Marked as answer
Loader.
Up arrow icon