Hi
I have made a Methode "ReplaceFormelFelder" (below) which can search and replace a string in the FormulaFields. Now I would do the same for the condition formulas. How can I do that?
There is a picture from a condition formula (supress formula):
public static int ReplaceFormelFelder(ReportDocument rpt, string oldValue, string newValue)
{
int iCounter = 0, index = 0;
bool replace = false;
string text = string.Empty;
foreach (FormulaFieldDefinition item in rpt.DataDefinition.FormulaFields)
{
text = item.Text;
if (text != null)
{
index = text.IndexOf(oldValue);
while (index != -1)
{
iCounter++;
replace = true;
if (text.Length > index + 1)
index = text.IndexOf(oldValue,index + 1);
else
index = -1;
}
if (replace)
{
item.Text = text.Replace(oldValue,newValue);
replace = false;
}
}
}
return iCounter;
}
Edited by Silvan - 09 Jul 2012 at 11:58pm