xlswrite question on long strings (0x800A03EC)
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Fangjun Jiang
2011-6-17
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!