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;
}
Sorry, I need to apply a correction to the above. What is actually happening is the document has a greyscale image in the header that simulates a watermark since the image is actually lower down the page. The image appeasr to be resized after the document has come through the find and replace routine. All else above is correct.
Thanks
Hi
Thanks for your request. Could you please attach your documents(document before processing and document after processing) here? I will investigate this problem and provide you more information.
Best regards.
Thanks for additional information. I tried open/save your document and get some difference. Do you mean these differences? (See the attached image). I will investigate this and provide you more information.
Hi,
I’ve got pictures of my before and after and they are similar. I can’t seem to be able to upload more than one file per a posting though so will upload just the after???
Thanks
John
Hi,
Thank you for additional information. I created an issue #4083 in our defects database and we will investigate whether and when it can be fixed. Please expect a reply before the next hotfix (within 2-3 weeks).
Best regards.
Hi John,
If you are still interested, we are working now on the fix for this.
In the current version of Aspose.Words we do not have any visual difference in the resulting document. It looks exactly the same as the original. If you go into the Picture Properties / Size dialog box, then yes, you can see some difference in the original image size and scale numbers. These numbers are different because this is a metafile without header and Aspose.Words and MS Word scan the metafile to calculate its size slightly differently. But as I said there is no visual difference in the output.
Do you actually have the visual difference or you insist you must have the same values in the Picture Properties dialog box?
If you have the visual difference, then please try using the latest version of Aspose.Words - there is no visual difference now.
If you insist the values in the dialog box must be the same - even if we “fix” the issue, we might not be able to end up with exactly the same values as MS Word shows just because this is technically very “low-level” issue regarding non-placeable metafiles.