|
this.container.documentEditor.search.findAll(“textToFind”);
this.container.documentEditor.search.searchResults.replaceAll("textToReplace");
this.container.documentEditor.search.searchResults.clear();
|
Can I use variables in the text?
For example:
{userName} has a dog. Lorem ipsum dolor sit amet, consectetur adipiscing elit.........
Thanks!
|
this.container. documentEditor.search.find("{" + "userName" + "}");
this.container.documentEditor.search.findAll ("{" + "userName" + "}");
this.container.documentEditor.search.searchResults.replaceAll("Mike");
this.container.documentEditor.search.searchResults.replace("Mike");
|
Thank you! It helps in the search.
But if I have a list of variables how can I put it in document?
<DocumentEditorComponent ref={(scope) => { this.documenteditor = scope; }} />
User sees a list: 'cat', 'dog'. How to put a variable in the document if he chose 'dog'? And I want to set it as a variable, not as a text: because if the user changes his pet from 'dog' to 'cat' I also want to change it in text (by userId).
Thanks!
Thanks a lot! This is what I'm looking for.
One more question. How to insert a new variable with a custom name? I use:
documentEditor.editor.insertFormField('Text');
but 'fieldName' is set as 'Text1'. So I get:
For example, I want to create a field "UserId33" with a value "Fox". How to do it?
Thanks!
Hello! Can you provide the sample code how to change fieldName programatically as in example https://ej2.syncfusion.com/react/demos/?_ga=2.30936447.1944405803.1627288834-615821001.1620994270#/material/document-editor/form-fields ?
Thanks!
|
onImportFormData() {
let textFormField1 = {
fieldName: 'UserId1',
value: 'Dog'
};
let textFormField2 = {
fieldName: 'UserId2',
value: 'Cat'
};
let textFormField3 = {
fieldName: 'UserId3',
value: 'Lion'
};
this.container.documentEditor.importFormData([
textFormField1,
textFormField2,
textFormField3
]);
}
|
Thanks for the answer!
There are fields with fieldName `UserId1`, `UserId2, `UserId3` in defaultDocument in your example. And the code `this.container.documentEditor.importFormData` just changes their values.
And now in your example: how to change the fieldName `UserId1` to `UserId11111` as a next step? There is this opportunity to do it in the suncfusion modal, but I want to change it from another place in my app.
Thanks!
Hi! If you have such option in your modal, can you give the programmers the opportunity to change 'fieldName'?
Thanks.
|
this.container.documentEditor.setFormFieldInfo("Text1", textfieldInfo); |