Telerik Forums
Reporting Forum
1 answer
11 views

hi,

what is we have to do to distribute Telerik Reporting assemblies and merge them into a single
EXE or DLL that can be used by the custom application.

thx in advance,

Regards

Todor
Telerik team
 answered on 09 Jun 2021
2 answers
8 views

I am using Telerik reporting in a VB.net app.  The reports each preview correctly, but if I print directly to a printer, it comes up blank.  To PDF it saves a blank file.  To a physical printer, it goes through the motions with the driver, but nothing is actually printed.

Telerik.Reporting.dll is version 15.0.21.326.

What am I missing?

code below:

Public Sub SaveReport(ByVal myreport As Telerik.Reporting.Report, filename As String)
       
        Dim reportProcessor As Telerik.Reporting.Processing.ReportProcessor = New Telerik.Reporting.Processing.ReportProcessor()
        Dim instanceReportSource As Telerik.Reporting.InstanceReportSource = New Telerik.Reporting.InstanceReportSource()
        instanceReportSource.ReportDocument = myreport
        Dim renderingResult As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, Nothing)
        Dim fs As FileStream = New FileStream(filename, FileMode.Create)
        fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length)
        fs.Close()
    End Sub

 

Public Sub PrintReport(ByVal myreport As Telerik.Reporting.Report, ByVal Copies As Integer)
        strModErr = "Module1_PrintReport"
        Dim printerSettings As PrinterSettings = New PrinterSettings()
        Dim printController As PrintController = New StandardPrintController()
        Dim reportProcessor As ReportProcessor = New ReportProcessor()
        Dim instanceReportSource As Telerik.Reporting.InstanceReportSource = New Telerik.Reporting.InstanceReportSource()

        Try
            instanceReportSource.ReportDocument = myreport
            printerSettings.PrinterName = My.Settings.DriverLogPrinter
            printerSettings.Copies = Copies
            reportProcessor.PrintController = printController
            reportProcessor.PrintReport(instanceReportSource, printerSettings)
        Catch ex As Exception
            WriteErrorToLog(Err.Number, strModErr + " - " + Err.Description)
            Dim inner As Exception = ex.InnerException
            Do
                If inner IsNot Nothing Then
                    WriteErrorToLog(666, inner.GetType().Name + ": " + inner.Message)
                    inner = inner.InnerException
                End If
            Loop While inner IsNot Nothing

        End Try
    End Sub
   
Phil
Top achievements
Rank 1
Iron
 answered on 09 Jun 2021
2 answers
16 views

Hi,  I need your help please, do you have any idea how can I make this kind of report.

in each page, let say i have 10 rows and i set 3 data per page. The report will show the max row number  ("show 3 of 10 result." in the 1st page and for next page will show "show 6 of 10" )

is it possible? thank you

 

thank you

Neli
Telerik team
 answered on 08 Jun 2021
1 answer
15 views
Hi,

I upgraded from .net  3.1 to .net 5.0 ..

When i start program locally everything works (rendering etc, i have result and base64 string of pdf)  but inside docker it is not working ..

Do you have any ideas ? I pasted dockerfile

#FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine  AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0  AS build
ARG APP_ENV=omtest1

#app run environment
ENV APP_ENV $APP_ENV

WORKDIR /src

