Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 基于NPOI的不可理解误差_C#_.net_Xml_Npoi - Fatal编程技术网

C# 基于NPOI的不可理解误差

C# 基于NPOI的不可理解误差,c#,.net,xml,npoi,C#,.net,Xml,Npoi,我正在尝试使用C#中的NPOI编辑excel文件,但它给了我一个我不理解的错误,并且我在Internet上找不到任何有关此的文档。 以下是相关代码: 代码的质量很差,因为SO不允许我发布正确缩进的代码,我对此感到厌倦。无法让它工作,所以我拍了一张截图 在工作簿的第8行,我总是有一个难看的、无休止的错误。写下说明: InvalidOperationException:类型NPOI.OpenXmlFormats.ItemChoiceType为 命名空间中的元素“empty”缺少枚举值“empty”

我正在尝试使用C#中的NPOI编辑excel文件,但它给了我一个我不理解的错误,并且我在Internet上找不到任何有关此的文档。 以下是相关代码:

代码的质量很差,因为SO不允许我发布正确缩进的代码,我对此感到厌倦。无法让它工作,所以我拍了一张截图

在工作簿的第8行,我总是有一个难看的、无休止的错误。写下说明:

InvalidOperationException:类型NPOI.OpenXmlFormats.ItemChoiceType为 命名空间中的元素“empty”缺少枚举值“empty” ''. System.Xml.Serialization.XmlReflectionImporter.ImportElementInfo (System.Type cls,System.String默认名称,System.String defaultNamespace,System.Type defaultType, System.Xml.Serialization.XmlTypeMapMemberElement成员, System.Xml.Serialization.Xml属性(附件) System.Xml.Serialization.XmlReflectionImporter.CreateMapMember (系统类型去极化类型, System.Xml.Serialization.XmlReflectionMember rmember,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String defaultNamespace)作为InvalidOperationException重新显示:存在 反映字段“项”时出错。 System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String defaultNamespace)作为InvalidOperationException重新显示:存在 反映类型“NPOI.OpenXmlFormats.CT_属性”时出错。 System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type类型,System.Xml.Serialization.XmlRootAttribute根, System.String(默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportElementInfo (System.Type cls,System.String默认名称,System.String defaultNamespace,System.Type defaultType, System.Xml.Serialization.XmlTypeMapMemberElement成员, System.Xml.Serialization.Xml属性(附件) System.Xml.Serialization.XmlReflectionImporter.CreateMapMember (系统类型去极化类型, System.Xml.Serialization.XmlReflectionMember rmember,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String defaultNamespace)作为InvalidOperationException重新显示:存在 反映字段“属性”时出错。 System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String defaultNamespace)作为InvalidOperationException重新显示:存在 反映类型“NPOI.OpenXmlFormats.CT_CustomProperties”时出错。 System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData TypeData, System.Xml.Serialization.XmlRootAttribute根,System.String 默认名称空间) System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type类型,System.Xml.Serialization.XmlRootAttribute根, System.String(默认名称空间) System.Xml.Serialization.XmlSerializer..ctor(System.Type类型, System.Xml.Serialization.XmlAttributeOverrides重写, System.Type[]外部类型,System.Xml.Serialization.XmlRootAttribute 根,System.String(默认名称空间) System.Xml.Serialization.XmlSerializer..ctor(System.Type类型) NPOI.OpenXmlFormats.CustomPropertiesDocument..cctor()返回为 TypeInitializationException:类型引发了异常 NPOI.OpenXmlFormats.CustomPropertiesDocument的初始值设定项 NPOI.POIXMLProperties..cctor()返回为 TypeInitializationException:类型引发了异常 NPOI.POIXMLProperties的初始值设定项 NPOI.POIXMLDocument.GetProperties()作为POIXMLException重新显示 NPOI.POIXMLDocument.GetProperties()NPOI.POIXMLDocument.Write (System.IO.Stream)Statistiques.Save()(位于 Assets/Scripts\u Exp/Statistiques.cs:26)TutorialManager.Update()(位于 Assets/Scripts\u Exp/TutorialManager.cs:78)

当然,给定的URL已经不存在了。 如果我尝试在文件中记录给定的单元格,它会给我正确的值,因此读取文件是有效的,但不会写入

有没有人已经经历过这一切?
谢谢你的帮助。:)

尝试写入不同的流式伪代码:

var outputStream=新文件流(与输入不同) 工作簿.写入(outputStream)