[Webinar] Learn how to a build a cloud-first strategyRegister Now


Set font programatically on text object in CR.net

Posted on 2008-11-12
Medium Priority
Last Modified: 2013-11-26
I am trying to dynamically set the font and color of a text object in a section of a cr.net 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 101

Expert Comment

ID: 22945400
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

ID: 22945980
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 101

Expert Comment

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.


Author Comment

ID: 22946296
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 VB.net app.

Accepted Solution

Computer101 earned 0 total points
ID: 23179583
PAQed with points refunded (500)

EE Admin

Expert Comment

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

865 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