tags:

views:

505

answers:

3

I am writing long text (1K to 2K characters long, plain xml data) into a cell in excel workbook. The below statement throws COM error Exception from HRESULT: 0x800A03EC

range.set_Value(Type.Missing, data);

If I copy paste the same xml manually into excel it just works fine ,but the same does not work progamatically. If I strip the text to something like 100/300 chars it works fine.

+2  A: 

There is a limit (somehwere between 800 and 900 chars if i remember correctly) that is nearly impossible to get around like this.

Try using an ole connection and inserting the data with an SQL command. That might work better for you. you can then use interop to do any formatting if necessary.

ck
yep, The limit is 911 characters. Not sure whats the solution to this.
dotnetcoder
+1  A: 
StuperUser
+1  A: 

the following KB article explains that the max limit is 911 characters. I checked the same on my code it does work for string upto 911 chars.

http://support.microsoft.com/kb/818808

The work around mentioned in this article recommends to make sure no cell holds more than 911 characters. thats lame!

dotnetcoder