简体   繁体   中英

Apply line breaks when export to Excel using SQL query

I have the below select query. I have used this data to export to Excel using C# code. The export is working and I applied CHAR(13) for line breaks. But after the export, the data is showing up without line breaks. But when I click the cell it is applying the line break. How do apply line breaks in export?

My query:

REPLACE(somestring, '<br/>', CHAR(13))

Try using Char(10)

REPLACE(somestring,'<br/>', CHAR(10))

Carriage return (Char(13)) might not show up how you expect in the editor you're using.

If that doesn't work try

REPLACE(somestring,'<br/>', char(13)||char(10))

New lines can be annoying.

Also make sure you have wrap text selected in Excel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM