【问题标题】:dynamic object to build reports in Aspose.Words LINQ Reporting Engine在 Aspose.Words LINQ 报告引擎中构建报告的动态对象
【发布时间】:2018-07-11 12:28:00
【问题描述】:

我从客户端获取 json 字符串:

{ "Client": { "Name": "John" } }

在文档中我有以下标签:

<<[client.name]>>

并尝试注入它:

var obj = JsonConvert.DeserializeObject(input.DataJson);
var engine = new ReportingEngine();
engine.BuildReport(document, obj);

但它不起作用。 我可以通过不区分大小写的属性检查来注入该 json 吗?或者我必须修改 json 以将其属性设为小写? 我该怎么做?

【问题讨论】:

标签: c# json linq aspose.words


【解决方案1】:

恐怕,LINQ Reporting Engine 目前不支持动态对象作为数据源。我们已为您的方案记录了新功能请求。此问题的 ID 是 WORDSNET-16421。一旦实现了请求的功能,我们将通过此线程通知您。您可以将 JSON 字符串转换为 DataSet 以使其工作,如以下示例所述:

// Assume you have following in document
// <<[Client.Name]>>
string json = "{ \"Client\": { \"Name\": \"John\" } }";

XmlDocument Xml = (XmlDocument)JsonConvert.DeserializeXmlNode(json);

DataSet ds = new DataSet();
ds.ReadXml(new MemoryStream(Encoding.UTF8.GetBytes(Xml.InnerXml)));

Document doc = new Document(MyDir + @"in.docx");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, ds.Tables[0].Rows[0], "Client");

doc.Save(MyDir + @"18.2.docx");

我与 Aspose 合作,担任开发人员宣传员。

【讨论】:

  • 谢谢,请在这里告诉我,或者给我一个问题的链接。
  • 不幸的是,没有直接的方法可以自己跟踪问题。但是,欢迎您通过此线程询问问题状态。我们将通过我们的内部问题跟踪系统验证状态并回复您。一旦此问题得到解决,我们一定会通过此线程通知您。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多