Conditional formatting of Data

4 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 01 Dec 2007 Link to this post

    Hi,
         I am creating a report application where I want to make conditional formatting. I have a column as status . The column contains data ' normal status'  and 'abnormal status'. The column is showing data correctly.
     Now what I needed is to show the data 'abnormal status' as bold.
         Thus, I don't want the complete column to be bold. Depending upon the data it contains I want the selected data to be bold from that column.
       Is it possible to do so?

    Thanks,
    Rahul
  2. Milen
    Admin
    Milen avatar
    163 posts

    Posted 03 Dec 2007 Link to this post

    Hello Rahul,

    Thank you for contacting us again.

    In order to accomplish your goal, you may use the Conditional Formatting property of report items. This technique gives you the power to apply formatting on a report item only if a condition is met.

    In your case the condition can be

    =Fields.Status = ="abnormal status"
    .

    This line compares if the two expressions evaluate to equal values during processing. If the values are equal, the chosen Style is applied. In your case in the Style only check the Bold check box.

    If you want only the TextBox with the Status field to turn bold, apply conditional formatting on it only, otherwise apply it on the desired textboxes.
    If you want for example to apply the formatting on all texboxes in a section, you can apply the formatting on the section reporting item. In that case be careful if you have set global styles, because they matter more then the parent style (the section is parent to the textboxes in it).

    In the attached report library project you can review example of conditional formatting used.

    I hope this information helps.



    Sincerely yours,
    Milen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
  4. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 04 Dec 2007 Link to this post

    Hi!,
         I am creating the textbox dynamically(code provided by you) as:

    Private Function CreateTxtDetail(ByVal FieldName As String, ByVal i As Integer) As Telerik.Reporting.TextBox
            Dim txtHead As New Telerik.Reporting.TextBox()
            txtHead.Value = "=[" + FieldName + "]"
            txtHead.Location = New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(i, Telerik.Reporting.Drawing.UnitType.Inch), New Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch))
                txtHead.Size = New SizeU(New Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm))
         Return txtHead
    End function

    In this scenario how to write code for conditional formatting?Can you please help me?

    Thanks,
    Rahul






  5. Svetoslav
    Admin
    Svetoslav avatar
    649 posts

    Posted 04 Dec 2007 Link to this post

    Hello Rahul,

    As far as the Telerik Reports are .NET classes there is no difference whether you will use the designer to generate it or code it by yourself. The best place you can look for sample code is to first use the Report designer to create a report and then examine the designer generated class (usually named with .designer.cs for C# or .designer.vb for VB.NET).

    Best wishes,
    Svetoslav
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top