Set font programatically on text object in

Posted on 2008-11-12
Last Modified: 2013-11-26
I am trying to dynamically set the font and color of a text object in a section of a report. The code listed only sets the color and font on the first embedded field. These are simple database generated address labels but I canoo figure out how to access (reference) individual embeded fields or tell the report to set the font and color on the completetext object.
Dim section As Section = report.ReportDefinition.Sections.Item("Section3")

        Dim textObject As TextObject = section.ReportObjects("Text4")

        textObject.Color = Color.Red

        textObject.ApplyFont(New Font("Arial", 8.25F))

Open in new window

Question by:jtesdall
    LVL 100

    Expert Comment

    I don't believe you can dynamically access the individual embedded fields.

    You can format them by selecting them from the textbox and right clicking
    You should be able to use the formula buttons on the FONT tab to set the values you want.


    Author Comment

    Yes, but I want to do this programatically. Basically based on certain criteria at runtime I want to change the font and color on these labels.

    I may have found a solution but it is a work around. I duplicated the text object and set the new font and color I want. Then at runtime I set the length of the text object I don't want to zero so the one I do want displays. This seems to work for now, but setting the font on the text object should have worked for the whole object instead of just the first embedded field. I guess this is a bug.
    LVL 100

    Expert Comment

    The formula method I mentioned is at runtime.  Is the information you use to set the color available in the report?


    Author Comment

    No its not. I just want people to be able to select a standard font or script font for printing out address labels from our database with my app.
    LVL 1

    Accepted Solution

    PAQed with points refunded (500)

    EE Admin

    Expert Comment

    Why were points awarded for this solution? It doesn't say anything!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now