Jump to content

Excel and a cell with a line feed. How to remove it?


mabog

Recommended Posts

Hello.

Trying to get rid a line feed which is coming from a excel cell which has Text and a line feed after that word.

After the excel file has been saved-as tab-delimited, that text transforms to this: "Text"

That line feed is between t and the last double-quote. Hex viewer shows: 22 54 65 78 74 0A 22 so it must be that 0A.

 

I have tried with trim() and with str_replace("\x0A","",$data) but nothing (like \r or \n) works.

 

How do I get rid of that hidden character? Is that \x0A correct?

 

 

Found the problem.

 

Data (where those 0As are) is a tab-delimited text file created by excel.

That line feed is confusing file handling when trying to get data one row at a time with fgets(). It acts like 0A is a new row..

Tried to add ini_set('auto_detect_line_endings', true); before fopen(), but no change.

 

So those characters would be needed to remove BEFORE the file is opened.

And that, I think, is impossible since files might be quite big.. Going through the file one character at a time for 0A's, is slow...

So it's easier to ask users to remove word warp (that, i belive, is creating 0As) from the excel file before uploading it to my page.

 

No can do.

:shrug:

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.