[英]How to Read a particular Data from XML file and Write it to an Existing Excel Sheet using c#
i have an xml file, i have some values like good, and bad, with Tag Quality. 我有一个xml文件,我对标签质量有一些好的和坏的值。 I want to read the xml file and print the ones which are Bad, in the Excel sheet which is existing.
我想读取xml文件并在现有的Excel工作表中打印错误的文件。 Can anyone help me Please.
谁能帮我。 My XML file looks same as Below.
我的XML文件如下所示。 So in that text i want to write entire HYDR.
因此,在该文本中,我想编写整个HYDR。 instrument id, HYDR.Quality" Only for Bad Values in HYDR.Quality Element.
仪器ID,HYDR.Quality”,仅适用于HYDR.Quality元素中的错误值。
<HYDR.Instrument id="ABR"> <HYDR.Quality>Good</HYDR.Quality> <HYDR.Value>0</HYDR.Value> </HYDR.Instrument> <HYDR.Instrument id="ABR_DUMMY"> <HYDR.Quality>Bad</HYDR.Quality> <HYDR.Value>0</HYDR.Value> </HYDR.Instrument> <HYDR.Instrument id="ABR_LOOP_JP"> <HYDR.Quality>Good</HYDR.Quality> <HYDR.Value>15.208 kg/cm2g</HYDR.Value> </HYDR.Instrument> <HYDR.Instrument id="ABR_MOV_12"> <HYDR.Quality>Good</HYDR.Quality> <HYDR.Value>0</HYDR.Value> </HYDR.Instrument>
Basically you need to use two libraries to get to the answer you want: 基本上,您需要使用两个库来获得所需的答案:
First you need to load the XML file, so I suggest using the Linq library, you can start from here 首先,您需要加载XML文件,因此我建议使用Linq库,您可以从这里开始
Then, you need to write the filtered XML elements to excel, I suggest to use the aspose library, you can start learning from here 然后,您需要将过滤后的XML元素编写为excel,我建议使用aspose库,您可以从此处开始学习
Using these two libraries, you can achieve what you want. 使用这两个库,您可以实现所需的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.