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

Free Support Forum - aspose.com

Text documents and cr\lf

I’m trying to load a plain text document that uses cr\lf characters to indicate line breaks. When loading into a Document object via the constructor these characters appear to be ignored. Is there a flag or an option to set that will tell Aspose to treat crlf as a hard return?

Example:
Line one[0x0a][0x0d]
Line two[0x0a][0x0d]
Line three

When this is loaded into a Document object all the lines run together:
Line oneLine twoLine three

Thanks.

@BlakeMChristensen,

Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. If you load the same document in MS Word, you will get the same output.

You can replace [0x0a][0x0d] characters with paragraph break using following code example. If you still face problem, please ZIP and attach your input TXT document here for testing. We will investigate the issue and provide you more information on this.

Document doc = new Document(MyDir + "in.txt");
doc.Range.Replace(@"[0x0a][0x0d]", ControlChar.ParagraphBreak, new FindReplaceOptions());
doc.Save(MyDir + "Out.docx");