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

查看:115
本文介绍了模板引擎在.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.

我看到此问题您能推荐一个.net模板引擎吗?

请仅推荐免费的图书馆。

Please only recommend free libraries.

//我仍然在寻找一个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.

一个很好的演练如何做:

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

http://www.codeproject.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天全站免登陆