cancel
Showing results for 
Search instead for 
Did you mean: 

Rposition a line in the report

Former Member
0 Kudos

Hi all,

When doing

lineObject.Left=x;

or

lineObject.Rigth=x;

I get this exception:

The line object's coordinates are not valid. Only vertical or horizontal lines are supported.

The line is vertical as it is, I just need to move it...

How can I do it?

Asher

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

What product are you using:

What version?

What SP?

What's the version of .NET you are using?

What SDK are you using?

Provide full code as used for the report and the line object.

Ludek

Former Member
0 Kudos

Hi Ludek,

I did miss some ditails didnt I...

I am using:

Win XP

VSTO2008

.NET 3.5

the CR version delivered with VSTO2008

this is the code:

if (reportObject is LineObject)

{

// todo:

((LineObject)reportObject).Left = reportWidth - reportObject.Left;

((LineObject)reportObject).Right = reportWidth - reportObject.Left;

}

else

{

reportObject.Left = reportWidth - reportObject.Left - reportObject.Width;

}

The pupose of this is to "flip" a report to be displayed in a languages where flow is Right-To-Left such as hebrew and arabic

former_member183750
Active Contributor
0 Kudos

I wonder if this line:

((LineObject)reportObject).Left = reportWidth - reportObject.Left;

should be;

((LineObject)reportObject).Left = reportWidth - reportObject.Right;

?

Can you try to hard code the values and proceed from there?

Ludek

Former Member
0 Kudos

Ludek hi,

I found the solution. This is quite bizzar:

Lines must have same Top and Bottom or Left and Right at all times. Therefor, to change Left and Right one after the other, we must set Top and Bottom to the same value:

int top = ((LineObject)reportObject).Top;

((LineObject)reportObject).Top = ((LineObject)reportObject).Bottom;

((LineObject)reportObject).Right = reportWidth - reportObject.Left;

((LineObject)reportObject).Left = reportWidth - reportObject.Left;

((LineObject)reportObject).Top = top;

// After fliping LineStyle must be set:

((LineObject)reportObject).LineStyle = LineStyle.SingleLine;

Just in case you ever need it again.

Best,

Asher

Answers (1)

Answers (1)

0 Kudos

Thank you for posting your solution