how to put line break in excel sheet cell [closed]
Want to improv开发者_StackOverflow中文版e this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionI've so many rows in database table and i want it to be exported in excel sheet. My each row represent an individual sale, this sale may contain one or more product and if there is more than one product i'm showing it like this
above image represent my single row that contain more than one product for a sale.
when i convert the whole recode into excel both product code no are shown as a joined string, But i want to put the line break in excel sheet cell. how can i put the line break in excel sheet programmaticaly.
You can put line break using \n in excel sheet. if you want to switch to another cell in same row then you can achieve it by ','...
something like this
$data = $row['fname']." ".$row['lname'].",";
$data .= $row['programEnrollments'][0]['startSessionName'].",\n";
If you're exporting XML code to generate your Excel file, you would need to use PageBreaks
Vikas,
Am I right, that you want to know how to use the replace function with Chr(10)?
Something like:
Application.Calculation = xlCalculationManual
Dim SpecialChar
SpecialChar = Chr(10)
Cells.Replace What:=SpecialChar, Replacement:=" ", SearchOrder:=xlByColumns, MatchCase:=True
Application.Calculation = xlCalculationAutomatic
Regards,
Robert Ilbrink
精彩评论