writing long text in excel workbook using interop throws error?

.net, c#, com-interop, excel, vb.net

Solution

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.

Problem

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.

Original source