We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add Picture once and re-use it at multiple locations

The worksheets is created dynamically and Each time Image logo is added and data is appended.
As it running for 800+ records , execution is timing out. (It's going upto 4 Minutes)
Without image embedding, it finishes in 30-60 seconds for the same data and number of records.

Can we add image only once using AddPicture method and use it or copy it at multiple locations using Indices. (Exact location where to copy will be available) ? 
This is to improve performance. Or is there any other way add logo images so that performance is not affected drastically. 

PFA of code file required.

Attachment: Data_c03ecf88.zip


Adding two more queries:

1. How to display custom text in grid column based on Column value ?
eg. IsTestRun is boolean column.
If it is true display Yes , and No if false.
How do we specify column type is boolean and add custom text for it ?
            col.Field(p => p.IsTestRun).HeaderText("IsTestRun").Type("bool").TextAlign(TextAlign.Left).Add();

2. How to format date display ?
Eg. Startzeit is of string datatype and has date value. 
How to format it look like as below ?
How to handle check for null values? If Null display NA
            col.Field(p => p.Startzeit).HeaderText("Startzeit").Format("{0:dd/MM/yyyy  }").TextAlign(TextAlign.Left).Add();



16 Replies

AV Abirami Varadharajan Syncfusion Team August 21, 2019 06:35 PM UTC

Hi Vaibhav, 
 
Greetings from Syncfusion. 
 
We are working on your queries. We will update further details by 23rd August 2019. 
 
Regards, 
Abirami 



AV Abirami Varadharajan Syncfusion Team August 26, 2019 12:13 PM UTC

Hi Vaibhav,  
  
Please find the details for your queries below.  
  
Queries   
Details  
The worksheets is created dynamically and Each time Image logo is added and data is appended.  
As it running for 800+ records , execution is timing out. (It's going upto 4 Minutes)  
Without image embedding, it finishes in 30-60 seconds for the same data and number of records.  
  
Can we add image only once using AddPicture method and use it or copy it at multiple locations using Indices. (Exact location where to copy will be available) ?   
This is to improve performance. Or is there any other way add logo images so that performance is not affected drastically.   
  
PFA of code file required.  

Attachment: Data_c03ecf88.zip 
 
We are not facing performance issue while adding pictures multiple times. We have prepared sample for adding pictures as per your scenario and it gets added in few seconds. Please find the sample for the same from following link.  
  
  
So, please get back to us with below details to validate further from our side.  
  
  1. Picture used at your end.
  2. Syncfusion working version
  3. Modified issue reproducing sample.
  
How to display custom text in grid column based on Column value ?  
eg. IsTestRun is boolean column.  
If it is true display Yes , and No if false.  
How do we specify column type is boolean and add custom text for it ?  
            col.Field(p => p.IsTestRun).HeaderText("IsTestRun").Type("bool").TextAlign(TextAlign.Left).Add();  
  
We can achieve your requirement using the ValueAccessor property of Grid.  
 
Here we have modify the “Verified” column value into Yes/No based on those column value.  
 
[Index.cshtml]  
 
@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>  
{  
    col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).Width("120").Add();  
    col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();  
    col.Field("OrderDate").HeaderText("Order Date").Type("date").Format(format).Width("110").Add();  
    col.Field("Freight").HeaderText("Freight").Width("120").Add();  
   col.Field("Verified").Type("boolean").ValueAccessor("CustomizeText").Width("150").Add();  
    }).AllowPaging().Render()  
  
<script>  
  
    function CustomizeText(field, data, column) {  
        if (data[field])  
            return "Yes";  
        else  
            return "No";  
    }  
  
</script>  
How to format date display ?  
Eg. Startzeit is of string datatype and has date value.   
How to format it look like as below ?  
How to handle check for null values? If Null display NA  
            col.Field(p => p.Startzeit).HeaderText("Startzeit").Format("{0:dd/MM/yyyy  }").TextAlign(TextAlign.Left).Add();  
  
We can achieve your requirement using the Format property of Grid.  
 
Here, we have set the customized format for “OrderDate” column in Grid.  
 
[Index.cshtml]  
 
@{   
    object format;  
    format = new { type = "date", format = "0: dd/MM/yyyy" };  
}  
  
  
  
@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>  
{  
    . . . .  
  
    col.Field("OrderDate").HeaderText("Order Date").Type("date").Format(format).Width("110").Add();  
      
    . . . .  
  
    }).AllowPaging().Render()  
   
Refer the help documentation.  
 
 
 
We have prepared a sample with the solution of both the queries and it can be downloadable from the below location.  
 
  
Regards,  
Abirami  



VM Vaibhav More August 27, 2019 09:18 AM UTC

Thanks for the reply.

PFB reply :

1. Performance issue: 

  1. Picture used at your end. : PFA
  2. Syncfusion working version: Syncfusion.EJ.MVC, Version=16.3500.0.29
  3. Modified issue reproducing sample. PFA

2. Formatting Queries: Both of the answers for the below queries do not seem to be working. (Used version EJ and not EJS).

- Had already tried Format property which seems to be not working.
-ValueAccessor looks like not available in EJ.

Attachment: QueryData_721ceef4.zip


AV Abirami Varadharajan Syncfusion Team August 28, 2019 04:41 PM UTC

Hi Vaibhav, 

Thank you for updating us. 

Please find the details below. 

Queries  
Details 
Performance issue:  
  1. Picture used at your end. : PFA
  2. Syncfusion working version: Syncfusion.EJ.MVC, Version=16.3500.0.29
  3. Modified issue reproducing sample. PFA. 

We are unable to reproduce the issue with the shared details. Shared image is added 800 times in the worksheet within 10 seconds. We request you to share the issue reproducing runnable sample which will be helpful for us to analyse performance issue from our side. 
Formatting Queries: Both of the answers for the below queries do not seem to be working. (Used version EJ and not EJS). 
- Had already tried Format property which seems to be not working. 
-ValueAccessor looks like not available in EJ. 
We can display the custom text using the QueryCellInfo event of ejGrid and by defining the format with type in column definition we can show value with desire format. Refer the below code example,  
 
 
  
@(Html.EJ().Grid<object>("FlatGrid")  
            .Datasource((IEnumerable<object>)ViewBag.datasource)  
            .AllowPaging()  
            .ClientSideEvents(e=>e.QueryCellInfo("OnQueryCellInfo"))  
            .Columns(col =>  
            {  
                col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();  
                col.Field("OrderDate").HeaderText("OrderDate").Format("{0:dd/MM/yyyy}").Type("datetime").Width(80).Add();  
                col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();  
               col.Field("Verified").HeaderText("Verified").Type("bool").Width(30).Add();  
            }))  
  
  
<script>  
    function OnQueryCellInfo(args) {  
        if (args.column.field == "Verified") {  
            if (args.data.Verified == true  
                args.cell.innerText = "Yes";  
            else  
                args.cell.innerText = "No";  
        }  
        if (args.column.field == "OrderID") {  
            if (args.data.OrderID == null) {  
                args.cell.innerText = "NA";  
            }  
        }  
    }  
</script>  
 
Output:   
  


Regards, 
Abirami 



VM Vaibhav More August 29, 2019 09:06 AM UTC

Hello,

1. QueryCellInfo - This seems to be working.
2. Date Formatting - Still, it seems to be not working.
3. Performance Issue - PFA of running code snippet.

Attachment: PerfIssue_864bc3c9.zip


AV Abirami Varadharajan Syncfusion Team August 30, 2019 04:06 PM UTC



AV Abirami Varadharajan Syncfusion Team September 4, 2019 02:27 PM UTC

Hi Vaibhav, 

Thank you for your patience. 

We confirmed issue with “Improve performance while adding picture along with merging of large number of cells” is a defect and logged a defect report for the same. The patch for this issue is estimated to be available on 25th  September 2019. 

Regards, 
Abirami 



VM Vaibhav More September 16, 2019 05:31 AM UTC

Thanks for the update


AV Abirami Varadharajan Syncfusion Team September 25, 2019 05:28 PM UTC

Hi Vaibhav,    
     
We have fixed issue with “Improve performance while adding picture along with merging of large number of cells”. The patch can be downloaded from the following locations.             
             
Recommended approach - exe will perform automatic configuration               
Please find the patch setup from below location:                            
         
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment               
Please find the patch assemblies alone from below location:                      

         
Assembly Version: 17.2.0.46       
Installation Directions : 
This patch should replace Syncfusion.XlsIO.Base.dll  under the following folder.                
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.6
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.2.0.46\precompiledassemblies\17.2.0.46\4.6

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.
Note:                        
You can change how you receive bug fixes by navigating to the following link and updating your preferences.                     

Disclaimer : 
Please note that we have created this patch for version 17.2.0.46 specifically to resolve the issues reported in this forum.                     

If you have received other patches for the same version for other products, please apply all patches in the order received.                     

This fix will be included in our latest release 17.3 SP – 1 which will be rolled out by October 2019.                
        
Regards,        
Abirami     



VM Vaibhav More October 3, 2019 07:40 AM UTC

Thanks for the update.

Tried with version performance seems to be improved to 30 seconds from 5 minutes.

Soon, it will be integrated with updated version of syncfusion.




AV Abirami Varadharajan Syncfusion Team October 4, 2019 11:04 AM UTC

Hi Vaibhav, 

Thank you for updating us. 

We are glad that the performance is improved at your end. As promised earlier, we will include the fix for “Improve performance while adding picture along with merging of large number of cells” in our upcoming release 17.3 SP – 1 which will be rolled out by end of October 2019. 

Regards, 
Abirami 



VM Vaibhav More October 9, 2019 05:55 AM UTC

Thanks.
Please do update about the specific version if it is released or whenever it is released.


AV Abirami Varadharajan Syncfusion Team October 10, 2019 05:03 PM UTC

Hi Vaibhav, 
 
As promised earlier, we will include the fix for “Improve performance while adding picture along with merging of large number of cells” in our upcoming release 17.3 SP – 1 which will be rolled out by end of October 2019.  We will update you once the release is rolled out. 
 
Regards, 
Abirami. 



VM Vaibhav More November 4, 2019 08:10 AM UTC

Hello Abirami,

Just following up that, if the stable patch is released for the month of October including the required fixes.

Thanks,
Vaibhav


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 5, 2019 05:05 AM UTC

Hi Vaibhav, 

We deeply regret for the inconvenience caused.  

We have found issues while testing the fix with various cases and working to resolve them. Hence we have not included the fix in 17.3 SP-1. We will include the fix in 17.4 main release which will be rolled out by end of December 2019. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 6, 2020 05:27 AM UTC

Hi Vaibhav, 

We are glad to announce that our Essential Studio 2019 Volume 4 Release v17.4.0.39 is rolled out and is available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Keerthi. 


Loader.
Live Chat Icon For mobile
Up arrow icon