问题 1:要导出到 Excel 的数据是在我的 vb.net 代码中使用二维数组对象准备的。当尝试将此数组对象分配给 ExcelRange.Value 或 .Value2 属性时,它可以正常工作,除非要导出的任何单元格值的文本长度超过 8203(它会抛出异常消息“HRESULT 异常:0x800A03EC”)
问题 2:而使用 excelrange.FormulaArray 属性时,会出现错误消息“无法设置 Range 类的 FormulaArray 属性”。但它在使用字符串数组的 vb6 中工作正常。是什么原因 ?下面是我使用 excelrange.FormulaArray 属性时的详细错误
System.Runtime.InteropServices.COMException was caught
ErrorCode=-2146827284
HelpLink="C:\Program Files (x86)\Microsoft Office\Office12\1033\XLMAIN11.CHM"
Message="Unable to set the FormulaArray property of the Range class"
Source="Microsoft Office Excel"
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Excel.Range.set_FormulaArray(Object )
at globalmodule.modglobconstant.ExportMsfgToExcel(AxMSFlexGrid& Msfg1, Boolean& flg, String FileName1)
InnerException:
任何其他导出到 excel/此问题解决方案的替代方法将不胜感激