We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

\r\n appears as small square boxes in Document

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;
}


        </div>

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks fo royu rinquiry. Please try replacing it with \v (Aspose.Words.ControlChar.LineBreak).

Hope this helps.

Best regards.

Thank you :slight_smile:

It works!