Telerik Forums
Reporting Forum
2 answers
321 views
I am currently trying to take an embedded image out of a report's .resx file and point it (relatively) to a file in an images folder in the same project.  I have tried every combination of the relative path in both Report designer and even setting it in C# in the report's constructor in the code behind.  When I set the pictureBox's value to .\Images\fpi-ontarget-letterhead-black.jpg , it works in design mode, but in preview mode, I get the error: "Invalid URI: The format of the URIcould not be determined."  I noticed that if I set an absolute path on my hard drive, it will work, but I would like to avoid that.  I would like to get it working with a relative path.  Thank you in advance.
Mike
Top achievements
Rank 1
 answered on 30 Jul 2015
13 answers
903 views
Hi,
Is there a sample we can download to see the example on how Telerik Reporting is used in WPF MVVM? If there is, would you please let me know where to download it from.

Cheers...
Stef
Telerik team
 answered on 30 Jul 2015
2 answers
185 views
Hello,

I use the following method to export report from console application.
The problem is that the generating report is exported only in default culture (en).
Setting the Thread.CurrentCulture and Thread.CurrentUICulture has no effect.

private void GenerateReportFromSource(InstanceReportSource reportSource, ReportType reportType, String path, CultureInfo cultureInfo)
        {           
            LocalizationInfo.Culture = cultureInfo;
            Thread thread = new Thread(() =>
            {
                try
                {
                   ReportProcessor reportProcessor = new ReportProcessor();
 
                    RenderingResult result = reportProcessor.RenderReport(reportType.ToString().ToUpper(), reportSource, null);
 
                    FileInfo info = new FileInfo(path);
                    if (info.DirectoryName != null && !Directory.Exists(info.DirectoryName))
                        Directory.CreateDirectory(info.DirectoryName);
                    File.WriteAllBytes(path + "." + reportType.ToString().ToLower(), result.DocumentBytes);
                }
                catch (Exception e)
                {
                    Logger.WriteException(e);
                }
            });
            thread.CurrentCulture = cultureInfo;
            thread.CurrentUICulture = cultureInfo;
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();
        }

Thanks in advance.

Best regards,
Geoffrey
Stef
Telerik team
 answered on 30 Jul 2015
1 answer
153 views

So, I've set up a "component" for a project-level data source as described here: http://www.telerik.com/help/reporting/data-source-how-to-add-project-data-source.html

I've added the new data source to a report, and I have added a table to display the data.

When I go to the Html Preview I get an error " An error has occurred while processing Report 'Xxxx': The ConnectionString property has not been initialized."

While I was following the directions for the component, I had selected a ConnectionString and added in a SQL query with parameters and I was able to preview the data and it was looking just fine. But, now that I've added it to the report I need it in I get the above error.

 Any helps? I'm using the latest Q2 2015 tool.

Thanks,
Ken

Nasko
Telerik team
 answered on 29 Jul 2015
2 answers
126 views

Error saving the file in pdf format within the .pdf file with the message:

 An error has occurred while processing Report 'Report1':
Object with name 'Report2' already exists. Object should have unique names.

Can someone help me?

Matheus
Top achievements
Rank 1
 answered on 29 Jul 2015
1 answer
107 views

Found another issue when embedding the Report Viewer within a bootstrap site.  I found all my reports showed what looked like cell spacing in a table - see TelerikReportingBootstrapBefore.png.  This happened in Normal Viewing mode and Print Preview mode.

 All you need to do to fix it is add the following bold text before the #reportViewer1 style.  This fixes the issue for the report viewer and turns the report back to normal - see TelerikReportingBootstrapAfter.png.

<style>
        * {
             box-sizing: content-box!important;
         }

        #reportViewer1 {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 5px;
            bottom: 5px;
            height: 100%;
            overflow: hidden;
            font-family: Verdana, Arial;
        }
    </style>​

Stef
Telerik team
 answered on 29 Jul 2015
1 answer
128 views

I have a ReportViewer in my WinForms application to show some data in the form of a Telerik Report. I also have some textboxes, which will update the Report when the user leaves the textbox and the text has been changed.

