Posted 3 July 2024, 2:06 am EST - Updated 3 July 2024, 2:11 am EST
Change text modal
Posted by: pedro.moraes on 3 July 2024, 2:06 am EST
-
-
Posted 4 July 2024, 6:11 pm EST
Hi,
Yes, you can change the text in the “New Formatting Rule” dialog box. For this, you would need to change the designer resource.
To get the designer resources, GC.Spread.Sheets.Designer.getResources() method can be used and GC.Spread.Sheets.Designer.setResources() method can be used to set the modified or updated resources to the designer.
For more information, kindly refer to the code snippet below and the sample.
// Get designer resources let resources = GC.Spread.Sheets.Designer.getResources(); let newFormattingRule = resources['conditionalFormatting']['newFormattingRule']; newFormattingRule.title += ' Customized'; // Set the updated resorces GC.Spread.Sheets.Designer.setResources(resources);
In the sample, the title text of the “New Formatting Dialog” is changed. Similarly, you can also change the text of other parts of the dialog. You can also save the designer resources with required modifications in a JSON file and then load the resources from the file and apply them to the designer using the above-mentioned methods.
In case you need further help, please let us know.
API references:
GC.Spread.Sheets.Designer.getResources(): https://developer.mescius.com/spreadjs/api/designer/modules/GC.Spread.Sheets.Designer#getresources
GC.Spread.Sheets.Designer.setResources(): https://developer.mescius.com/spreadjs/api/designer/modules/GC.Spread.Sheets.Designer#setresourcesRegards
-
Posted 4 July 2024, 11:38 pm EST
Ok, thanks
But how can I know the name of all the modals?
Because it was a example
-
Posted 7 July 2024, 6:10 pm EST - Updated 7 July 2024, 6:15 pm EST
Hi,
We are sorry for the inconvenience caused.
You can find the names of all the exposed modals/dialogs used in SpreadJS Designer at https://developer.mescius.com/spreadjs/api/designer/classes/GC.Spread.Sheets.Designer.TemplateNames. These templates are used to show different modals in/for various parts of SpreadJS Designer.
In the case of changing the text of a specific modal, the below steps can be followed.
-
Find the name of the modal/dialog that needs to be changed. It is typically at the top of the modal.
-
Find the template name of the modal/dialog at https://developer.mescius.com/spreadjs/api/designer/classes/GC.Spread.Sheets.Designer.TemplateNames. For instance, in the case of the “New Formatting Rule” dialog, it’s template name is “NewFormattingRuleDialogTemplate”. Similarly, other templates for other dialogs can be found.
-
Find the resources for the dialog in the designer resources. Use GC.Spread.Sheets.Designer.getResources() to get designer resources. The name/title of the dialog can be used to search it in the designer resources.
-
Modify the dialog text accordingly and update them using GC.Spread.Sheets.Designer.SetResources() method.
I hope the above explanation will be helpful to you.
In case you require further assistance, kindly let us know.
Regards,
Chandan -