Free Support Forum - aspose.com

How can I insert line breaks?

I'm needing to insert several rows from a database table. All of the rows need to be in the same Excel cell and I would like to insert line breaks to separate the data.

I am currently using vbLf to move to the next line. This kind of works as it displays correctly in the cell preview when you click on the cell. However if you are just looking at the cell it shows the little box symbol for the line feed.

I'm sure there is a more correct way to insert a line break (line feed) into an Excel cell. Can you help me out?

Thanks!

Dan

Please try:

cell.PutValue("hello"&vbLf&"world")

cell.Style.IsTextWrapped = True

It's always that one missing line of code that does it. Wink [;)]

I'm glad it was an easy fix! Thanks for your help.

Dan