Telerik Forums
Reporting Forum
8 answers
555 views
I tried to create a report using Telerik Reporting from Visual Studio 2008 but the designer tool didn’t start. When I try to open the report, Visual Studio throws me this message:

The service Microsoft.VisualStudio.Shell.Interop.ISelectionContainer already exists in the service container. Parameter name: serviceType

What's happening? How can I fix it?
Elian
Telerik team
 answered on 22 Mar 2012
3 answers
240 views
Hi all,

I try to programmically set the property "Report" but it doesn't work well.

the scenario is :
- i define my reportViewer like this (the Raport Property will not specify) :  

<ctl:ReportViewer x:Name="ReportViewer1"

Grid.Row="0"

Grid.Column="0"

Grid.ColumnSpan="2"

ReportServerUri="../ReportService.svc"

HorizontalContentAlignment="Center"

HorizontalAlignment="Center"

VerticalContentAlignment="Top"

ViewMode="PrintPreview"

Style="{StaticResource ReportViewerStyle1}" />


- i have 3 radio button (each radio button defined a report)
- 1 button, when i click on this button, i take the name of the report : ReportViewer1.Report = "name of Report"

I am using the ReportViewer in Silverlight 5 ( version : Telerik_Reporting_Q1_2012_v6_0_12_215) and I use a ReportService.svc file to generate the report.

Thank you for your help.

Alilou
Top achievements
Rank 1
 answered on 22 Mar 2012
2 answers
98 views
Hi,
we are migrating from version v3.2.9.1211 to version 6.0. 12.215. Now we have a little problem with the RTF renderer. We have noticed that in the new version, the renderer automatically adds an outer frame. It's size depends on the page margins of the report.

Here a document (no outer frame) rendered with version v3.2.9.1211: https://ideacreation.box.com/s/34777dbb2da29a851e45
Here a document (with outer frame) rendered with version 6.0. 12.215: https://ideacreation.box.com/s/cb329622dda92cf9a935

Is there a way not to render the outer frame?

As you see, with the new version, it generates a page break. When I delete the outer frame in MS Word 2010, the second page disappears.

Do you have any hint, how I can avoid the second page?

Thank you,
Chris

Chris
Top achievements
Rank 1
 answered on 22 Mar 2012
2 answers
58 views
Dear all,

I Wish to Convert Crystal Reports to Telerik Report.
But when i start the New Report Wizard, it go direct from the welcome page to the Choose Data Source page.
Where is the Report Choice Page for me to convert report?
Anything i missing?

i Have Crystal Report XI R2 installed on my machine.
Teng Yau
Top achievements
Rank 1
 answered on 22 Mar 2012
5 answers
335 views
I'm trying to use the standalone Reportgenerator with an existing ODBC System-DSN with following connection string:
DSN=myDSN;UID=myUserid;PWD=myPwd

After inserting this connection string into the wizard, and specifying "select * from KnownTableName", following error accours:
"Unable to establish a connection to the database. Please, verify that your connection string is valid...".

This connection string works fine with WinSQL and seems to be valid (See attachment).




Elian
Telerik team
 answered on 21 Mar 2012
1 answer
97 views
I am using q2 2011 telerik reporting. when using an texbox control if I set left border of the rectangle(textbox) e.g. 4px or 4pt ... , in designer i will see all things fine (left border have more tickness) or if I set right border twice(for e.g.) I see it in correct in designer.But in the preview tab in the case of  left border ,I see that the  left and right border are more tickness and in the case of right border I have not seen any changes in right or left(no effect is seen).Is this a bug? and what is the solution?
Peter
Telerik team
 answered on 21 Mar 2012
3 answers
125 views
I'm creating an invoicing system that should be able to print multiple invoices without viewing them and with the same printer settings.

To enable this scenario i need to be able to pop up a printer dialog form and then i need to be able to use those setting to print multiple reports directly to the selected printer.

Is this possible with Telerik reporting and if so can somebody direct me to some sample code?


Peter
Telerik team
 answered on 21 Mar 2012
3 answers
444 views
I am creating a report manually, by catching "ItemDataBinding" and inserting elements.  After the report is created, I call the method below:

public void RenderPdfReport(IReportDocument report, string documentPath)
{
    ReportProcessor reportProcessor = new ReportProcessor();
    Hashtable deviceInfo = new Hashtable();
    deviceInfo["FontEmbedding"] = "None";
    RenderingResult result = reportProcessor.RenderReport("PDF", report, deviceInfo);
    if (result.DocumentBytes == null)
        return;
 
    using (FileStream fs = new FileStream(documentPath, FileMode.Create))
    {
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    }
}

Here's the deal.  To minimize the size of the PDF, I used this trick
deviceInfo["FontEmbedding"] = "None";
But - text that should be bold, is now bold and italic in the PDF.
If I set FontEmbedding to the default of "Subset", the bold text in the report is correct (just bold).
Am I doing something wrong?
Has anyone else seen this?
Thank you.
Charlie
Top achievements
Rank 2
 answered on 21 Mar 2012
