Replace

Replace(string, string)

Replaces a cell’s value with a new string.

public int Replace(string placeHolder, string newValue)
Parameter Type Description
placeHolder String Cell placeholder
newValue String String value to replace

Examples

[C#]

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

[Visual Basic]

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

See Also


Replace(string, int)

Replaces a cell’s value with a new integer.

public int Replace(string placeHolder, int newValue)
Parameter Type Description
placeHolder String Cell placeholder
newValue Int32 Integer value to replace

Examples

[C#]

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

[Visual Basic]

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

See Also


Replace(string, double)

Replaces a cell’s value with a new double.

public int Replace(string placeHolder, double newValue)
Parameter Type Description
placeHolder String Cell placeholder
newValue Double Double 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() 
........
im NewValue As Double =  100.0
orkbook.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)
Parameter Type Description
placeHolder String Cell placeholder
newValues String[] String array to replace
isVertical Boolean True - 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() 
.............
im NewValues() As String =  New String() {"Tom", "Alice", "Jerry"}		
orkbook.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)
Parameter Type Description
placeHolder String Cell placeholder
newValues Int32[] Integer array to replace
isVertical Boolean True - 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() 
..........
im NewValues() As Integer =  New Integer() {1, 2, 3}
orkbook.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)
Parameter Type Description
placeHolder String Cell placeholder
newValues Double[] Double array to replace
isVertical Boolean True - 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)
Parameter Type Description
placeHolder String Cell placeholder
insertTable DataTable DataTable 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)
Parameter Type Description
boolValue Boolean The boolean value to be replaced.
newValue Object New 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)
Parameter Type Description
intValue Int32 The integer value to be replaced.
newValue Object New 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)
Parameter Type Description
placeHolder String Cell placeholder
newValue String String value to replace
options ReplaceOptions The replace options

See Also