layout | title |
---|---|
page |
Excel-DNA Reference: Data type marshaling |
The allowed function parameter and return types are:
Double
String
DateTime
-- returns a double to Excel (maybe string is better to return?)Double[]
-- if only one column is passed in, takes that column, else first row is takenDouble[,]
Object
Object[]
-- if only one column is passed in, takes that column, else first row is takenObject[,]
Boolean
(bool
) -- returns an Excelbool
(maybe string is better to return to Excel?)Int32
(int
)Int16
(short
)UInt16
(ushort
)Decimal
Int64
(long
)
incoming function parameters of type Object will only arrive as one of the following:
Double
String
Boolean
ExcelDna.Integration.ExcelError
ExcelDna.Integration.ExcelMissing
ExcelDna.Integration.ExcelEmpty
Object[,]
containing an array with a mixture of the above typesExcelReference
-- (Only ifAllowReference=true
inExcelArgumentAttribute
causingR
type instead ofP
)
function parameters of type Object[]
or Object[,]
will receive an array containing a mixture of the above types (excluding Object[,]
)
return values of type Object are allowed to be:
Double
String
DateTime
Boolean
Double[]
Double[,]
Object[]
Object[,]
ExcelDna.Integration.ExcelError
ExcelDna.Integration.ExcelMissing.Value
-- Converted by Excel to be 0.0ExcelDna.Integration.ExcelEmpty.Value
-- Converted by Excel to be 0.0ExcelDna.Integration.ExcelReference
Int32 (int)
Int16 (short)
UInt16 (ushort)
Decimal
Int64 (long)
Otherwise return #VALUE!
error
Return values of type object[]
and object[,]
are processed as arrays of the type object
, containing a mixture of the above, excluding the array types.
The following invalid return values, are returned to Excel as indicated
Object[0]
=>#VALUE
Object[0.0]
=>#VALUE
String.Empty
=>""
ExcelEmpty.Value
=>0
null
=>#NUM