Set HighlightColor to nocolor for entire document

I want to set at the same time the Font Color to black, and the Highlight Color to no color. 
I have the following code: 

 public void OnClickToolBar(Syncfusion.Blazor.DocumentEditor.ClickEventArgs args)
        {
            try
            {
                if (args.Item.Id == "Blacken")
                {
                    container.GetDocumentEditor().GetSelection().SelectAll();
                    container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetFontColor("Black");
                    container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetHighlightColor(HighlightColor.NoColor);
                    container.GetDocumentEditor().GetSelection().MoveToDocumentStart(); 
                }
            }
            catch (Exception e)
            {
                //Traza ERROR
                Logger clsLogger = new Logger(148, login, "test");
                var resultLog = clsLogger.Excepcion("OnClickToolBar", e);
            }
        }

The problem is that this code is not setting my text background to no color, what am I doing wrong?

10 Replies 1 reply marked as answer

KB Kurthis Banu Abdul Majeeth Syncfusion Team March 5, 2021 08:51 AM UTC

Hi Esther, 

Thank you for contacting Syncfusion support. 

We have checked the provided code snippet. To resolve the Font and Highlight color apply issue, you have to access Color like below: 

Code snippet: 
if (args.Item.Id == "Custom toolbar item2") { container.GetDocumentEditor().GetSelection().SelectAll(); container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetFontColor("black"); container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetHighlightColor(Syncfusion.Blazor.DocumentEditor.HighlightColor.NoColor);

For reference please check below sample link (index. razor file):  
Please find the code change in index. razor file Line number: 31 

Can you please check it and let us know if you have any questions? 

Regards, 
Kurthis Banu A. 



EG Esther Garcia del Barrio March 5, 2021 11:08 AM UTC

I have verified the snippet you send me, and I have noticed that sometimes it works and on another does not, I attach a complete example The TestNOK document does not respond as expected. I think the document has something that prevents the snippet from working but I don't know what.

Attachment: BlazorAppWord_c88dc61.7z


KB Kurthis Banu Abdul Majeeth Syncfusion Team March 8, 2021 09:58 AM UTC

Hi Esther, 

We can reproduce the reported issue whenever set the Highlight color to NoColor.  if the selection (SelectALL) has whole document. 
Currently, we are validating this issue, and we will get back to you with validation details by March 10,2021.  
Please let us know if you have any other questions.   
  
Regards, 
Kurthis Banu A. 



EG Esther Garcia del Barrio March 8, 2021 10:39 AM UTC

Hi Kurthis, I have provisionally patched the code as follows, not a very elegant solution but it works:

                container.GetDocumentEditor().GetSelection().SelectAll();
                container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetFontColor("black");
                container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetHighlightColor(Syncfusion.Blazor.DocumentEditor.HighlightColor.Gray25);
                container.GetDocumentEditor().GetSelection().GetCharacterFormat().SetHighlightColor(Syncfusion.Blazor.DocumentEditor.HighlightColor.NoColor);
                container.GetDocumentEditor().GetSelection().MoveToDocumentStart();


KB Kurthis Banu Abdul Majeeth Syncfusion Team March 8, 2021 11:04 AM UTC

Hi Esther, 

Yes, it’s working fine whenever set the Highlight color to other color before that sets highlight color to Nocolor. 
we are validating this whenever set the Highlight color to NoColor alone and we will get back to you with validation details by March 10,2021.   

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team March 10, 2021 02:14 PM UTC

Hi Esther,  

We have considered the reported scenario as bug and logged defect report. Fix will be included in our upcoming EJ2 patch release which is tentatively scheduled on March 31, 2021. Once included, will update you. You can track the status from the below feedback.     


Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team March 31, 2021 04:03 PM UTC

Hi Esther,   

Sorry for inconvenience caused.   

We will include the fix in our next Ej2 patch release which is tentatively scheduled on April 7,2021.  
You can track the status of bug through below feedback link:     

   
Regards,  
Kurthis Banu A.  



KB Kurthis Banu Abdul Majeeth Syncfusion Team April 8, 2021 07:23 AM UTC

Hi Esther,    

We are deeply regret the inconvenienced caused. We are not possible to include the fix in our latest patch release. Fix will be included in our upcoming EJ2 patch release which is tentatively scheduled on April 14, 2021. Once included, will update you. You can track the status from the below feedback.      
we will provide custom package for your reported issue on April 9,2021. 

Regards,   
Kurthis Banu A.   



KB Kurthis Banu Abdul Majeeth Syncfusion Team April 14, 2021 11:45 AM UTC

Hi Esther,    

We are not possible to include the fix for reported issue in our latest weekly NuGet release. So, we have created custom NuGet with fix. We will include the changes in our next weekly NuGet release which is scheduled on April 21,2021. Until use below custom package 
Please find the custom package for the reported issue.  

You can track the status from the below feedback.       

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team April 21, 2021 12:26 PM UTC

Hi Esther, 

We are glad to announce that our patch release (v19.1.0.57) is rolled out successfully and in that release, we have added the fix for reported issue.       
    
Please upgrade your nuget to the latest version packages to resolve this issue.      
   
Release Notes: 

Feedback Link:  

Regards, 
Kurthis Banu A. 


Marked as answer
Loader.
Up arrow icon