https://issues.apache.org/bugzilla/show_bug.cgi?id=50401

           Summary: EscherOpt record property of type
                    EscherComplexProperty returns 'unknown' for getName
                    but has a propName
           Product: POI
           Version: 3.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=26364)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26364)
Powerpoint file containing a shape with a .Name property

In some cases, it is possible to create an EscherComplexProperty of an
org.apache.poi.ddf.EscherOptRecord
that returns  'unknown' for getName(), but where the EscherOptRecord.toString()
method correctly returns a string containing propName: <real property name>.

As an example:  In the attached ppt file, I've used the VBA macro that follows
to set the .Name property of the blue square to a string.

Using HSLF and poi (using jython), I can write:

ss=SlideShow(HSLFSlideShow('x.ppt'))
ss.slides[0].shapes[-1].getSpContainer()

I then see that the last property in my EscherOpt record is:

propNum: 896, propName: groupshape.shapename, complex: true, blipId: true,
data: 
00: 3C, 00, 50, 00, 41, 00, 54, 00, 48, 00, 2E (etc)

(notice the groupshape.shapename)


However, when I use POI/HSLF to iterate over the container, as follows:

itt=ss.slides[0].shapes[-1].getSpContainer().getIterator()
while(itt.hasNext()):
   curRecord=itt.next()
   if curRecord.recordName=='Opt':
       props=curRecord.getEscherProperties()
       for p in props:
           print p.getClass(), p.getName()

I get:

<type 'org.apache.poi.ddf.EscherSimpleProperty'> text.wraptext
<type 'org.apache.poi.ddf.EscherSimpleProperty'> text.anchortext
<type 'org.apache.poi.ddf.EscherRGBProperty'> fill.fillcolor
<type 'org.apache.poi.ddf.EscherRGBProperty'> fill.fillbackcolor
<type 'org.apache.poi.ddf.EscherBoolProperty'> fill.nofillhittest
<type 'org.apache.poi.ddf.EscherRGBProperty'> linestyle.color
<type 'org.apache.poi.ddf.EscherBoolProperty'> linestyle.nolinedrawdash
<type 'org.apache.poi.ddf.EscherRGBProperty'> shadowstyle.color
<type 'org.apache.poi.ddf.EscherComplexProperty'> unknown

As you can see, the last one (the EscherComplexProperty) does not properly
return the propName stored in the property, and the only way that I can get to
this is by using the toString method and parsing the result.

This makes it hard to visit the names of all objects


VBA Macro to set name property on a shape.

Sub NameIt()
  Dim sResponse As String

  With ActiveWindow.Selection.ShapeRange(1)
    sResponse = InputBox("new name ...", "Rename Shape", .Name)
    Select Case sResponse
     ' blank names not allowed
     Case Is = ""
       Exit Sub
     ' no change?
     Case Is = .Name
       Exit Sub
     Case Else
       On Error Resume Next
       .Name = sResponse
       If Err.Number <> 0 Then
         MsgBox "Unable to rename this shape"
       End If
    End Select
  End With

End Sub

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to