Re: Getting selected TextRange
- From: Steve Rindsberg <abuse@xxxxxxxxxxxxx>
- Date: Mon, 01 Dec 2008 14:30:12 -0500
In article <50s5j4hfa52nejucvlhmi9adskrqma8mit@xxxxxxx>, David Thielen
wrote:
Got it on the bounds - I was missing something there.
But as I put in another post, I get cases where many of the properties
throw an exception. Any idea why that happens?
Not really, as I mentioned below. Unless it's to do with the current
selection not being text. Are you testing for that?
ActiveWindow.Selection.Type will return one of four values, depending on
whether the current selection is Slides, Shapes, Text or nothing.
thanks - dave
On Fri, 28 Nov 2008 14:51:49 -0500, Steve Rindsberg
<abuse@xxxxxxxxxxxxx> wrote:
I'm not sure why you're getting an error in some cases, but if the text
is, for example, center-aligned, the BoundLeft property will change as
you add more and more characters. The text will stay centered and
BoundLeft and .BoundWidth will increase by equal amounts.
For a Selection sel, to get the TextRange, we have found that we need
to do:
TextRange fullText;
if (sel.Type == PpSelectionType.ppSelectionText)
{
Microsoft.Office.Interop.PowerPoint.ShapeRange spRange =
sel.ShapeRange;
Microsoft.Office.Interop.PowerPoint.Shape shapeOn =
spRange[1];
fullText = shapeOn.TextFrame.TextRange;
}
Because sel.TextRange throws an exception when getting some properties
like BoundLeft (when the selection Length == 0) and returns a
different value when there is a length.
Shouldn't both of these TextRanges be the same?
thanks - dave
david@at-at-at@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
david@at-at-at@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
.
- Follow-Ups:
- Re: Getting selected TextRange
- From: David Thielen
- Re: Getting selected TextRange
- Prev by Date: Re: How do I get the last paragraph in a TextRange?
- Next by Date: Re: Presentation not opening in web browser after saving in html form.
- Previous by thread: Re: How do I get the last paragraph in a TextRange?
- Next by thread: Re: Getting selected TextRange
- Index(es):
Relevant Pages
|