string array cell size limit?

B

Bren

I'm using Excel automation in a VB.NET 2.0 WinForm application to
export an Xceed grid to an Excel document.

I've encounter an error when a grid column containing a Notes field
from the database has a string whose length exceeds 912 characters.

I'm putting the exported data into arrays and then assigning the
arrays to an Excel Range.

StringArray(iRow, 0) = gridCell.Value ' this puts a grid cell into an
element of a string array

range.Value = StringArray ' this assigns the string array to the
Excel Range

If the StringArray has an element with more that 912 characters in
length I get this error.


System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146827284
Message="Exception from HRESULT: 0x800A03EC"
Source=""
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at Microsoft.Office.Interop.Excel.Range.set_Value(Object
RangeValueDataType, Object )

What is causing the error?

I appreciate your help, and I'm thanking you in advance.

Bren
 
J

jennmeedo

I'm using Excel automation in a VB.NET 2.0 WinForm application to
export an Xceed grid to an Excel document.

I've encounter an error when a grid column containing a Notes field
from the database has astringwhose length exceeds 912 characters.

I'm putting the exported data into arrays and then assigning the
arrays to an Excel Range.

StringArray(iRow, 0) = gridCell.Value ' this puts a grid cell into an
element of astringarray

range.Value = StringArray ' this assigns thestringarray to the
Excel Range

If the StringArray has an element with more that 912 characters in
length I get this error.

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146827284
Message="Exception from HRESULT: 0x800A03EC"
Source=""
StackTrace:
atSystem.RuntimeType.ForwardCallToInvokeMember(StringmemberName,BindingFlagsflags,Objecttarget,Int32[]aWrapperTypes,MessageData&msgData)
at Microsoft.Office.Interop.Excel.Range.set_Value(Object
RangeValueDataType,Object)

What is causing the error?

I appreciate your help, and I'm thanking you in advance.

Bren


Check to see if any of your cells start with a character that intiates
a macro. I had that problem and found a cell starting with a hyphen
that caused this error.

-Mohamed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top