Talk:Working with properties

From Apache OpenOffice Wiki
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

fnDirectProperties and Bug 103670

Issue 103670 concerns property names that have invalid associated values. Fetching the value causes a Basic run-time exception, which must be handled.

Iannz's other versions of this routine, in his "Reveal Codes" macros, all required a similar fix. This version is a little different, so the exact fix shown here is untested.

'               subAddProperty( mDirectProperties(),sName, oTextRange.getPropertyValue(sName))
                on local error goto BadName
                vValue = oTextRange.getPropertyValue(sName)
                on local error goto 0
                if bError then
                    bError = False
                else
                    subAddProperty( mDirectProperties(),sName, vValue)
                end if

At the end of the function, insert the following:

exit function 'new normal exit
BadName:
bError = True
resume next
end function '(This line should appear only once.)
Personal tools