replace method

replace

Replaces a cell’s value with a new string.

def replace(self, place_holder, new_value):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valuestrString value to replace

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
workbook.replace("AnOldValue", "NewValue")

replace

Replaces a cell’s value with a new integer.

def replace(self, place_holder, new_value):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valueintInteger value to replace

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
newValue = 100
workbook.replace("AnOldValue", newValue)

replace

Replaces a cell’s value with a new double.

def replace(self, place_holder, new_value):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valuefloatDouble value to replace

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
newValue = 100.0
workbook.replace("AnOldValue", newValue)

replace

Replaces cells’ values with new data.

def replace(self, bool_value, new_value):
    ...
ParameterTypeDescription
bool_valueboolThe boolean value to be replaced.
new_valueanyNew value. Can be string, integer, double or DateTime value.

replace

Replaces cells’ values with new data.

def replace(self, int_value, new_value):
    ...
ParameterTypeDescription
int_valueintThe integer value to be replaced.
new_valueanyNew value. Can be string, integer, double or DateTime value.

replace

Replaces a cell’s value with a new string array.

def replace(self, place_holder, new_values, is_vertical):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valueslistString array to replace
is_verticalboolTrue - Vertical, False - Horizontal

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
newValues = ["Tom", "Alice", "Jerry"]
workbook.replace("AnOldValue", newValues, True)

replace

Replaces cells’ values with an integer array.

def replace(self, place_holder, new_values, is_vertical):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valueslistInteger array to replace
is_verticalboolTrue - Vertical, False - Horizontal

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
newValues = [1, 2, 3]
workbook.replace("AnOldValue", newValues, True)

replace

Replaces cells’ values with a double array.

def replace(self, place_holder, new_values, is_vertical):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valueslistDouble array to replace
is_verticalboolTrue - Vertical, False - Horizontal

Example

from aspose.cells import Workbook

workbook = Workbook()
# ......
newValues = [1.23, 2.56, 3.14159]
workbook.replace("AnOldValue", newValues, True)

replace

Replaces a cell’s value with a new string.

def replace(self, place_holder, new_value, options):
    ...
ParameterTypeDescription
place_holderstrCell placeholder
new_valuestrString value to replace
optionsReplaceOptionsThe replace options

See Also