首页 > 解决方案 > FastReport 开源对象数据源

问题描述

我尝试使用 FastReport 开源从我将提供给报告的数据中构建报告。

我在演示中找到了我想要的东西(https://github.com/FastReports/FastReport/tree/master/Demos/OpenSource/DataFromBusinessObject/DataFromBusinessObject

在这个演示中,我在报告文件中看到BusinessObjectDataSource使用了 a,这似乎是我想要使用的。

但是,我看不到在社区设计器中添加这种源的方法。我需要手动添加所有这些吗?或者有没有办法生成所需的标记?我在他们的网站上找不到解决方案。

标签: fastreport

解决方案


我找到了一种方法,像这样手动制作所需的 xml:

<BusinessObjectDataSource Name="Invoices" ReferenceName="Invoices" Enabled="true">
  <Column Name="Reference" DataType="System.String"/>
  <Column Name="Date" DataType="System.String"/>
  <Column Name="CompanyName" DataType="System.String"/>
  <Column Name="InvoiceEmail" DataType="System.String"/>
  <Column Name="VAT" DataType="System.String"/>
  <Column Name="Street" DataType="System.String"/>
  <Column Name="Number" DataType="System.String"/>
  <Column Name="City" DataType="System.String"/>
  <Column Name="ZipCode" DataType="System.String"/>
  <Column Name="Country" DataType="System.String"/>
  <Column Name="TotalPrice" DataType="System.Decimal"/>
  <Column Name="VATValue" DataType="System.Decimal"/>
  <Column Name="VATPercentage" DataType="System.Decimal"/>
  <Column Name="VATComment" DataType="System.String"/>
</BusinessObjectDataSource>

唯一的缺点是,如果我的对象发生更改,我需要更新它(但至少正在工作!)


推荐阅读