VB Crystal Report >> text object right-align doesn't work

by wardy1975 » Mon, 21 Mar 2005 22:54:12 GMT

Hi,

I have a number of text objects on a Crystal Report that I am
dynamically setting the text for at runtime using .NET. I want the
text to be right-aligned in these objects. At design time, I have set
the horizontal alignment to be right, but at runtime when I get a
reference to the object and set it's text, it always reverts to
left-aligned. I have also tried in the code resetting the alignment
after setting the text value using the following code, but it doesn't
work either:

txtObject.ObjectFormat.HorizontalAlignment = Alignment.RightAlign;

Is this a bug in Crystal? If I don't modify the text setting at
runtime, it is right aligned...Does anyone know how to do this?

Thanks,

JohnW



VB Crystal Report >> text object right-align doesn't work

by christian kuendig » Mon, 09 May 2005 03:24:53 GMT


Hi,

I got the same problem with centre align. But it seems to be not a
consequent thing. Have you tried to remove the text object and insert it
again into the report (same name etc.).

Additionally I figured out the engine crashes if I have copied pasted text
with a formatation into the text object and I want to re-set the text at
runtime (e.g. for localization).

regards

Chris

< XXXX@XXXXX.COM > schrieb im Newsbeitrag






Similar Threads

1. align text left and align text right: on the same line - Word VBA

2. Right align column does not work from vb

I use vb6, win2000, and word2003.

I am creating a word document in vb.

After I write the data to the document I put it into a table:

  oRange.start = WordDoc.Range.start
  oRange.ConvertToTable numcolumns:=IIf(choice, 4, 1), AutoFit:=True

I want to have the second column right-aligned. This code does not
work:

    tbl.Columns(2).Select
    Selection.ParagraphFormat.Alignment = wdAlignParagraphRight

It works as a macro in Word on the final document, but not from vb.

This code works, but is slow:

   Dim cl As Cell
   For Each cl In tbl.Columns(2).Cells
     cl.Range.ParagraphFormat.Alignment = wdAlignParagraphRight
   Next cl

Regards,

Jan Nordgreen

3. Right align text in combobox

4. Right-align text in combobox

Hello,

Is it possible to right-align the text in the list and / or the textbox of a 
combobox?
Can it be done through properties or through code?

Many thanks,

Michel 

5. Problem in right align of the text - VB.Net

6. How to right align text in command button?

Greetings every1,
This thing has been done many a times, but I cant get it now. Just how can i
right align text in a command button. I used the following code

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Const GWL_STYLE = (-16)
Const BS_RIGHT As Long = &H200&

Private Sub Command2_Click()
Dim newStyle As Long
newStyle = GetWindowLong(Command1.hwnd, GWL_STYLE)
newStyle = newStyle And BS_RIGHT
SetWindowLong Command1.hwnd, GWL_STYLE, newStyle
End Sub

But its not working. Can any guyz provide a working solution...If Not VB
Then Exit


7. Want to understand why this doesn't work right, please

8. CommonDialog ShowOpen Doesn't Seem to Work Right

I've been using VB for about 8 years, but I don't remember ever using
the CommonDialog component. 

I tried to use it as a browse for file function just now and it
doesn't behave as expected.

It seems to work if I select a file that;'s really a file, but if I
select a folder shortcut, instead of opening the folder like normal
Windoze applications, it returns the .lnk (shortcut) file.

Is this a known deficiency or am I doing something wrong?

jim
VB5 (SP3)