xlswrite question on long strings (0x800A03EC)

1 回表示 (過去 30 日間)
Philippe
Philippe 2011 年 6 月 17 日
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
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

採用された回答

Fangjun Jiang
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 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by