By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

Crystal Report: Format Horizontal Alignment

P: n/a
Hello,

Is there a way to format the data when it is passed into the Crystal
Report(CR).. for example.. In the original table, a number may be
left aligned, how to change it to right alignment?.. in other words I
want to change it's Format: Horizontal Alignment
from Left To Right if the
data passed in is an Integer, Currency, or
DateTime.

thanx

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi BlackDevil,

This is how i do it :

Dim crreportobject As
CrystalDecisions.CrystalReports.Engine.ReportObjec t

For Each crreportobject In
crReportDocument.ReportDefinition.ReportObjects
'' formats text object
If TypeOf (crreportobject) Is
CrystalDecisions.CrystalReports.Engine.TextObject Then
Dim crtextobject As
CrystalDecisions.CrystalReports.Engine.TextObject
If Trim(crreportobject.Name) = "Text2" Then
crtextobject = DirectCast(crreportobject,
CrystalDecisions.CrystalReports.Engine.TextObject)
crtextobject.Text = "Hi"
End If
End If
'' formats field object
If TypeOf (crreportobject) Is
CrystalDecisions.CrystalReports.Engine.FieldObject Then
Dim crtextobject As
CrystalDecisions.CrystalReports.Engine.FieldObject
If Trim(crreportobject.Name) = "Field73" Then
crtextobject = DirectCast(crreportobject,
CrystalDecisions.CrystalReports.Engine.FieldObject )

crtextobject.ObjectFormat.HorizontalAlignment =
Alignment.RightAlign
End If
End If
Next

Kind Regards
Jorge
-----Original Message-----
Hello,

Is there a way to format the data when it is passed into the CrystalReport(CR).. for example.. In the original table, a number may beleft aligned, how to change it to right alignment?.. in other words Iwant to change it's Format: Horizontal Alignment
from Left To Right if the
data passed in is an Integer, Currency, or
DateTime.

thanx

.

Nov 20 '05 #2

P: n/a
Hello Jorge,

Sorry, need to ask you something.

1. What crReportDocument? Is it the name of your Crystal Report or
something else?

a)........because when I change from
crReportDocument.ReportDefinition.ReportObjects()
to
[b:ba3448b144]report[/b:ba3448b144].ReportDefinition.ReportObjects()
(dim Public report As CrystalReport1 = New CrystalReport1) it there
are some incorrect syntax such as with
crreportobject.Name,
[i:ba3448b144]DirectCast(crreportobject,
CrystalDecisions.CrystalReports.Engine.TextObject) [/i:ba3448b144],
and [i:ba3448b144]crtextobject.Text[/i:ba3448b144],
[i:ba3448b144]crtextobject.ObjectFormat[/i:ba3448b144],
[i:ba3448b144]Alignment.RightAlign().[/i:ba3448b144]

b) if i dont change it, [b:ba3448b144]crReportDocument[/b:ba3448b144]
needs declaration..and
[i:ba3448b144]crtextobject.Text[/i:ba3448b144],
[i:ba3448b144]crtextobject.ObjectFormat[/i:ba3448b144],
[i:ba3448b144]Alignment.RightAlign().[/i:ba3448b144] and
[i:ba3448b144]DirectCast(crreportobject,
CrystalDecisions.CrystalReports.Engine.FieldObject )[/i:ba3448b144]
has syntax error.

c) If I change it to
[b:ba3448b144]OrrasReport.[/b:ba3448b144]ReportDefinition , it stated
that reference to non-shared member requires an object reference. and
the same other syntax error in b).

thanks

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.