Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
"
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.
Posted
Updated 21-Sep-16 2:03am
v2
Comments
ZurdoDev 20-Sep-16 7:52am    
Click Improve question and post the relevant code.
Muhammad Rehbar Sheikh 20-Sep-16 9:00am    
share relevant code.
Karthik_Mahalingam 20-Sep-16 9:06am    
Possible solutions from google and other sources wont help unless you post your code with relevant information.

1 solution

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.
 
Share this answer
 
Comments
Yogi@FLG 22-Sep-16 0:14am    
OK thanks for the info.
But in any way could i render the report in localreport only and convert that to html?
Nathan Minier 22-Sep-16 7:27am    
Sure, but you'd need a parser of some sort. You'd likely be best off rendering as PDF and sending it down the pipe that way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900