COPY test/*.csproj test/
COPY telerik/*.csproj telerik/
#COPY WorkerService3/*.csproj WorkerService3/
RUN dotnet restore  test/test.csproj

# copy and build app and libraries
COPY  test/  test/
COPY  telerik/ telerik/
#COPY  WorkerService3/ WorkerService3/

WORKDIR /src/test
RUN dotnet build -c release

#app ports to be exposed
EXPOSE 5000
EXPOSE 2000

FROM build AS publish
RUN dotnet publish -r linux-x64 -o /app/publish

# final stage/image
#FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine
FROM centos:7.5.1804
#FROM mcr.microsoft.com/dotnet/sdk:5.0
RUN 		yum install wget -y && \
	yum install -y epel-release && \
	rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm && \	
	yum install glibc-devel -y && \
        yum install -y libgdiplus-2.10-10.el7.x86_64 && \
        yum install libX11-devel -y && \
	yum install dotnet-sdk-5.0 -y && \	
        rm -rf /var/cache/yum 
WORKDIR /app/telerik
EXPOSE 2000
COPY --from=publish /app/publish .

ENV ASPNETCORE_URLS http://*:2000
RUN cd /app/telerik &&  \
    cp te36013t_0.ttf TeleNeo-Regular.otf TeleNeo-Bold.otf TeleGroteskNor_0.ttf te36016t_0.ttf ConnectCode39_0.ttf /usr/share/fonts/
CMD dotnet test.dll --environment development


Plamen Mitrev
Telerik team
 answered on 08 Jun 2021
1 answer
8 views

I am trying to get the month returned in a string in a report parameter. I currently have

Now().Month

But I suspect it is returning the number of the month because the field is blank when I run the report, which is strange because the other report parameter is

Now().Year
and that works just fine. I tried formatting as a string, but that did not work either. What am I doing wrong?
Plamen Mitrev
Telerik team
 answered on 08 Jun 2021
1 answer
5 views
Im saving a PDF in a Blob Storage, I can get the PDF but I need convert it to Telerik.Reporting.Report for using it like a SubReport inside a Report
Todor
Telerik team
 answered on 03 Jun 2021
8 answers
110 views
 System.OutOfMemoryException: Out of memory.
   at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
   at Telerik.ReportViewer.WinForms.DrawablePage.Draw(Graphics graphics, Rectangle rectangle) in c:\temp\reporting\@RBuild-2334\Reporting_Build\Source\Code\Telerik.ReportViewer.WinForms\DrawablePage.cs:line 47
   at Telerik.ReportViewer.WinForms.InteractivePageLayout.LayoutItem.DrawContent(Graphics graphics) in c:\temp\reporting\@RBuild-2334\Reporting_Build\Source\Code\Telerik.ReportViewer.WinForms\InteractivePageLayout.cs:line 334
   at Telerik.ReportViewer.WinForms.InteractivePageLayout.DrawPages(Graphics graphics, Rectangle rectangle, Int32 pageNo) in c:\temp\reporting\@RBuild-2334\Reporting_Build\Source\Code\Telerik.ReportViewer.WinForms\InteractivePageLayout.cs:line 98
   at Telerik.ReportViewer.WinForms.WinViewer.OnPaint(PaintEventArgs eventArgs) in c:\temp\reporting\@RBuild-2334\Reporting_Build\Source\Code\Telerik.ReportViewer.WinForms\WinViewer.cs:line 869
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Now previously in our 2012 we were getting something similar to this when a control with the embedded control was displaying a report built inside Visual Studio.  We upgraded to Q3 2013's release, removed the older reports, added a class that builds the XML version (trdx files) and the error went away.  Now a different Out of Memory exception error (listed above) recently started occurring.  Originally the image we used was streamed from the database (for logos) but now they are local to the application (I cannot point to the post, but on your ASP forums, someone suggested doing that with other Telerik controls that used images).  Our app is a desktop app (non-wpf) that uses Telerik Reporting.  The above error only seems to occur in certain situations, so not every time.  it occurs on reports that vary in pages (1-75).  Our reports that go into the reportbook do not have this problem (avg 136 reports totaling ~900 pages).  We have 2 report viewers (2 separate user controls on same form) that display the reports.  One displays a single report while the other display the report book when all the single reports are loaded.

In 2012 release we were getting (using code behind version) about 80% of the clients were getting this error:
​ System.OutOfMemoryException: Out of memory.
   at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
   at System.Drawing.Image.FromStream(Stream stream)
   at Telerik.ReportViewer.WinForms.DrawablePage.Draw(Graphics graphics, Rectangle rectangle)
   at Telerik.ReportViewer.WinForms.InteractivePageLayout.LayoutItem.DrawContent(Graphics graphics)
   at Telerik.ReportViewer.WinForms.InteractivePageLayout.DrawPages(Graphics graphics, Rectangle rectangle, Int32 pageNo)
   at Telerik.ReportViewer.WinForms.WinViewer.OnPaint(PaintEventArgs eventArgs)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Now this could just be me, but I'm starting to think it's not the loading of our logo onto the report, but drawing the report itself since the logo is no longer read from the database but read from file.  In my case, we discovered that working with trdx files are easier to create a dynamic tables than the code behind version.

Here is a sample of how the report is built.

/// <summary>
/// Returns a Telerik Report for use in the Telerik ReportViewer
/// </summary>
/// <param name="reportInfo"> of the report to generate, see ReportInfo class</param>
/// <returns></returns>
public Telerik.Reporting.Report GetReport(ReportInfo reportInfo)
{
#region hallway monitors
if (reportInfo == null)
throw new NullReferenceException("ReportInfo is missing or null.");

if (reportInfo.Name == null)
throw new NullReferenceException("Report Name is missing or null.");

#endregion

XDocument doc = CreateXDocument(reportInfo); //the trdx file

// open the report
BufferedStream stream = new BufferedStream(new MemoryStream());
stream.Write(Encoding.ASCII.GetBytes(doc.ToString()), 0, doc.ToString().Length);
stream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(stream);

System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace = true;

XmlDocument xmlDoc = GetXmlDocument(doc);
Telerik.Reporting.Report report;

using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(sr, settings))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();

report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
}

Telerik.Reporting.TextBox tbHeader = (Telerik.Reporting.TextBox)report.Items["pageHeaderSection1"].Items["textBoxHeader"];
tbHeader.Value = reportInfo.Title;

if (reportInfo.CompanyLogo != "" && reportInfo.CompanyLogo != null)
{
Telerik.Reporting.PictureBox pictureBoxCompanyLogo = (Telerik.Reporting.PictureBox)report.Items["pageHeaderSection1"].Items["pictureboxCompanyLogo"];
pictureBoxCompanyLogo.MimeType = reportInfo.CompanyLogoExt != "" ? "Image/" + reportInfo.CompanyLogoExt.ToUpper() : "";
pictureBoxCompanyLogo.Value = Image.FromFile(reportInfo.CompanyLogo);
}

foreach (TableInfo tableinfo in reportInfo.Tables)
{
Telerik.Reporting.Table table = (Telerik.Reporting.Table)report.Items["detailSection1"].Items[tableinfo.ReportTableName];
table.DataSource = tableinfo.DataSource;
}

return report;

}

​ private XmlDocument GetXmlDocument(XDocument document)
{
using (XmlReader xmlReader = document.CreateReader())
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);
if (document.Declaration != null)
{
XmlDeclaration dec = xmlDoc.CreateXmlDeclaration(document.Declaration.Version,
document.Declaration.Encoding, document.Declaration.Standalone);
xmlDoc.InsertBefore(dec, xmlDoc.FirstChild);
}
return xmlDoc;
}
}

private XDocument CreateXDocument(ReportInfo reportInfo)
{
XDocument doc = new XDocument();

_isLandscape = reportInfo.Layout == ReportProperties.Layout.LANDSCAPE ? true : false;

doc.Add(new XElement(XML_NAME_SPACE + "Report"
, new XAttribute("Width", reportInfo.Layout.Width.ToString() + "in")
, new XAttribute("Name", reportInfo.Name)));

XElement rootItems = new XElement(XML_NAME_SPACE + "Items");
rootItems.Add(PageHeaderSection());
rootItems.Add(DetailSection(reportInfo));
rootItems.Add(PageFooterSection());

doc.Root.Add(rootItems);
doc.Root.Add(StyleSheets());
doc.Root.Add(PageSettings());

return doc;
}
n/a
Top achievements
Rank 1
Iron
 answered on 02 Jun 2021
6 answers
289 views

Hello, I'd like to, using the Standalone Report Designer, Import an existing Visual Studio Report (.cs) and save it as a trdx.

I have seen the following links:

http://docs.telerik.com/reporting/import-report-wizard

and

http://docs.telerik.com/reporting/standalone-report-designer-import-clr-reports

 

They indicate it possible but the second link seems for a different interface than mine. (There is no " In the Open dialog window, select .NET Report Library from the file type combobox. ")

and following the first link leads to an Import Report Wizard but in the "available converters" there is only Crystal Reports. Also the file filter gives no option for extensions other than *.rpt.

 

Do I have to install/ download a .NET converter?

 

I have Report Designer Q3 2015.

 

Thanks,

-Jeff

Chris
Top achievements
Rank 1
Iron
 answered on 01 Jun 2021
3 answers
19 views

Hi, currently we are using version 12.2.18.1017 of telerik reporting.

we are thinking of upgrading to the latest version since you guys have release the web designer which is really awesome.

however, we are still using VS designer to modified all the template. as far as I know, if we want to use web designer, we need to convert all templates to standalone template.

our currently project is rely on the report REST Service to get the report. we may want to switch away from the REST service or may be stay on it depends what is it offered in web designer.

So here are my questions:

1. What would be best solution for us from your perspective / expertise?

2. If we want to convert our old VS template to standalone template, how do we do it. We are using store procedure as Data source which means our old template is not parameterless (I think). What is the best way to convert them?

an example of how we import the data right now is attached in the file.

 

 

Recent update, I have managed to convert the file from our class object to trdx format. I am thinking to store it inside our DB so that we can call this format from an RESP API endpoint and present it to the html designer.

However, this template has alot funtions. not sure how would I called those functions if I am trying to access the template from a standalone designer or a html designer.

new xml file is attached.

0 answers
9 views

Hi,

I upgraded my Telerik reporting version to the latest version.

I view reports using the Properties dialogue of a ReportViewerall worked fine.

but after some reports, suddenly I get this error:

Invalid report type Exception has been thrown by the target of an invocation.

and I do not can see any reports. (all the reports , others too).

Yesterday I get this error all time. Today the reports worked fine' and suddenly I get this error again.

Can anyone shed any light as to the possible reasons why this might be happening?

Thanks

Chani


 

Chana
Top achievements
Rank 1
 asked on 29 May 2021