I want to recolor a special tag-name with a defined color in my xml
document.
I figured out, that i must edit/extend the getAttributeFor( ITextRegion
region) method of the LineStyleProviderForXML class.
To identify my recoloring tag <BEHAVIOUR> I extract the Start and Length
( region.getStart(), region.getLength() ) of the Region if
region.getType() == DomRegionContext.XML_TAG_NAME
and then try to get the actual text of this tag by
Doc.get ( Start, Length ) where Doc is the underlying IStructuredDocument.
The problem is that region.getStart(), region.getLength() are relative to
the regions beginning and not the document beginning.
How can i find out what offset an ITextRegion has to the underlying
IStructuredDocument?
A.G. wrote:
> The problem is that region.getStart(), region.getLength() are relative to
> the regions beginning and not the document beginning.
> How can i find out what offset an ITextRegion has to the underlying
> IStructuredDocument?
Knowledge of the underlying document as well as absolute offset
information aren't kept in most of the ITextRegions--memory for
those references and numbers can add up fast. You can get the
absolute offsets from the
ITextRegionCollection/IStructuredDocumentRegion containing the text
region. The start and length values in the text region are relative
to the region collection or document region that contains them.