xlswrite question on long strings (0x800A03EC)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am having trouble with xlswrite using long strings. Here is the problem:
1>> smallstring='qwerty';
2>> bigstring=strcat(repmat('qwerty',1,200));
3>> length(bigstring) ans = 1200
4>> xlswrite('test.xls',{smallstring},'Sheet1','A1');
5>> xlswrite('test.xls',{bigstring},'Sheet1','A1'); % this is ok!
6>> xlswrite('test.xls',{smallstring,smallstring},'Sheet1','A1');
7>> xlswrite('test.xls',{smallstring,bigstring},'Sheet1','A1');
??? Error using ==> xlswrite at 211 Error: Object returned error code: 0x800A03EC
This is where I get stumped. I read in this : http://www.mathworks.com/support/solutions/en/data/1-3QJ5I3/index.html?solution=1-3QJ5I3
that xlswrite cannot write to excel strings longer than 1024 characters due to an excel (2003) limitation. This explains line 7, but line 5 works...why? Thanks
Philippe
0 Kommentare
Akzeptierte Antwort
Fangjun Jiang
am 17 Jun. 2011
I had the same problem with MS office 2003. I even submitted a bug report to Microsoft but didn't really get response. I think the actual threshold is 911 or 912 characters. Do a search you'll find plenty of similar complaints. What I found out was that this limitation did not apply when writing to the Excel file one cell at a time. So what I did was first try to write the data to the whole sheet, if error happens, then write the data one cell at a time. It's really a pain at the butt if you have a big sheet of data but only a few of them exceed the character limit. Microsoft really should fix the problem.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!