How can i replace hyphen between words in aspose.cells.
Any example in .net?
Thanks for your query and we are sorry for a delayed response. You may please give a try to the following sample code and provide your feedback.
string TXBX_Find = "-";
string TXBX_Replace = "*";
Workbook workbook = new Workbook(path + "book1.xlsx");
FindOptions Opts = new FindOptions();
Opts.LookInType = LookInType.Values;
Opts.LookAtType = LookAtType.Contains;
string found = "";
Aspose.Cells.Cell cell = null;
foreach (Worksheet sheet in workbook.Worksheets)
{
do
{
cell = sheet.Cells.Find(TXBX_Find, cell, Opts);
if (cell != null)
{
string celltext = cell.Value.ToString();
celltext = celltext.Replace(TXBX_Find, TXBX_Replace);
cell.PutValue(celltext);
}
}
while (cell != null);
}
workbook.Save(path + "book2.xlsx");