Click or drag to resize

IWorkbook Replace Method (String, DataColumn, Boolean)

Replaces specified string by data column values.
Examples
The following code snippet illustrates how to replace the string value with data column:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by data column</para><para>string oldValue = "Find";</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("Dosage", typeof(int));</para><para>table.Rows.Add(1);</para><para>System.Data.DataColumn dataColumn = table.Columns[0];</para><para>workbook.Replace(oldValue, dataColumn, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
void Replace(
	string oldValue,
	DataColumn newValues,
	bool isFieldNamesShown
)

Parameters

oldValue
Type: System String
String value to replace.
newValues
Type: System.Data DataColumn
Data table with new data.
isFieldNamesShown
Type: System Boolean
Indicates whether field name must be shown.
See Also