(Msg. 1) Posted: Wed Sep 03, 2008 4:19 pm
Post subject: How can I find out the start point and the end point of msoLine in Archived from groups: microsoft>public>powerpoint (more info?)
Hi
I am trying to write automation code for powerpoint. When I try to
parse a straight line in powerpoint
I dont know from which object I can get the start point and end point
of the line.
I tried shapeNodes, but there is no shapenode under the line shape
(Msg. 2) Posted: Wed Sep 03, 2008 10:07 pm
Post subject: Re: How can I find out the start point and the end point of msoLine in powerpoint? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
> I am trying to write automation code for powerpoint. When I try to
> parse a straight line in powerpoint
> I dont know from which object I can get the start point and end point
> of the line.
>
The shape's .Top and .Left will give you one end point.
..Top + .Height and .Left + .Width will give you the other end point.
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
(Msg. 3) Posted: Thu Sep 04, 2008 8:33 am
Post subject: Re: How can I find out the start point and the end point of msoLine [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Sep 3, 8:07 pm, Steve Rindsberg <ab....TakeThisOut@localhost.com> wrote:
> > I am trying to write automation code for powerpoint. When I try to
> > parse a straight line in powerpoint
> > I dont know from which object I can get the start point and end point
> > of the line.
>
> The shape's .Top and .Left will give you one end point.
>
> Top + .Height and .Left + .Width will give you the other end point.
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com
> PPTools: www.pptools.com
> ================================================
> Live and in personable in the Help Center at PowerPoint Live
> Sept 21-24, San Diego CA, USAwww.pptlive.com
Thanks for your fast reply.
There is still a little problem by using the left-top of the shape as
start point.
For example, if the line goes 2 o'clock direction, the left - bottom
will be the
start point.
(Msg. 4) Posted: Thu Sep 04, 2008 4:06 pm
Post subject: Re: How can I find out the start point and the end point of msoLine in powerpoint? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
>
> Thanks for your fast reply.
>
> There is still a little problem by using the left-top of the shape as
> start point.
> For example, if the line goes 2 o'clock direction, the left - bottom
> will be the
> start point.
>
> Any idea about this?
Ah. Good question. Thanks!
This should help. It works with the current selection, just as a test:
Sub test()
Dim oSh As Shape
Dim x As Long
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
' Here's the information we already know how to get
Debug.Print "Left: " & .Left
Debug.Print "Top: " & .Top
Debug.Print "Left+Width: " & .Left + .Width
Debug.Print "Top+Height: " & .Top + .Height
Debug.Print .Nodes.Count
' now the same information but in "node order"
' the first pair of coordinates will be the beginning
' point on the line, the second pair will be the end point
For x = 1 To .Nodes.Count
Debug.Print .Nodes(x).Points(1, 1)
Debug.Print .Nodes(x).Points(1, 2)
Next
End With
End Sub
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
(Msg. 5) Posted: Fri Sep 05, 2008 8:18 am
Post subject: Re: How can I find out the start point and the end point of msoLine [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
> Ah. Good question. Thanks!
>
> This should help. It works with the current selection, just as a test:
>
> Sub test()
> Dim oSh As Shape
> Dim x As Long
>
> Set oSh = ActiveWindow.Selection.ShapeRange(1)
>
> With oSh
> ' Here's the information we already know how to get
> Debug.Print "Left: " & .Left
> Debug.Print "Top: " & .Top
> Debug.Print "Left+Width: " & .Left + .Width
> Debug.Print "Top+Height: " & .Top + .Height
> Debug.Print .Nodes.Count
>
> ' now the same information but in "node order"
> ' the first pair of coordinates will be the beginning
> ' point on the line, the second pair will be the end point
> For x = 1 To .Nodes.Count
> Debug.Print .Nodes(x).Points(1, 1)
> Debug.Print .Nodes(x).Points(1, 2)
> Next
> End With
> End Sub
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com > PPTools: www.pptools.com > ================================================
> Live and in personable in the Help Center at PowerPoint Live
> Sept 21-24, San Diego CA, USAwww.pptlive.com
Hi
As I am using C automation code, there is something wrong....
when I tried to get the Notes (similar to what u are doing)
CShapeNotes shapeNotes = shape.get_Notes();
long count = shapeNotes.get_Count();
Here, the count is 0!!
Tried to do the same to a curve or free drawing line.
the count of notes is not equal to 0...
(Msg. 6) Posted: Fri Sep 05, 2008 8:51 am
Post subject: Re: How can I find out the start point and the end point of msoLine [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Sep 5, 9:18 am, lai <yujing.....TakeThisOut@gmail.com> wrote:
> > Ah. Good question. Thanks!
>
> > This should help. It works with the current selection, just as a test:
>
> > Sub test()
> > Dim oSh As Shape
> > Dim x As Long
>
> > Set oSh = ActiveWindow.Selection.ShapeRange(1)
>
> > With oSh
> > ' Here's the information we already know how to get
> > Debug.Print "Left: " & .Left
> > Debug.Print "Top: " & .Top
> > Debug.Print "Left+Width: " & .Left + .Width
> > Debug.Print "Top+Height: " & .Top + .Height
> > Debug.Print .Nodes.Count
>
> > ' now the same information but in "node order"
> > ' the first pair of coordinates will be the beginning
> > ' point on the line, the second pair will be the end point
> > For x = 1 To .Nodes.Count
> > Debug.Print .Nodes(x).Points(1, 1)
> > Debug.Print .Nodes(x).Points(1, 2)
> > Next
> > End With
> > End Sub
>
> > -----------------------------------------
> > Steve Rindsberg, PPT MVP
> > PPT FAQ: www.pptfaq.com
> > PPTools: www.pptools.com
> > ================================================
> > Live and in personable in the Help Center at PowerPoint Live
> > Sept 21-24, San Diego CA, USAwww.pptlive.com
>
> Hi
>
> As I am using C automation code, there is something wrong....
> when I tried to get the Notes (similar to what u are doing)
>
> CShapeNotes shapeNotes = shape.get_Notes();
> long count = shapeNotes.get_Count();
> Here, the count is 0!! >
> Tried to do the same to a curve or free drawing line.
> the count of notes is not equal to 0...
Just now I tried to run ur code in the ppt 2007.
The count is also equal to 0.
So we still could not get the Node order, as there is no node....
Below is the result...
Left: 78.74803
Top: 151.8742
Left+Width: 585.0016
Top+Height: 320.6254
0 <----------------Node count
(Msg. 7) Posted: Fri Sep 05, 2008 10:40 am
Post subject: Re: How can I find out the start point and the end point of msoLine [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks
On Sep 5, 11:30 am, Steve Rindsberg <ab... DeleteThis @localhost.com> wrote:
> > Just now I tried to run ur code in the ppt 2007.
> > The count is also equal to 0.
> > So we still could not get the Node order, as there is no node....
>
> > Below is the result...
> > Left: 78.74803
> > Top: 151.8742
> > Left+Width: 585.0016
> > Top+Height: 320.6254
> > 0 <----------------Node count
>
> I'm seeing the same thing here in 2007, while it works fine in 2003.
>
> I'm not sure what to suggest next, really. I'll report it as a bug, though.
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com
> PPTools: www.pptools.com
> ================================================
> Live and in personable in the Help Center at PowerPoint Live
> Sept 21-24, San Diego CA, USAwww.pptlive.com
(Msg. 8) Posted: Fri Sep 05, 2008 1:30 pm
Post subject: Re: How can I find out the start point and the end point of msoLine in powerpoint? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
>
> Just now I tried to run ur code in the ppt 2007.
> The count is also equal to 0.
> So we still could not get the Node order, as there is no node....
>
> Below is the result...
> Left: 78.74803
> Top: 151.8742
> Left+Width: 585.0016
> Top+Height: 320.6254
> 0 <----------------Node count
I'm seeing the same thing here in 2007, while it works fine in 2003.
I'm not sure what to suggest next, really. I'll report it as a bug, though.
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum