How to take value from one column and add at the end of the other column's cells?

I am using MVC and using syncFusion XlsIO to edit excel sheets.  Let's day I have three columns and how to use the following logic to manipulate usedRange cells?

ID    Condition   Name        Output
1       Yes              Sarah        Sarah(1)
2        No               George    George
3        Yes               John(3)   John(3)

move the first column ID to the end of the column Name but if column Condition contains No, don't move first column ID or if it contains the ID already. 

Please help. 

Thanks





3 Replies

AV Abirami Varadharajan Syncfusion Team January 22, 2018 12:37 PM UTC

Hi Gereltuya, 
  
Thank you for updating us. 
  
We are preparing sample as per your requirement and we will update you shortly. 
  
Regards, 
Abirami. 



GT GTaing January 22, 2018 03:14 PM UTC

Thank you! I will be looking forward to it! 


AV Abirami Varadharajan Syncfusion Team January 22, 2018 03:51 PM UTC

Hi Gereltuya, 
 
Your requirement can be achieved by appending column ID with column Name. Please refer below code to  
 
for(int row = 1; row<= worksheet.Columns[1].Count; row++) 
                    { 
                         
                        if (worksheet[row, 2].Value == "yes" && !worksheet[row, 3].Value.EndsWith(")")) 
                            worksheet[row, 4].Value = worksheet[row, 3].Value + "(" + worksheet[row, 1].Value + ")"; 
                        else 
                            worksheet[row, 4].Value = worksheet[row, 3].Value; 
                    } 
 
We have prepared simple sample and the sample can be downloaded from the following link. 
 
 
Regards, 
Abirami. 


Loader.
Up arrow icon