0

hai

when converting a data from excel to mysql....how to preserve the new line character and the white space.?

any suggestions?

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by R0bb0b
0

hai

when converting a data from excel to mysql....how to preserve the new line character and the white space.?

any suggestions?

The newline characters are preserved when you copy and past it into notepad(in the form of boxes) but when you copy it back from notepad to excel the newline characters make the text go down to a whole new row. You may have to do this programmatically with the nl2br() function.

<?php
$file="test.xls";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
?>
<table cellpadding="0" cellspacing="0" border="1">
	<tr>
		<td>This is<br />multiline<br />text</td>
		<td>cell two</td>
		<td>This also<br />is multiline<br />text</td>
		<td>cell four</td>
	</tr>
	<tr>
		<td colspan="4" align="center"><b>cell one</b></td>
	</tr>
	<tr>
		<td>cell one</td>
		<td>cell two</td>
		<td>cell three</td>
		<td>cell four</td>
	</tr>
</table>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.