ActiveReports for .NET 3.0 Support

Started by fryeguy at 03-04-2010 6:56 PM. Topic has 9 replies.

Print Search Rate
Sort Posts:    
   03-04-2010, 6:56 PM
fryeguy is not online. Last active: 3/12/2010 12:21:05 AM fryeguy

Not Ranked
Joined on 03-05-2010
Posts 5
Changing font at runtime
I am customizing one of my reports and a font installed in my system is not available to use for my text objects.

Are their methods for programmatically setting the font from the script side?

I have seen posts about creating a font at runtime to adjust font attributes...
   Report 
   03-04-2010, 7:39 PM
IssamElbaytam [DD] is not online. Last active: 8/26/2011 6:10:19 AM IssamElbaytam [DD]

Top 50 Posts
Joined on 06-18-2003
Posts 273

DDStaff
Re: Changing font at runtime
One option is use the themes feature to modify major and minor fonts in your report. You can modify the theme file (XML) once and it will be picked up by all reports using it.
   Report 
   03-05-2010, 2:22 PM
fryeguy is not online. Last active: 3/12/2010 12:21:05 AM fryeguy

Not Ranked
Joined on 03-05-2010
Posts 5
Re: Changing font at runtime
so to be more clear, I am writing custom reports inside of an application called D-Tools which utilizes ActiveReports as its reporting engine. I'm not sure where to find the theme XML file (if my application actually uses it).
   Report 
   03-08-2010, 6:39 AM
AashishB is not online. Last active: 12/24/2010 3:51:14 PM AashishB

Top 25 Posts
Joined on 12-11-2008
Posts 818
Re: Changing font at runtime
fryeguy,
You can use the font property of the control to set its Font attribute at runtime. Take a look at this link.
Let me know if you need more assistance.

Regards,
Aashish

   Report 
   03-08-2010, 8:06 AM
IssamElbaytam [DD] is not online. Last active: 8/26/2011 6:10:19 AM IssamElbaytam [DD]

Top 50 Posts
Joined on 06-18-2003
Posts 273

DDStaff
Re: Changing font at runtime
I am sorry, you posted your question in the DDR forum and did not indicate that you were using ActiveReports and not DDR. Themes is a feature of DDR not AR. Please see Aashish's reply.
   Report 
   03-09-2010, 3:45 PM
fryeguy is not online. Last active: 3/12/2010 12:21:05 AM fryeguy

Not Ranked
Joined on 03-05-2010
Posts 5
Re: Changing font at runtime
I checked out the link and it makes perfect sense to me. However I am not having much luck implementing this code.

Maybe a couple of questions will guide us in how I should proceed:

1. Is there any specific criteria that might make a font installed on my system not available to the report designer? OpenType, TrueType?

2. When I am creating the new font using the font property, does this have to been done for every Label and Textbox I want to apply the font to? Based on the code it looks like this is the case.

3. I haven't done a great deal of VB.NET but some older VB. In the context of the report script does the "Me" in Me.Label1... refer to the report, the report section, or something else?

4. I get a couple of errors:

a) Handles clause requires a WithEvents variable defined in the containing type or one of its base types...
I looked at some different causes for this error but I can't quite figure out how to resolve it. I know the report designer is using VB.NET for scripting.

b) 'Label1' is not a member of 'DataDynamics.ActiveReports.ActiveReport3'.
This error is regarding my hacked together code: rpt.Label1.Font = New System.Drawing.Font = ("MinionPro"),
where Label1 is the name of a Label I want to apply the font to.
   Report 
   03-09-2010, 4:32 PM
Jon Smith - DD is not online. Last active: 2/10/2012 4:28:33 PM Jon Smith - DD

Top 25 Posts
Joined on 02-21-2007
Raleigh, NC
Posts 958

DDStaff
Re: Changing font at runtime
1. There should be nothing we are doing to filter out available fonts. It may be a case of a user not having permissions for some fonts. A quick way to test this would be to right click your application and run it as Administrator.


2. You can use scripting to modify the default style class of the report controls which is "Normal":

Sub Detail1_Format
    rpt.StyleSheet("Normal").FontName = "Times New Roman"   
End Sub


3. Scripting in ActiveReports for .NET 3.0 does not have access to the members of the report class. So controls would need to be accessed by indexes or names:

CType(rpt.Sections("Detail1").Controls("Label1"), Label).Font = new Font("Arial", 10)


4. Errors:

a) When using scripting (not code-behind), the Handles clause should not appear after the event handler declaration as it would in VB.NET code. Scripting follows the same syntax as VB.NET generally speaking, but there are some differences.

b) Answer is above for question 3.


Let me know if you have any more questions.


-Jon

   Report 
   03-09-2010, 6:08 PM
fryeguy is not online. Last active: 3/12/2010 12:21:05 AM fryeguy

Not Ranked
Joined on 03-05-2010
Posts 5
Re: Changing font at runtime
Using this code:

CType(rpt.Sections("grpHeadings").Controls("Label1"), Label).Font = new Font ("Minion Pro", 10)

I can actually preview and publish the report.

I can tell the code has an effect because while the font is still Arial or something close, the code wipes out the formatting set by the report designer control.

What is it with this font that is so strange?

FYI, I am always running as an adminstrator of my local machine...
   Report 
   03-10-2010, 9:54 PM
AnkitN is not online. Last active: 6/8/2010 6:43:55 AM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 844

DDStaff
Re: Changing font at runtime
Hello,

Did you reboot the machine after you installed the font? Could you provide me the fonts so that I can try to reproduce the issue at my end? Make sure that the font should be of TrueType as ActiveReports uses GDI+ rendering, which only support TrueType fonts.

Regards,
Ankit Nigam


   Report 
   03-11-2010, 11:50 AM
fryeguy is not online. Last active: 3/12/2010 12:21:05 AM fryeguy

Not Ranked
Joined on 03-05-2010
Posts 5
Re: Changing font at runtime
Turns out this was definitely an OpenType font. I found a font conversion website: http://www.fontconverter.org/

The site is self-explanatory. convert font, reinstall the new converted font and ActiveReports will play nice.
   Report 
GrapeCity » Product Support » ActiveReports f... » Re: Changing font at runtime

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.