1 answer
192 views
I created the following class to allow me to dynamically resize the font size of report elements.  The intention of this class is to allow me to add code to the ItemDataBound event for an element, section or report to automatically size the font to the best fit.  The code works great for a TextBox element but does not work for an HtmlTextBox.  The code gets the correct size based on the content that is provided but the report is not displayed with the updated style.  I have confirmed that the code works if it is added to the ItemDataBinding event but at this point the Value of the element has not been populated.  This scenario would only be beneficial for static content and in this case it would not be necessary to dynamically resize the font.

I am pretty sure that this is a bug with the HtmlTextBox control and/or the reporting engine.  Is there a way to accomplish what I am trying to do before this can be fixed?  Also, if this is in fact a bug when might you be able to fix it?

using System;
using System.Drawing;
using System.Linq;
using Telerik.Reporting.Processing;
 
namespace ReportSample
{
    public class ReportFont
    {
        public static void AutoSizeText(DetailSection dtl, int minFontSize, int maxFontSize)
        {
            foreach (Telerik.Reporting.Processing.ProcessingElement item in dtl.ChildElements)
            {
                if (!(item is ReportItem))
                    break;
 
                ReportItem rptItem = (ReportItem)item;
                if (TextSizingSupported(rptItem))
                {
                    AutoSizeText(rptItem, minFontSize, maxFontSize);
                }
            }
        }
 
        public static void AutoSizeText(ReportItem item, int minFontSize, int maxFontSize)
        {
            AutoSizeText(item, minFontSize, maxFontSize, false);
        }
 
        public static void AutoSizeText(ReportItem item, int minFontSize, int maxFontSize, bool forceResize)
        {
            if (!forceResize && !item.Name.EndsWith("_rf"))
                return;
 
            item.Style.Font.Size = GetFontSize(item, minFontSize, maxFontSize);
        }
 
        protected static Font GetFont(Telerik.Reporting.Drawing.Font font)
        {
            return GetFont(font.Name, font.Size.Value, font.Style);
        }
 
        protected static Font GetFont(Telerik.Reporting.Drawing.Font font, float fontSize)
        {
            return GetFont(font.Name, fontSize, font.Style);
        }
 
        protected static Font GetFont(string fontName, float fontSize, FontStyle style)
        {
            FontFamily fontFamily = new FontFamily(fontName);
            return GetFont(fontFamily, fontSize, style);
        }
 
        protected static Font GetFont(FontFamily fontFamily, float fontSize, FontStyle style)
        {
            return new Font(fontFamily, fontSize, style);
        }
 
        protected static bool TextSizingSupported(ReportItem item)
        {
            if (item is HtmlTextBox || item is TextBox)
                return true;
            return false;
        }
 
        protected static Telerik.Reporting.Drawing.Unit GetFontSize(ReportItem item, int minFontSize, int maxFontSize)
        {
            Size textSize;
            Font newFont = GetFont(item.Style.Font, maxFontSize);
            Size bounds = GetBounds(item);
            string value = GetValue(item);          
             
            do
            {
                textSize = System.Windows.Forms.TextRenderer.MeasureText(value, newFont, bounds, System.Windows.Forms.TextFormatFlags.WordBreak);
                if (textSize.Height > bounds.Height && newFont.Size != minFontSize)
                    newFont = GetFont(item.Style.Font, newFont.Size - 1);
            }
            while (textSize.Height > bounds.Height && newFont.Size > minFontSize);
 
            return Telerik.Reporting.Drawing.Unit.Point(newFont.Size);
        }
 
        protected static Size GetBounds(ReportItem tb)
        {
            Size bounds = (Size)tb.Bounds.Size;
            // Adjust the bounds slightly
            bounds.Height -= 3;
            return bounds;
        }
 
        protected static string GetValue(ReportItem item)
        {
            if (item is HtmlTextBox)
                return ((HtmlTextBox)item).Value.ToString();
 
            if (item is TextBox)
                return ((TextBox)item).Value.ToString();
 
            throw new Exception("Unsupported ReportItem passed.");
        }
    }
}
Elian
Telerik team
 answered on 21 Mar 2012
4 answers
297 views
Hi,

I have added a report parameter with display member and  value member, but datasource is binded in the codebehind file. Am able to see the drop down with the display member values, but when i add a report filter using this report parameter, its throwing an error-"An error has occurred while processing Report 'ReportName':Object cannot be cast from DBNull to other types".

Only after adding the filter, am facing this error, without the filter the report displays the chart with the actual values.

I have tried adding the filter to the report and also to the report parameter available values, but none works.
please help, asap...



 
Nader
Top achievements
Rank 1
 answered on 21 Mar 2012
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?