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

Free Support Forum - aspose.com

Carriage Return disappearing from the word doc


I have the following 3 RTF fragments I insert using "wordDocument.AppendRtf" method

--Fragment 1--

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Tahoma;}}
\viewkind4\uc1\pard\lang2057\f0\fs19 TestTest \lang1033\f1\fs20
\par }

--Fragment 2--

{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
\par }

--Fragment 3--

{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\fprq2\fcharset0 Univers;}}
\viewkind4\uc1\pard\ltrpar\b\f0\fs20 Emittentin\b0 Company Name, \lang2057\b
\par }


I expect to see

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


Emittentin Company Name


but the (CarriageReturn)--(actual newline and not the text) is missing from the word output.

Any help appreciated

Hi Manoj,

for your inquiry. Please use the following code snippet to achieve your
requirements. Please check the detail of InsertDocument from here:

var appendObject1 = RtfStringToDocument(File.ReadAllText(MyDir + "in.rtf"));

var appendObject2 = RtfStringToDocument(File.ReadAllText(MyDir + "in2.rtf"));

var appendObject3 = RtfStringToDocument(File.ReadAllText(MyDir + "in3.rtf"));

var documentObject = new Document();

InsertDocument(documentObject.LastSection.Body.LastParagraph, appendObject1);

InsertDocument(documentObject.LastSection.Body.LastParagraph, appendObject2);

InsertDocument(documentObject.LastSection.Body.LastParagraph, appendObject3);

var options = new RtfSaveOptions { SaveFormat = SaveFormat.Rtf };

documentObject.Save(MyDir + "Out.rtf", options);

private static Document RtfStringToDocument(string rtf)


Document doc = null;

// Convert RTF string to byte array.

byte[] rtfBytes = Encoding.UTF8.GetBytes(rtf);

// Create stream.

using (MemoryStream rtfStream = new MemoryStream(rtfBytes))


// Open document from stream.

doc = new Document(rtfStream);


return doc;


If the problem still remains, Please manually create your expected output document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.