Message 1 of 1
Active view filter not working

Not applicable
10-05-2009
10:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have these two filters which I want to use to select elements which use
fonts (textual elements) in order to change some parameters like bold,
italic underline, etc.
[code]
Dim TheActiveDocument As Document = commandData.Application.ActiveDocument
Dim TheActiveView as ElementsView =
commandData.Application.ActiveDocument.ActiveView
' iterate the document and filter
' -------------------------------
Dim iterator As ElementIterator = TheActiveDocument.Elements
Dim TextualElements As New System.Collections.ArrayList
iterator.Reset()
While iterator.MoveNext()
If
iterator.Current.Parameter(parameterId:=Parameters.BuiltInParameter.TEXT_FONT)
IsNot Nothing Then
TextualElements.Add(iterator.Current)
End If
End While
' iterate the active view and filter
' ----------------------------------
Dim iterator As IEnumerator = TheActiveView.Elements.GetEnumerator
Dim TextualElements As New System.Collections.ArrayList
iterator.Reset()
While iterator.MoveNext()
If
iterator.Current.Parameter(parameterId:=Parameters.BuiltInParameter.TEXT_FONT)
IsNot Nothing Then
TextualElements.Add(iterator.Current)
End If
End While
[/code]
The first one is working and iterates at document level. I've build the
second one kind of by analogy with the first one. However the second one,
supposed to iterate at the active view level is not working and the
TextualElements set is always empty, although I know that there are valid
elements in the view.
Can anybody explain what am I doing wrong and how to do it ?
TIA
--
Humans are born with a wide horizon.
As time goes by, the horizon narrows and
narrows, until it becomes a point of view.
I have these two filters which I want to use to select elements which use
fonts (textual elements) in order to change some parameters like bold,
italic underline, etc.
[code]
Dim TheActiveDocument As Document = commandData.Application.ActiveDocument
Dim TheActiveView as ElementsView =
commandData.Application.ActiveDocument.ActiveView
' iterate the document and filter
' -------------------------------
Dim iterator As ElementIterator = TheActiveDocument.Elements
Dim TextualElements As New System.Collections.ArrayList
iterator.Reset()
While iterator.MoveNext()
If
iterator.Current.Parameter(parameterId:=Parameters.BuiltInParameter.TEXT_FONT)
IsNot Nothing Then
TextualElements.Add(iterator.Current)
End If
End While
' iterate the active view and filter
' ----------------------------------
Dim iterator As IEnumerator = TheActiveView.Elements.GetEnumerator
Dim TextualElements As New System.Collections.ArrayList
iterator.Reset()
While iterator.MoveNext()
If
iterator.Current.Parameter(parameterId:=Parameters.BuiltInParameter.TEXT_FONT)
IsNot Nothing Then
TextualElements.Add(iterator.Current)
End If
End While
[/code]
The first one is working and iterates at document level. I've build the
second one kind of by analogy with the first one. However the second one,
supposed to iterate at the active view level is not working and the
TextualElements set is always empty, although I know that there are valid
elements in the view.
Can anybody explain what am I doing wrong and how to do it ?
TIA
--
Humans are born with a wide horizon.
As time goes by, the horizon narrows and
narrows, until it becomes a point of view.