如何使用c#将localreport呈现给HTML。 [英] How to render localreport to HTML using c#.

查看:135
本文介绍了如何使用c#将localreport呈现给HTML。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够将一个localreport渲染为pdf但是在渲染到html时我得到了一个例外。



我将引用异常,如下所示。 />

I was able to render a localreport to pdf but while rendering it to html i am getting an exception.

I will quote the exception as follows.
"

System.ArgumentOutOfRangeException was caught
  Message=Specified argument was out of the range of valid values.
Parameter name: format
  Source=Microsoft.ReportViewer.WinForms
  ParamName=format



可能出现的错误可能是什么错误。

我有什么不对的错与?

会有什么解决方案?

如果有替代解决方案请指定。

TIA





///根据您的建议添加我的代码

LocalReport report = new LocalReport();

report.ReportEmbeddedResource =NyReport.RDLC;

Byte [] mybytes = report.Render(HTML 4.0);

///



Byte [] mybytes = report.Render(HTML 4.0); : - 这是我如上所述得到例外的地方。



我尝试过:



来自谷歌和其他来源的可能解决方案。

"
What could be the possible error for the same.
What could i be wrong with?
What would be the solution?
If there would be an alternate solution please do specify.
TIA


/// Adding my code as per your suggestions
LocalReport report = new LocalReport();
report.ReportEmbeddedResource = "NyReport.RDLC";
Byte[] mybytes = report.Render("HTML 4.0");
///

Byte[] mybytes = report.Render("HTML 4.0"); :- this is the place where i get exception as stated above.

What I have tried:

Possible solutions from google and other sources.

推荐答案

您正在尝试使用ReportViewer不支持的格式。请查看:

Report.Render方法(字符串) (Microsoft .Reporting.WinForms) [ ^ ]



这可能来自以下两种情况之一:

1.您已安装LocalReport扩展程序以呈现HTML,以及字符串中的空格搞乱了,你可以渲染HTML4.0,但不能渲染HTML 4.0。



2.根据文档提供的报告在本地模式(这是您使用LocalReport的那个)不包括HTML。您需要使用WebForms命名空间和ServerReport类(带有HTML4.0命名空间)。
You're attempting to use a format that is not supported by your ReportViewer. Have a look at:
Report.Render Method (String) (Microsoft.Reporting.WinForms)[^]

This could be from 1 of 2 things:
1. You have a LocalReport extension installed to render HTML, and the space in the string is messing things up and you can render "HTML4.0", but not "HTML 4.0".

2. According to the documentation the reports available in local mode (which is what you're using with LocalReport) do not include HTML. You'll need to use the WebForms namespace and ServerReport class (with an "HTML4.0" namespace) for that.


这篇关于如何使用c#将localreport呈现给HTML。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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