Telerik Forums
Reporting Forum
1 answer
106 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
130 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
455 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
202 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
303 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
1 answer
170 views
Hi,

We would like to use Telerik reporting component on our aspnet server.
We have potentially 300 concurrent users of our solution.
Does Telerik can support it level of charge?
Do you have any benchmark that will help us define a strategy?
Thank you very much for your answer.
Regards

Joël
Peter
Telerik team
 answered on 21 Mar 2012
1 answer
120 views
Hi ,
    At this moment ; I use the telerik reporting's version is 5.0.11.510 , and the report's data bind the ObjectDataSource in the Report_ItemDataBinding event.

   The telerik reporting report display well by using silverlight reportviewer ; But , When I have selected the 'pdf' or 'tiff' file format to export the report , the reportviewer will throw the exception.
  
   The other file format excluded the 'pdf' or 'tiff' have exported successfully.

   Please see the attachment included the exported exception.

   How to solve this issue ?
  
   Thanks.
Peter
Telerik team
 answered on 20 Mar 2012
6 answers
807 views
I'm trying to conditionally format the text of all fields showing on my report, if the value is a specific string value. Example, if the field has a value of "No" then i would leave it alone, if it was "Yes" it would have a text font color of red. I don't want to declare this for each field, I want to write one logical statement that can check the field value and if it meets a certain criteria, then it would format the style on the textbox that contains that field reference.


Is there a way to do this through design time dialogues or programatically?
Peter
Telerik team
 answered on 19 Mar 2012
1 answer
231 views
I'm developing a report that includes an HtmlTextbox.  However, while the formatted Html looks fine in the RadRichTextbox where it is being edited, it ends up with each span having its last several characters cut off.  This is an example of Html that produces the issue:
<p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">%%CALLDATE%% - %%CALLTIME%%12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"> this is a testdsafsdf</span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;">sent on </span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;">%%LETTERDATE%%</span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;"> </span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345123451234512345123451234512345123451234512345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /><br /><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;" /></p>

in the HtmlTextbox, this has every single span cut off at the right.  The same happens to the printout if I print directly from the ReportViewer control.  However, if I export the Html to PDF, the mysterious padding goes away!  It would be greatly appreciated if you could shed some light on this mystery.
IvanY
Telerik team
 answered on 19 Mar 2012
3 answers
600 views
I'm attempting to use the RunningValue function that accepts a System.String for the "scope" parameter.  The documentation says it can refer to a group but when I assign it the name of a group I get the following exception:

"Invalid Scope: 'DivisionId'"

... where "DivisionId" is the name of the group and also the name of the field the group is grouped by.

Help!

Thanks - wg
IvanY
Telerik team
 answered on 19 Mar 2012
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?