@Palak - Question Initiator is never coming back (Observed from the previous posts ;)
You shoud interact with the people here to get better answers to your question.. Or if you have solved the problem then post the answer so that it would help other users to refer your post..
The problem you are facing seems like you are using javasript default sort method in a wrong way..
sort method is called with reference to the array..
syntax of sort method is
Here sortfunction is optional. It can be a function that defines the sort order.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com