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

Free Support Forum - aspose.com

Bookmark.Text Changes \n to \r that Causes Additional Line Break using .NET

When I pass “harshit\n\ragrawal” in bookmark.Text, it becomes “harshit\r\ragrawal”.
Aspose is changing \n to \r eventually leading to a paragraph break instead of line break. Is there any specific reason for this and option to resolve this issue?

Thanks,
Harshit Agrawal

@harshit

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

Thanks for the quick Response. SampleCodeForAsposeIssue.zip (8.7 MB)

I have created a standalone console application and attached it here. It also contains the Input, Expected output, and actual output in the comments.

Please let me know your comments.

Thanks and Regards,
Harshit Agrawal

@harshit

We have tested the scenario and managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-22236. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@harshit

In Windows, a standard line ending is “\r\n”. You are using “\n\r” in your code. We suggest you please use following code snippet to get the desired output.

String text = "Harshit\r\nagrawal";
bookmark.Text = text;

If you still want to use “\n\r”, please share what is the source of the strings that use “\n\r” as line ending instead of “\r\n”?