我已经构建了一个非游戏Unity应用程序,它使用NPOI从XLSX Excel文件导入和填充SQLite数据库。这很好用。现在我需要做的是输出一个Excel文件,但是当我尝试创建它时,我在下面的代码行中得到以下异常:
IWorkbook workbook = new XSSFWorkbook();
这是一个例外:
InvalidOperationException:类型NPOI.OpenXmlFormats.ItemChoiceType缺少枚举值' vstream' for element' vstream from 命名空间 ' http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes&#39 ;. System.Xml.Serialization.XmlReflectionImporter.ImportElementInfo (System.Type cls,System.String defaultName,System.String defaultNamespace,System.Type defaultType, System.Xml.Serialization.XmlTypeMapMemberElement成员, System.Xml.Serialization.XmlAttributes atts) System.Xml.Serialization.XmlReflectionImporter.CreateMapMember (System.Type declaringType, System.Xml.Serialization.XmlReflectionMember rmember,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String defaultNamespace)Rethrow as InvalidOperationException:有一个 错误反映字段'项目'。 System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String defaultNamespace)Rethrow as InvalidOperationException:有一个 错误反映类型' NPOI.OpenXmlFormats.CT_Property'。 System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type类型,System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) System.Xml.Serialization.XmlReflectionImporter.ImportElementInfo (System.Type cls,System.String defaultName,System.String defaultNamespace,System.Type defaultType, System.Xml.Serialization.XmlTypeMapMemberElement成员, System.Xml.Serialization.XmlAttributes atts) System.Xml.Serialization.XmlReflectionImporter.CreateMapMember (System.Type declaringType, System.Xml.Serialization.XmlReflectionMember rmember,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String defaultNamespace)Rethrow as InvalidOperationException:有一个 错误反映了字段'属性'。 System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String defaultNamespace)Rethrow as InvalidOperationException:有一个 错误反映类型' NPOI.OpenXmlFormats.CT_CustomProperties'。 System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root,System.String DefaultNamespace的) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type类型,System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) System.Xml.Serialization.XmlSerializer..ctor(System.Type类型, System.Xml.Serialization.XmlAttributeOverrides覆盖, System.Type [] extraTypes,System.Xml.Serialization.XmlRootAttribute root,System.String defaultNamespace) System.Xml.Serialization.XmlSerializer..ctor(System.Type类型) NPOI.OpenXmlFormats.CustomPropertiesDocument..cctor()(at C:/Users/seadn/Desktop/npoi/npoi-master/ooxml/OpenXmlFormats/CustomPropertiesDocument.cs:9) Rethrow as TypeInitializationException:抛出异常 NPOI.OpenXmlFormats.CustomPropertiesDocument的类型初始值设定项 NPOI.POIXMLProperties..cctor()Rethrow as TypeInitializationException:类型抛出异常 NPOI.POIXMLProperties的初始化程序 NPOI.POIXMLDocument.GetProperties()将Rethrow改为POIXMLException NPOI.POIXMLDocument.GetProperties() NPOI.XSSF.UserModel.XSSFWorkbook.OnWorkbookCreate() NPOI.XSSF.UserModel.XSSFWorkbook..ctor()Admin.ExportExcel()(at 资产/脚本/资产经理/管理员:465) UnityEngine.Events.InvokableCall.Invoke()(at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:165) UnityEngine.Events.UnityEvent.Invoke()(at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58) UnityEngine.UI.Button.Press()(at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)(at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45) UnityEngine.EventSystems.ExecuteEvents.Execute(IPointerClickHandler handler,UnityEngine.EventSystems.BaseEventData eventData)(at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50) UnityEngine.EventSystems.ExecuteEvents.Execute [IPointerClickHandler] (UnityEngine.GameObject目标,UnityEngine.EventSystems.BaseEventData eventData,UnityEngine.EventSystems.EventFunction`1仿函数)(at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261) UnityEngine.EventSystems.EventSystem:更新()
我已经查看了npoi代码中的类,并找到了vStream 枚举在DocumentPropertiesCustom.cs中的第442,443行,所以我很漂亮 困惑的是,它无法找到它。我也不熟悉npoi。
任何帮助当然非常感谢!