Showing posts with label font. Show all posts
Showing posts with label font. Show all posts

Thursday, February 16, 2012

Changing font color dynamically in Crystal Reports

I have a windows app which uses the free version of Crystal Reports. The idea is that I should allow the users to choose their own font and colors (for example one might want to see the title green and arial). Do you happen to know how I can do that? I don't even know if it is possible given that there is practically no code behind the reports...

Thank you in advance. :)Add parameters to the report for font and font color. Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the select settings|||Can you please give me an example?|||Select {?FontColor} <--This is your parameter field
Case "Red": <-You should have a case stament for each color
crRed
Case "Black":
crBlack
Default:
DefaultAttribute

Here are the default color attributes.
crBlack
crMaroon
crGreen
crOlive
crNavy
crPurple
crTeal
crSilver
crRed
crLime
crYellow
crBlue
crFuchsia
crAqua
crWhite

Do the same for the font replacing the colors with the font names.|||But where do I write this code?|||Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the selected settings

As I originally stated above..|||try sample code as mentioned below. You can get access to any object in the report and from code, you can change the object property just like you do using visual studio. Sorry for not answering you stright. But this info will very helpful to you I recon.

Private Sub AdjustCarPicSize(ByVal iHeight As Integer, ByVal iWidth As Integer)
'For Each section As CrystalDecisions.CrystalReports.Engine.Section In reportDocument.ReportDefinition.Sections
' For Each reportObject As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
' If reportObject.Kind = ReportObjectKind.SubreportObject Then
' Dim subReport As SubreportObject = CType(reportObject, SubreportObject)
' Dim subDocument As ReportDocument = subReport.OpenSubreport(subReport.SubreportName)
' If (subReport.SubreportName = "CarPic") Then
' For Each section1 As CrystalDecisions.CrystalReports.Engine.Section In subDocument.ReportDefinition.Sections
' For Each reportObject1 As CrystalDecisions.CrystalReports.Engine.ReportObject In section1.ReportObjects
' 'Response.Write(reportObject1.Name)
' If (reportObject1.Name = "carpicimage1") Then
' reportObject1.Height = iHeight
' reportObject1.Width = iWidth
' End If

' Next
' Next
' End If

' End If
' Next
'Next
Dim oCarPic As CrystalDecisions.CrystalReports.Engine.ReportObject = CType(reportDocument.ReportDefinition.Sections("DetailSection6").ReportObjects("Subreport1"), SubreportObject).OpenSubreport("CarPic").ReportDefinition.Sections("ReportHeaderSection2").ReportObjects("carpicimage1")

Tuesday, February 14, 2012

Changing default font

Hi,
is there a way to change the default font settings? currently every textbox
comes in Arial 10pt. i need that whenever i drag a textbox it comes Arial
8pt, for every report.If you find a way PLEASE post it here.
Mike Kruchten
"Kazar" <kazar@.kazar.kaz> wrote in message
news:OqpJLqJoEHA.3224@.tk2msftngp13.phx.gbl...
> Hi,
> is there a way to change the default font settings? currently every
textbox
> comes in Arial 10pt. i need that whenever i drag a textbox it comes Arial
> 8pt, for every report.
>|||still no idea :(
I wonder if its even possible... if not, it would be nice to have this
feature in the next version..
"Mike Kruchten" <mkruchten@.fsisolutions.com> wrote in message
news:OAXZvDLoEHA.3712@.TK2MSFTNGP15.phx.gbl...
> If you find a way PLEASE post it here.
> Mike Kruchten
> "Kazar" <kazar@.kazar.kaz> wrote in message
> news:OqpJLqJoEHA.3224@.tk2msftngp13.phx.gbl...
> > Hi,
> >
> > is there a way to change the default font settings? currently every
> textbox
> > comes in Arial 10pt. i need that whenever i drag a textbox it comes
Arial
> > 8pt, for every report.
> >
> >
>

Friday, February 10, 2012

Changing control/Property box values

Help!
I'm trying to figure out how to change the values on the properties control
box dynamically. Things such as Hidden, size, font. With the RS format of
<name>!<fieldname>.Value, how are such things called?
Example code (which doesn't work because of compile problems:
=iif(Fields!TableName.Value = Parameters!tblName.Value,
ReportItems!Hidden.Value = "False", ReportItems!Hidden.Value = "True")
The goal is to hide a list box/field. What do I use in place of
ReportItems!Hidden.Value to make this work?
Thanks,
CatadminHi,
I have the same problem as you. I'm trying with custom code, you can see a
description:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RShowto/htm/hrs_designer_v1_1nfp.asp
But only can access the "value", somethig like this:
Function NullData (txt As textbox) As Boolean
If (txt.value = "") Or _
(txt.value) Is Nothing Then
Return False
End If
Return True
End Function
I'm working to change the width property value. If I'm sucess I will post
here.
Maybe you can do something more with this. I hope it can be helpfull.
"Catadmin" wrote:
> Help!
> I'm trying to figure out how to change the values on the properties control
> box dynamically. Things such as Hidden, size, font. With the RS format of
> <name>!<fieldname>.Value, how are such things called?
> Example code (which doesn't work because of compile problems:
> =iif(Fields!TableName.Value = Parameters!tblName.Value,
> ReportItems!Hidden.Value = "False", ReportItems!Hidden.Value = "True")
> The goal is to hide a list box/field. What do I use in place of
> ReportItems!Hidden.Value to make this work?
> Thanks,
> Catadmin