Workbook.Replace

Replace(string, string)

Replaces a cell’s value with a new string.

public int Replace(string placeHolder, string newValue)
ParameterTypeDescription
placeHolderStringCell placeholder
newValueStringString value to replace

Examples

[C#]

Workbook workbook = new Workbook();
//......
workbook.Replace("AnOldValue", "NewValue");

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'........
workbook.Replace("AnOldValue", "NewValue")

See Also


Replace(string, int)

Replaces a cell’s value with a new integer.

public int Replace(string placeHolder, int newValue)
ParameterTypeDescription
placeHolderStringCell placeholder
newValueInt32Integer value to replace

Examples

[C#]

Workbook workbook = new Workbook();
//......
int newValue = 100;
workbook.Replace("AnOldValue", newValue);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'.........
Dim NewValue As Integer =  100 
workbook.Replace("AnOldValue", NewValue)

See Also


Replace(string, double)

Replaces a cell’s value with a new double.

public int Replace(string placeHolder, double newValue)
ParameterTypeDescription
placeHolderStringCell placeholder
newValueDoubleDouble value to replace

Examples


[C#]

Workbook workbook = new Workbook();
//......
double newValue = 100.0;
workbook.Replace("AnOldValue", newValue);


[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'.........
Dim NewValue As Double =  100.0
workbook.Replace("AnOldValue", NewValue)

See Also


Replace(string, string[], bool)

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

public int Replace(string placeHolder, string[] newValues, bool isVertical)
ParameterTypeDescription
placeHolderStringCell placeholder
newValuesString[]String array to replace
isVerticalBooleanTrue - Vertical, False - Horizontal

Examples


[C#]

Workbook workbook = new Workbook();
//......
string[] newValues = new string[]{"Tom", "Alice", "Jerry"};
workbook.Replace("AnOldValue", newValues, true);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'.............
Dim NewValues() As String =  New String() {"Tom", "Alice", "Jerry"}		
workbook.Replace("AnOldValue", NewValues, True)

See Also


Replace(string, int[], bool)

Replaces cells’ values with an integer array.

public int Replace(string placeHolder, int[] newValues, bool isVertical)
ParameterTypeDescription
placeHolderStringCell placeholder
newValuesInt32[]Integer array to replace
isVerticalBooleanTrue - Vertical, False - Horizontal

Examples

[C#]

Workbook workbook = new Workbook();
//......
int[] newValues = new int[]{1, 2, 3};
workbook.Replace("AnOldValue", newValues, true);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'...........
Dim NewValues() As Integer =  New Integer() {1, 2, 3}
workbook.Replace("AnOldValue", NewValues, True)

See Also


Replace(string, double[], bool)

Replaces cells’ values with a double array.

public int Replace(string placeHolder, double[] newValues, bool isVertical)
ParameterTypeDescription
placeHolderStringCell placeholder
newValuesDouble[]Double array to replace
isVerticalBooleanTrue - Vertical, False - Horizontal

Examples


[C#]

Workbook workbook = new Workbook();
//......
double[] newValues = new double[]{1.23, 2.56, 3.14159};
workbook.Replace("AnOldValue", newValues, true);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
'...........
Dim NewValues() As Double =  New Double() {1.23, 2.56, 3.14159}
workbook.Replace("AnOldValue", NewValues, True)

See Also


Replace(string, DataTable)

Replaces cells’ values with data from a DataTable.

public int Replace(string placeHolder, DataTable insertTable)
ParameterTypeDescription
placeHolderStringCell placeholder
insertTableDataTableDataTable to replace

Examples

[C#]

Workbook workbook = new Workbook();
DataTable myDataTable = new DataTable("Customers");
// Adds data to myDataTable
//........
workbook.Replace("AnOldValue", myDataTable);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
Dim myDataTable As DataTable =  New DataTable("Customers") 
' Adds data to myDataTable
'.............
workbook.Replace("AnOldValue", myDataTable)

See Also


Replace(bool, object)

Replaces cells’ values with new data.

public int Replace(bool boolValue, object newValue)
ParameterTypeDescription
boolValueBooleanThe boolean value to be replaced.
newValueObjectNew value. Can be string, integer, double or DateTime value.

See Also


Replace(int, object)

Replaces cells’ values with new data.

public int Replace(int intValue, object newValue)
ParameterTypeDescription
intValueInt32The integer value to be replaced.
newValueObjectNew value. Can be string, integer, double or DateTime value.

See Also


Replace(string, string, ReplaceOptions)

Replaces a cell’s value with a new string.

public int Replace(string placeHolder, string newValue, ReplaceOptions options)
ParameterTypeDescription
placeHolderStringCell placeholder
newValueStringString value to replace
optionsReplaceOptionsThe replace options

See Also