Click or drag to resize

Workbook Replace Method (String, DataTable, Boolean)

Replaces cell's value from data table values.
Examples
The following code snippet illustrates how to replace the string value with data table:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by data table</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>workbook.Replace(oldValue, table, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>

Namespace: Spire.Xls
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public void Replace(
	string oldValue,
	DataTable newValues,
	bool includeColumnName
)

Parameters

oldValue
Type: System String
Value to replace.
newValues
Type: System.Data DataTable
New data.
includeColumnName
Type: System Boolean
Indicates whether includes column name.
See Also