Set font programatically on text object in

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

Who is Participating?
Computer101Connect With a Mentor Commented:
PAQed with points refunded (500)

EE Admin
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.

jtesdallAuthor Commented:
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.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

jtesdallAuthor Commented:
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.
Why were points awarded for this solution? It doesn't say anything!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.