private void SpediControl_Leave(object sender, EventArgs e)
{
    Control ct = sender as Control;
 
    // check if text in textbox has been changed
    if (ct.Text != s) // s is the text of the textbox
    {
        // update spedi report
        InstanceReportSource repSrcSpedi = new InstanceReportSource();
        repSrcSpedi.ReportDocument = new Spedi(this);
        repViewerSpediPreview.ReportSource = repSrcSpedi;
        repViewerSpediPreview.RefreshReport();
    }
}

After​ leaving a textbox, the ReportViewer gets the focus on itself. So I'm using UpdateUI event. To test if it gets fired, I just call a MessageBox:

private void repViewerSpediPreview_UpdateUI(object sender, EventArgs e)
{
    MessageBox.Show("aaa");
}

To my surprise, the message box gets called 8 times. First, I thought the "_Leave()" event must have an error. But the Leave event is only triggered once (as expected). It's only the UpdateUI event which is triggered multiple times. Everything else is working as expected. Is this a known bug or can anyone please provide me some help?

Regards,
Danilo

Stef
Telerik team
 answered on 29 Jul 2015
4 answers
603 views
I am able to create PDF's from my Telerik report very easily, and it works great.  I want to save that report to the database, so it doesn't have to regenerate every time.  It is not saving for some reason to the database, and I know that I can do this with other PDF byte arrays in other pieces of my code.  Is something different with the Telerik Byte Array?  Both below save data with other PDF byte arrays, but not the telerik report.  What am I doing wrong?  When I debug, both have values in the byte array, reportBytes.

Example 1, VB does not work: (param1 is passed in as an integer)

            Dim reportBytes As Byte()
            Dim mimeType As String = String.Empty
            Dim ext As String = String.Empty
            Dim encoding As Encoding = encoding.Default
            reportBytes = Telerik.Reporting.Processing.ReportProcessor.Render("PDF", report, Nothing, mimeType, ext, encoding)

            asqlConnection = GF_GET_DATABASE_CONNECTION()
            Dim sql As String = "UPDATE TABLE SET PDF = @reportBytes where xxx=" & CType(param1, String)
            Dim cmd As SqlCommand = New SqlCommand(sql, asqlConnection)
            cmd.Parameters.AddWithValue("@reportBytes", reportBytes)
            Dim id As Integer = cmd.ExecuteNonQuery()

Example 2, C# does not work (param1 is passed in as an integer):
            byte[] reportBytes =ReportProcessor.Render("PDF", reportToExport, null,out mimeType, out ext, out encoding);
            Database db = DatabaseFactory.CreateDatabase("ConnectionString");
            DbCommand dbCommand = db.GetSqlStringCommand("update TABLE set PDF = @imageData where xxx=" + param1);

            db.AddInParameter(dbCommand, "@imageData", DbType.Binary, reportBytes);

            int ret = db.ExecuteNonQuery(dbCommand);
            dbCommand.Dispose();

Nasko
Telerik team
 answered on 29 Jul 2015
1 answer
143 views

I just updated my Telerik Reporting to 2015 Q2. I'm almost done fixing every obseletes properties and method but one issue remain and I can't find any proper solution to fix it. Here is my code:

Dim GridColumnElements() As Processing.ProcessingElement = GridTable.ChildElements.Find("GridColumnTextBox", True)
For i As Integer = 0 To GridColumnElements.Count - 1
     Dim ColumnRatio As Double = (GrdField.Columns(i).Width / TotalColumnPixelWidth)
     Dim ColumnWidth As Unit = TotalGridWidth.Multiply(ColumnRatio)
     Dim pe As Processing.ProcessingElement = GridColumnElements(i)
     Dim tb As Processing.TextBox = DirectCast(pe, Processing.TextBox)

 

Now I get the classic:

"Warning 'Public ReadOnly Property ChildElements As Telerik.Reporting.Processing.ProcessingElement.ElementCollection' is obsolete: 'The Telerik.Reporting.Processing.ProcessingElement.ChildElements property is now obsolete. Use Telerik.Reporting.Processing.ElementTreeHelper.GetChildElements() method instead.'

 

It doesn't seems to have any method that would suite me well in this case.. any ideas ?

Nasko
Telerik team
 answered on 29 Jul 2015
1 answer
146 views

Hi All,

 

Can we create report book with report designer only ? not using code

 

 

Nasko
Telerik team
 answered on 29 Jul 2015
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?