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

Free Support Forum - aspose.com

Asp.net Multiline text text export to word keeping with same format

Hi Guys,

I am having multiline textboxes in asp.net.
I want export text which entered in that text box in word wiht keeping same format as user entered in textbox.

Currently i am able to export to word successfully but without same format.

Can you please guide me how to keep same format as it is entered in multiline textbox?


Thanks for your interest in Aspose.Words. Does your text box control return user entered data in HTML format? If yes, please share sample HTML/RTF text string here for testing. Please also attach your output Word documents which show correct and incorrect behaviors. We will investigate the issue on our end and provide you more information.

Best regards,

Hi Awais,

Thanks for your reply.
Text box will not store any html tags.
It is simple asp.net multiline textbox control(not FCK editor).

Here is below code which i use for making new line and space before generating the word doc.

public static string ReplaceSpaceAndNewLine(string strText)
if (!string.IsNullOrEmpty(strText))
return strText.Replace(" ", " ").Replace(Environment.NewLine, “
return string.Empty;

Even if above code is used problem is still there you can see attached the image.
Also there is a text file which shows how i am using aspose method to generate the document.


Thanks for the additional information. First off, please upgrade to the latest version of Aspose.Words for .NET i.e. 14.4.0 from the following link:

Secondly, please use DocumentBuilder.Write method instead of DocumentBuilder.InsertHtml method. I hope, this helps.

Best regards,