Welcome Guest, Not a member yet? Register   Sign In
How to give break in a column of excelsheet
#1

[eluser]Sawariya[/eluser]
i am exporting data from database to excelsheet..
but i am facing one problem... from textarea field its displaying as a line ..

01BW004910 01Assistant Engineer(Civil) 8 RAMYA R RAMYA R #26/1,1ST FLOOR\n9TH CROSS, RAJMAHAL VILAS EXTENSION,

insted of this i want to display this like
Postal Address Application Id Pst Code Reg No


#33/341, 01BW004910 01Assistant Engineer(Civil) 8
1ST FLOOR
9TH CROSS,
RAJMAHAL VILAS EXTENSION,
how to give break like this ..

Thanks in advance
#2

[eluser]gRoberts[/eluser]
I've just tried adding line breaks in excel and it doesn't like it.

So I doubt you will be able to using CSV.
#3

[eluser]smalljohnson[/eluser]
I am having the same issue.

In Excel, you can add a break/newline by pressing ALT - ENTER in the Excel cell.

I have not been able to figure out how to do it via php.

I have tried using "\n", "\r", "\r\n", chr(10), and chr(13) but none have worked. They all will add a new row and start at column 0. I want it to just begin a new line in the existing cell.
Code:
"\n"
"\r"
"\r\n"
chr(10)
chr(13)

Sawariya, have you been able to figure it out?

Has anyone else been able to do this?
#4

[eluser]Seppo[/eluser]
You have to quote the value.

Code:
hello, world, "foo
bar"
#5

[eluser]EugeneS[/eluser]
by the way ... excel perfectly understand html tables and html syntax ...
you can create a particular html document but give him extension .xls
#6

[eluser]gRoberts[/eluser]
It seems that Excel only puts a single \n (char 10) within quotations. I put in Excel

Code:
CodeIgniter
Is
Cool

and then saved it as an CSV file. Within a editplus, it shows

Code:
"CodeIgniter
Is
Cool"

It also shows a square because i set editplus to use *nix line breaks not windows CRLF.

Here is what C# thinks the file consists of:

Code:
-    data    {Length=23}    byte[]
    [0]    34    byte
    [1]    67    byte
    [2]    111    byte
    [3]    100    byte
    [4]    101    byte
    [5]    73    byte
    [6]    103    byte
    [7]    110    byte
    [8]    105    byte
    [9]    116    byte
    [10]    101    byte
    [11]    114    byte
    [12]    10    byte
    [13]    73    byte
    [14]    115    byte
    [15]    10    byte
    [16]    67    byte
    [17]    111    byte
    [18]    111    byte
    [19]    108    byte
    [20]    34    byte
    [21]    13    byte
    [22]    10    byte

hth
#7

[eluser]Sawariya[/eluser]
sorry smalljohnson
i couldn't rectify this error..i have done it in html only .. now i am not using excel
anyway thanks for your reply




Theme © iAndrew 2016 - Forum software by © MyBB