Replace

Replace(string, string)

用新字符串替换单元格的值。

public int Replace(string placeHolder, string newValue)
范围类型描述
placeHolderString单元格占位符
newValueString要替换的字符串值

例子

[C#]

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

[Visual Basic]

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

也可以看看


Replace(string, int)

用新整数替换单元格的值。

public int Replace(string placeHolder, int newValue)
范围类型描述
placeHolderString单元格占位符
newValueInt32要替换的整数值

例子

[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)

也可以看看


Replace(string, double)

将单元格的值替换为新的双精度值。

public int Replace(string placeHolder, double newValue)
范围类型描述
placeHolderString单元格占位符
newValueDouble要替换的双倍值

例子


[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)

也可以看看


Replace(string, string[], bool)

将单元格的值替换为新的字符串数组。

public int Replace(string placeHolder, string[] newValues, bool isVertical)
范围类型描述
placeHolderString单元格占位符
newValuesString[]要替换的字符串数组
isVerticalBoolean真 - 垂直,假 - 水平

例子


[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)

也可以看看


Replace(string, int[], bool)

用整数数组替换单元格的值。

public int Replace(string placeHolder, int[] newValues, bool isVertical)
范围类型描述
placeHolderString单元格占位符
newValuesInt32[]要替换的整数数组
isVerticalBoolean真 - 垂直,假 - 水平

例子

[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)

也可以看看


Replace(string, double[], bool)

用双精度数组替换单元格的值。

public int Replace(string placeHolder, double[] newValues, bool isVertical)
范围类型描述
placeHolderString单元格占位符
newValuesDouble[]要替换的双数组
isVerticalBoolean真 - 垂直,假 - 水平

例子


[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)

也可以看看


Replace(string, DataTable)

将单元格的值替换为来自DataTable.

public int Replace(string placeHolder, DataTable insertTable)
范围类型描述
placeHolderString单元格占位符
insertTableDataTable要替换的数据表

例子

[C#]

Workbook workbook = new Workbook();
DataTable myDataTable = new DataTable("Customers");
// 将数据添加到 myDataTable
........
workbook.Replace("AnOldValue", myDataTable);

[Visual Basic]

Dim workbook As Workbook =  New Workbook() 
Dim myDataTable As DataTable =  New DataTable("Customers") 
'将数据添加到 myDataTable
............
workbook.Replace("AnOldValue", myDataTable)

也可以看看


Replace(bool, object)

用新数据替换单元格的值。

public int Replace(bool boolValue, object newValue)
范围类型描述
boolValueBoolean要替换的布尔值。
newValueObject新价值。可以是字符串、整数、双精度或日期时间值。

也可以看看


Replace(int, object)

用新数据替换单元格的值。

public int Replace(int intValue, object newValue)
范围类型描述
intValueInt32要替换的整数值。
newValueObject新价值。可以是字符串、整数、双精度或日期时间值。

也可以看看


Replace(string, string, ReplaceOptions)

用新字符串替换单元格的值。

public int Replace(string placeHolder, string newValue, ReplaceOptions options)
范围类型描述
placeHolderString单元格占位符
newValueString要替换的字符串值
optionsReplaceOptions替换选项

也可以看看