How do I export a report to HTML? I can export to PDF, JPEG, and MHTML just fine, but not HTML. Here is the code I'm trying to use:
public static byte[] GetInvoiceHTML(Guid id, HttpServerUtility Server) |
{ |
// Get report object (with data). |
Telerik.Reporting.Report rpt = GetInvoiceReport(id, Server); |
// Render report object to HTML (byte array). |
string mimeType = string.Empty; |
string ext = string.Empty; |
Encoding encoding = Encoding.Default; |
byte[] bytes = Telerik.Reporting.Processing.ReportProcessor.Render("HTML", rpt, null, out mimeType, out ext, out encoding); |
// Convert byte array to string. |
return bytes; |
} |
In reading, it appears that Telerik supports .NET 5 (.net core 5) and would like to migrate but do not see any documentation around it.
My current solution is:
Full Framework project so I can use the VS designer to design the reports. Each report consists of a .cs, .Designer.cs, and .resx file.
.NET 2.0 standard project with a file link to those reports (not a copy) for unit testing and consumption
example in the project file:
<
ItemGroup
>
<
Compile
Include
=
"..\OtherProject\Telerik\Report.cs"
Link
=
"Telerik\Report.cs"
/>
<
Compile
Include
=
"..\OtherProject\Telerik\Report.Designer.cs"
Link
=
"Telerik\Report.Designer.cs"
/>
<
EmbeddedResource
Include
=
"..\OtherProject\Telerik\Report.resx"
Link
=
"Telerik\Report.resx"
/>
</
ItemGroup
>
.Net Core 3.1 app consuming the .NET 2.0 standard project.
How do I migrate those reports from the .NET 2.0 standard project to a native .NET 5 project while maintaining the designer capability?
I downloaded the Trial version of the reporting stuff and when I run the example project: CSharp.Net5.BlazorIntegrationDemo I get this exception:
Could not load type 'Telerik.Reporting.HtmlRendering2.HtmlReport' from assembly 'Telerik.Reporting, Version=15.0.21.120, Culture=neutral, PublicKeyToken=a9d7983dfcc261be'.
please advise
I can load the report viewer in react following this guide:
https://docs.telerik.com/reporting/knowledge-base/how-to-use-html5-viewer-in-react-js
But when I add react route, it failed when there is any input parameter.
<Route path="/test" component={ReportViewerFunction} /> // success
<Route path="/test2/:name" component={ReportViewerFunction} /> //show TypeError: window.jQuery(...).telerik_ReportViewer is not a function
And then I found this document, says that:
Such error can occur if:
jQuery is not loaded;
jQuery is loaded more than once and with different version;
jQuery is loaded at later stage in the page life cycle.
https://docs.telerik.com/reporting/knowledge-base/getting-telerik-reportviewer-is-not-a-function-console-error
I do not know how to fix this problem. Is there a better way to implement the report viewer in React?
Also I would like to know how to direct print the report, instead of every time preview the report before printing.
Long story short, im trying to implement dependency injection into a grid controller. The project i use is a .NET CORE Application using the Telerik UI template.
The problem is that i cannot make an ajax call to function inside my grid controller aslong as i do dependency injection. If i remove Constructor with the provided dependency injections it works fine.
In the view that i make an ajax call looks like this
<div class="row">
<div class="col-12">
<kendo-grid name="VehicleHome" height="550">
<columns>
<column field="Id" title="ID">
<filterable enabled="false"></filterable>
</column>
<column field="Name" title="Namn" />
</columns>
<scrollable enabled="true" />
<sortable enabled="true" />
<pageable enabled="true" />
<filterable enabled="true" />
<datasource type="DataSourceTagHelperType.Ajax" page-size="20">
<transport>
<read url="@Url.Action("VehicleHome_Read", "VehicleHome")" />
</transport>
</datasource>
</kendo-grid>
</div>
</div>
And the controller and function i make an call to like this:
public class VehicleHomeController : Controller
{
private readonly IVehicleHomeService _vehicleHomeService;
private readonly IVehicleService _vehicleService;
public VehicleHomeController(IVehicleHomeService vehicleHomeService, IVehicleService vehicleService)
{
this._vehicleHomeService = vehicleHomeService;
this._vehicleService = vehicleService;
}
public ActionResult VehicleHome_Read([DataSourceRequest] DataSourceRequest request)
{
var result = Enumerable.Range(0, 50).Select(i => new VehicleHomeViewModel()
{
Id = i * i,
Name = "Vehicle Home " + i
});
var dsResult = result.ToDataSourceResult(request);
return Json(dsResult);
}
}
1. As u see, im not even using the dependencies that is passed through the constructor. Still this causes the function to not be accessed by the ajax call.
2. If i remove the constructor and the interface i can access it. How Come?
Thankful for answers
Is there any way to set a target line in a column chart? In the attached image, I have an additional line chart inside of the column chart and changed the data point style to make it a longer line. Ideally I would like it to span across the full chart.
Thanks for your help.
If have a questionaire report where some of the answers contain an
uploaded image and have some trouble showing them correctly in a
report. Images are stored in the database and bound to a picturebox.
When there is an image I would like to snow it beneath the
text, it should not grow beyond the paper width. When there is no image I
would to show just text (no white placeholder for the image).
The
images can be large sometimes so setting Sizing of the Picturebox to
AutoSize does not work for me (it would clip the image in pdf export)
-Sizing AutoSize is nice, hides when there is no image, but it can grow beyond report width when images are large
-ScaleProportional
scales ok, but it does not align to the left and occupies white space when there
is no image (even when the picturebox is set to invisible via conditional formatting)
Is there workaround (eg AutoSize and change image dimensions in code behind just before binding?).
AutoSize with max dimensions would be a nice to have...
How to get this right, any clue appreciated