excel - Sanitizing data in PHP for excell xml -


i using "excel xml" php library (marin crnković, version 0.9) write data database .xls file. problem database contains data not legal, , causes microsoft excel give me errors when opening file. (the document cannot opened because there problems contents)

samples of bad data causing excel display errors instead of opening file:

!(()&&!|||

'"()&%1prompt(918861)

'&cat /etc/passwd&'

'&dir&'

"&cat /etc/passwd&"

email&n921923=v950402

is there recommended function sanitize data before inserting data excel file?

it might need escape/encode ampersands before using them excel spreadsheets (as new formats xml-based). php, perhaps try like:

$value = str_replace('&', '&', $value); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -