[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Excel Automation - Range.set_Value fails with "Exception from HRESULT: 0x800A03EC."

vvenkie

2/27/2007 4:19:00 AM

Hi,

I am trying to save data from a dataview to an excel spreadsheet.
The data volume is quite huge. As per the recommendation from MS
article, I dump all the data from the Data View to a 2D array and then
use Excel.Range to pump all the data to the spreadsheet. It used to
work quite well.

Now, I have a large comment field (Free Text) which needs to be
populated on the spreadsheet. When the set_Value function is called
with the array containing this comment field, the set_value fails with
the error "Exception from HRESULT: 0x800A03EC.". I initially thought
that the text contains some character which cant be written into
Excel. But when I did a quick watch and manually copied the value of
the comment to an excel sheet, it works fine. Only automation doesn't
seem to work.

Is there any limitation on the number of characters that could be
saved using a excel range? Do I need to set any property to get around
this or Is there any alternative available? Can someone please provide
some pointers for resolving the issue.

FYI. I use the following lines of code to populate the sheet.

//rowCount contains the number of rows to be saved to Excel
Excel.Range dataRange=null;
dataRange=excelWS.get_Range(excelWS.Cells[2,1],excelWS.Cells[rowCount,arResults.GetLength(1)]);
dataRange.get_Resize(rowCount,arResults.GetLength(1));
dataRange.set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault,arResults);

Thanks!
Venkatesh V.

1 Answer

nicholas.janssens

2/27/2007 2:22:00 PM

0

I had a simular problem but don't know if it was the exact same
message. From what i can remember, the solution was installing SP2 for
office 2003. I didnt have my problem on all machines (Office 2003,
20003+SP1) but all stable computers were using SP2 for office 2003

You might want to give it a try...


On 27 feb, 05:18, vven...@gmail.com wrote:
> Hi,
>
> I am trying to save data from a dataview to an excel spreadsheet.
> The data volume is quite huge. As per the recommendation from MS
> article, I dump all the data from the Data View to a 2D array and then
> use Excel.Range to pump all the data to the spreadsheet. It used to
> work quite well.
>
> Now, I have a large comment field (Free Text) which needs to be
> populated on the spreadsheet. When the set_Value function is called
> with the array containing this comment field, the set_value fails with
> the error "Exception from HRESULT: 0x800A03EC.". I initially thought
> that the text contains some character which cant be written into
> Excel. But when I did a quick watch and manually copied the value of
> the comment to an excel sheet, it works fine. Only automation doesn't
> seem to work.
>
> Is there any limitation on the number of characters that could be
> saved using a excel range? Do I need to set any property to get around
> this or Is there any alternative available? Can someone please provide
> some pointers for resolving the issue.
>
> FYI. I use the following lines of code to populate the sheet.
>
> //rowCount contains the number of rows to be saved to Excel
> Excel.Range dataRange=null;
> dataRange=excelWS.get_Range(excelWS.Cells[2,1],excelWS.Cells[rowCount,arRes­ults.GetLength(1)]);
> dataRange.get_Resize(rowCount,arResults.GetLength(1));
> dataRange.set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault,arResult­s);
>
> Thanks!
> Venkatesh V.