You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by pratik sharma <sh...@gmail.com> on 2012/02/08 11:50:16 UTC

Rendering Shape for 2003 Word Documents

Hi i am looking for a sample code to Render Shape and get data about the
Shape (Data like Shape Name, Adjustment value, height, width etc) for 2003
Word.

ShapesTable file under hwpf package is not giving any information about
shapes.
it will be useful if someone tell me how to get EscherContainerRecord.

Thanks in Advance.

Re: Rendering Shape for 2003 Word Documents

Posted by pratik sharma <sh...@gmail.com>.
Answer:

In HWPFDocument.java file you will get _dgg container object, make use of
this object to get information about the shapes in Word 2003

sample code:

List<EscherRecord> escherRecords = _dgg.getEscherRecords();
if(escherRecords.get(1).getChildRecords() != null )
{
      Iterator<EscherRecord> iterator =
escherRecords.get(1).getChildRecords().iterator();
       while(iterator.hasNext())
        {
            EscherRecord escherRecord = iterator.next(); //In escherRecord
you will get all Types of EscherRecord (Dgg, Sp, Opt, ClientAnchor), if not
then check

// child  and iterate Again.
        }
}

you can get all information about the shape, Information like shapeName,
fillColor, Linecolor, Rotation, Adjustment Value etc.


On Wed, Feb 8, 2012 at 4:20 PM, pratik sharma <sh...@gmail.com> wrote:

> Hi i am looking for a sample code to Render Shape and get data about the
> Shape (Data like Shape Name, Adjustment value, height, width etc) for 2003
> Word.
>
> ShapesTable file under hwpf package is not giving any information about
> shapes.
> it will be useful if someone tell me how to get EscherContainerRecord.
>
> Thanks in Advance.
>