Hi,
I have a find and replace routine which works fine. Unfortunately in the output a watermark is being reduced in size from how it is on the input. I can’t see any indication why however as a legal document it is not allowed to be.
Please find below the code for the Replace Routine. I’ve also attached it in a text file to preserve formatting.
I need to find a solution to this urgently as the work is in response to a change in legislation.
Thanks
John
private ReplaceAction ReplaceBookmark(object sender, ReplaceEvaluatorArgs e)
{
Run run = (Run)e.MatchNode;
string key = string.Empty;
string val = string.Empty;
key = e.Match.Value;
if (run.Text.Substring(0, 1).ToLower() == "v" && run.Font.Color == Color.FromArgb(0, 0, 255))
{
// if the text has an under score, it need s trating seperatly due to tfe formatting
if (e.Match.Value.IndexOf("_") > 0)
{
key = key.Substring(0, e.Match.Value.IndexOf("_")).ToLower();
if (currentlyOpenCase.Contains(key))
{
// watch out in case the final output requires applying the vCaseName
val = currentlyOpenCase.getValue(key).ToString().Trim();
if (val.IndexOf("vcasename") < 1)
{
val = Utilities.FormatBookmark(key, val.Replace("vcasename", currentlyOpenCase.getValue("vcasename").ToString()));
}
else
{
if (val.Length > 0)
{
val = Utilities.FormatBookmark(key, val);
}
else
{
val = key;
}
}
}
else
{
val = key;
}
}
else
{
if (currentlyOpenCase.Contains(key))
{
val = currentlyOpenCase.getValue(key).ToString().Trim();
if (val.Length > 0)
{
val = Utilities.FormatBookmark(key, val);
}
else
{
val = key;
}
}
}
}
// if no value is applied just apply the key
if (val.Length < 1)
val = e.Match.Value;
e.Replacement = val;
return ReplaceAction.Replace;
}