Hello there,
I am appending some text(from a source template) containing ‘\r\n’ into output document at run-time.
But when I see the word document, they are replaced with small square boxes :-(Please see attached document for reference.
I tried replacing them with System.Environment.NewLine but still I see these small boxes.
Any idea?
Code snippet:
imageText = GetImageText(ref builder);
builder.InsertNode(new Run(builder.Document.Document, imageText));
private string GetImageText(ref DocumentBuilder builder)
{
string imageText = "";
Paragraph objCurrentParagraph = builder.CurrentParagraph;
imageText = GetImageText(objCurrentParagraph);
return imageText.Replace("WAITPHOTO", "");
}
private string GetImageText(Paragraph objCurrentParagraph)
{
string paragraphText = "";
while (objCurrentParagraph != null)
{
paragraphText += objCurrentParagraph.ToTxt();
foreach(Run objRun in objCurrentParagraph.Runs)
{
objRun.Text = "";
}
if (paragraphText.Contains("WAITPHOTO"))
{
break;
}
else if (paragraphText.Contains("Image"))
{
paragraphText = "";
break;
}
else
{
objCurrentParagraph = objCurrentParagraph.NextSibling as Paragraph;
}
}
return paragraphText;
}