Excel replace function for numbers

What is the proper syntax for replacing numbers in Aspose excel? I tried this syntax but it doesn’t work.

xExcel.Replace(“0”, “-”)

We have a client that wants to replace zeros with hyphens in her spreadsheets.

I will add a new Replace method to serve your need. Then you can use the following code:

xExcel.Replace(0, “-”)

Thanks so much for your help Laurence. Could you let me know when the hotfix is ready?

thx,
David

Hi David,

You can get it in the next week.

Is the replace function for numbers ready yet?

Yes. You can use this function in v3.0.5 now. Please check http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Excel.Replace9.html.

@ydb1md,
Aspose.Excel is no more available now and is replaced with Aspose.Cells that supports all the latest features in different versions of MS Excel. You can replace the specific number within the entire workbook with a single command. Similarly, every single cell can be parsed in each worksheet and replaced with a specific value. Here are examples that can be used to perform this task.

Replace a specific number in the entire workbook

Workbook workbook = new Workbook("Book1.xlsx");
workbook.Replace(1, "One");
workbook.Replace(2, "Two");
workbook.Replace(3, "Three");

workbook.Save("BookOutput1.xlsx");

Replace a number parsing all cells in a worksheet

Workbook workbook = new Workbook("Book1.xlsx");

Cell cell = null;

do
{
    // Search the cell with value search within range
    cell = workbook.Worksheets[0].Cells.Find(3, cell);

    // If no such cell found, then break the loop
    if (cell == null)
        break;
    else
        cell.PutValue("Three");

} while (true);

// Save the workbook
workbook.Save("BookOutput2.xlsx");

You can follow the links below to get more information about replacing values in the worksheet.
Search and Replace Data in a Range
Find and Replace in Spreadsheet
Replace text in a workbook using Regular Expression

For trials purpose, download the latest version here:
Aspose.Cells for .NET (Latest Version)

Here is a ready to run solution which can be used to test the product features with minimal effort.