模板引擎来生成.NET简单的报表 [英] Templating Engine to Generate Simple Reports in .NET

查看:197
本文介绍了模板引擎来生成.NET简单的报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个免费的模板引擎来生成简单的报告。我想一些基本的功能,例如:

I'm looking for a free templating engine to generate simple reports. I want some basic features such as :

  • 笔头循环(与任何IEnumerable的)
  • 传递变量
  • 在传递模板文件(主模板,页脚,标题)

我会用它来生成HTML和XML报告。我不是在寻找一个ASP.NET模板引擎。

I'll use this to generate reports in HTML and XML. I'm not looking for a ASP.NET Template Engine.

这是一个WinForms应用程序。

This is for a WinForms applications.

我已经看到了这个问题,<一个href="http://stackoverflow.com/questions/340095/can-you-recommend-a-net-template-engine">http://stackoverflow.com/questions/340095/can-you-recommend-a-net-template-engine,然而,所有这些模板引擎是总矫枉过正的我,倾心为ASP.NET。

I've seen this question http://stackoverflow.com/questions/340095/can-you-recommend-a-net-template-engine, however all of those template engines are total overkill for me and focused for ASP.NET.

请只推荐免费图书馆。

//我还在寻找一个NVelocity,但它不看任何有前途的.NET,过于复杂,当你下载它的一堆文件并不清楚该怎么做,没有教程,启动文件等。

// I'm still looking an NVelocity but it doesn't look any promising for .NET, overly complicated, when you download it's bunch of files not clear what to do, no tutorial, startup document etc.

推荐答案

我第二次不建议nVelocity。这是一个可怕的端口。

I second not recommending nVelocity. It is a horrible port.

.NET实际上已经用codeDOM内置模板的能力。

.NET actually has built in templating abilities by using CodeDOM.

下面是如何做到这一点一个pretty的好演练:

Here is a pretty good walkthrough of how to do it:

HTTP://www.$c$cproject.com/KB/ CS / smarttemplateengine.aspx

使用一些小的代码,你就可以创建具有内嵌C#模板:

With some minor coding, you'll be able to create templates that have inline C#:

<html>
    <head>
         <title>My Report</title>
    </head>
    <body>
        <% foreach (ReportRow r in ReportData) { %>
             <!-- Markup and Code for Report -->
        <% } %>
    </body>
</html>

这篇关于模板引擎来生成.NET简单的报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