I have a excel template, where we have different predefined fields like CustomerName, CompanyName, Address etc. All this things are in single cell and this cell is named as "Customer" and similarly we have another cell called "Sender" having fields related to sender details. My job is to find Customer and Sender cells and replace the values that they contain with the actual values, For example i need to find "Customer" Cell and will replace CustomerName with actual name "John", ComanyName with "XYZ" and so on for other fields, same task is for Sender Cell.
I am using Microsoft.Office.Interop.Excel to implement this task as follows.
xlWorkSheet.Cells.Replace("CustomerName", "John", Excel.XlLookAt.xlPart, missingValue, missingValue, missingValue, missingValue, missingValue);
xlWorkSheet.Cells.Replace("CompanyName", "XYZ", Excel.XlLookAt.xlPart, missingValue, missingValue, missingValue, missingValue, missingValue);
The problem is all this fields in a single cell, and i need to find different fields and replace their values, if a fields values is not then shifting the remaining fields up to fill the empty space.
Please provide solution.