ExcelDNA RTD不会更新新值,除非手动更改
我在...\Dsitrbution\Samples\RTD\
使用名为TestRTD.dna
的曲奇cookiesexcelDNA解决scheme。
我将GetEurOnd()
扩充为:
public static object getTestObject(String arg){ return GetTestItem(arg); }
GetTestItem()
保持不变。
我的XML格式如下:
<?xml version="1.0" encoding="utf-8"?> <ISIN> <US05574LFY92> <ID_ISIN>US05574LFY92</ID_ISIN> <A>40</A> <B>100.089004516602</B> <C>11:22:48.000</C> </US05574LFY92> </ISIN>
所以我的公式在excel中看起来像这样:
=getTestObject("ISIN/US002799AM62/A")
其中返回40
。 大!
现在,我正在运行代码,使用以下方法来更新xml中的值:
using (XmlWriter writer = XmlWriter.Create(recordPath)) { writer.WriteStartDocument(); writer.WriteStartElement("ISIN"); foreach (rtTrace.dataObj d in lines) { writer.WriteStartElement(d.ID_ISIN); writer.WriteElementString("ID_ISIN", d.ID_ISIN); writer.WriteElementString("A", dA); writer.WriteElementString("B", dB); writer.WriteElementString("C", dC); if (!tmp.ContainsKey(d.ID_ISIN)) { tmp.Add(d.ID_ISIN, ""); } writer.WriteEndElement(); } }
哪个成功地更新了我的XML文件中的值, 但在Excel中的公式仍然显示旧值 。
如果我进入我的XML文件并手动更新值, 那么新的值通过stream入Excel 。
任何想法我在这里做错了吗?
打墙。