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/02 09:38:16 UTC

Rendering Shapes for 2003 excel

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
excel.

Re: Rendering Shapes for 2003 excel

Posted by pratik sharma <sh...@gmail.com>.
I have seen that EscherContainerRecord contains Only 4 Shapes Record, How
to get information about all the shapes?

On Wed, Feb 8, 2012 at 4:09 PM, Pratik <sh...@gmail.com> wrote:

> Thanks for the information about dx1 and dy1.
> Now i can find the Anchor and position of the shapes.
>
> On Tue, Feb 7, 2012 at 2:00 PM, Yegor Kozlov-4 [via Apache POI] <
> ml-node+s1045710n5462516h28@n5.nabble.com> wrote:
>
> > Excel anchores shapes against top-left and buttom-right cells:
> > col1 is the column (0 based) of the first cell
> > col2 is the column (0 based) of the second cell.
> > row1  is the row (0 based) of the first cell.
> > row2 is  the row (0 based) of the second cell.
> >
> > dx1 and dx2 are horizontal offsets within the first and second cells
> > in units of 1/1024 of the cell width. For example,  dx1=256  means
> > that that the anchor is shifted to the 25% of the width of the first
> > cell (256/1024 = 25%).
> >
> > dy1 and dy2 are vertical offsets  within the first and second cells in
> > units of 1/256 of the row height. For example,  dy1=128  means that
> > the anchor is shifted by 50% of the row height of the top cell.
> >
> >
> > Yegor
> >
> > On Mon, Feb 6, 2012 at 3:38 PM, pratik sharma <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5462516&i=0>>
> > wrote:
> >
> > > Hi Yegor any idea how to get an Anchor for Shaps in Excel, i m able to
> > get
> > > all value for eg : col1, Dx1, Row1, Dy1, col2, Dx2, Row2, Dy2.
> > > How to decode these value to get an Anchor of a Shape in Excel.
> > >
> > > On Thu, Feb 2, 2012 at 5:38 PM, Pratik <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5462516&i=1>>
> > wrote:
> > >
> > >> Hey Thanks Yegor Now i m able to get option of the Shape(ShapeType) by
> > >> which i can get Name of the shape.
> > >>
> > >> On Thu, Feb 2, 2012 at 4:24 PM, Yegor Kozlov-4 [via Apache POI] <
> > >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5462516&i=2
> >>
> > wrote:
> > >>
> > >> > On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <[hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=0>>
> > >> > wrote:
> > >> > > Ok fine i can do that by using Child Iterators, but
> > >> > EscherContainerRecord
> > >> > > conatins information of only one shape (first shape) in excel.
> > >> >
> > >> > Wrong. Top-level EscherContainerRecord  contains child containers
> and
> > >> > they can have their own children, etc.. To iterate over shapes you
> > >> > MUST walk the record tree.
> > >> >
> > >> > Print   escherContainer.toString()  and see the records hierarchy.
> > All
> > >> > shapes should be there and you should see how deep you need to walk
> > >> > down to get them.
> > >> >
> > >> > Yegor
> > >> >
> > >> > > you have any idea by which i can get information of n number of
> > shape
> > >> in
> > >> > > excel ?.....onces i can get information for n number of Shapes i
> > can
> > >> > Render
> > >> > > that information using  EscherOptRecord and EscherSpRecord.
> > >> > >
> > >> > > On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <[hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=1>>
> > >> > wrote:
> > >> > >
> > >> > >> Instead of getting the first EscherOpt record with
> findFirstWithId
> > you
> > >> > >> should walk the Escher tree. One example how to that is in
> > >> > >> EscherAggregate#convertRecordsToUserModel:
> > >> > >>
> > >> > >>
> > >> > >>
> > >> >
> > >>
> >
> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
> > >> > >>
> > >> > >> Yegor
> > >> > >>
> > >> > >> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <[hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=2>>
> > >> > wrote:
> > >> > >> > Thanks for the Reply.
> > >> > >> >
> > >> > >> > By using EscherContainerRecord i m able to get a data about the
> > >> > Shape.
> > >> > >> > Data like shapeName (EscherSpRecord) and Shape information
> > >> > >> > (EscherOptRecord).
> > >> > >> >
> > >> > >> > code :
> > >> > >> >
> > >> > >> > EscherAggregate escherAggregate =
> > sheet.getDrawingEscherAggregate();
> > >> > >> >
> > >> > >> >  EscherContainerRecord _escherContainer =
> > >> > >> > escherAggregate.getEscherContainer();
> > >> > >> >
> > >> > >> > EscherOptRecord escherOptRecord = (EscherOptRecord)
> > >> > >> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
> > >> > >> >
> > >> > >> > .............
> > >> > >> >
> > >> > >> > but this is giving me data for only 1 shape in the sheet. is
> > there a
> > >> > way
> > >> > >> in
> > >> > >> > which i can know how many shapes are there in a sheet and can
> > get
> > >> > data
> > >> > >> for
> > >> > >> > all those shape using EscherContainerRecord ?
> > >> > >> >
> > >> > >> >
> > >> > >> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI]
> > <
> > >> > >> > [hidden email] <
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=3>>
> > >> > wrote:
> > >> > >> >
> > >> > >> >> Unfortunately, POI does not fully support reading properties
> of
> > >> > shapes
> > >> > >> >> from binary Excel files (.xls).
> > >> > >> >> This is a rather fundamental limitation of POI-HSSF: it can
> > create
> > >> > >> >> simple drawings from scratch, but cannot modify or read
> > existing
> > >> > ones.
> > >> > >> >>
> > >> > >> >> reading basic shape properties is simple:
> > >> > >> >>
> > >> > >> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> > >> > >> >> for(HSSFShape sh :  drawing.getChildren()){
> > >> > >> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the
> > shape
> > >> on
> > >> > the
> > >> > >> >> sheet
> > >> > >> >>
> > >> > >> >>     if(sh instanceof HSSFTextbox){
> > >> > >> >>      ....
> > >> > >> >>     } else if instanceof HSSFPicture){
> > >> > >> >>     ...
> > >> > >> >>    }
> > >> > >> >> }
> > >> > >> >>
> > >> > >> >> getting adjustment values and formatting (color, border, etc.)
> > is
> > >> > not
> > >> > >> >> supported.
> > >> > >> >>
> > >> > >> >> Yegor
> > >> > >> >>
> > >> > >> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden
> email]<
> > >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> > >> > >> >> 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
> > >> > >> >> > excel.
> > >> > >> >>
> > >> > >> >>
> > >> >
> ---------------------------------------------------------------------
> > >> > >> >> To unsubscribe, e-mail: [hidden email]<
> > >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> > >> > >> >> For additional commands, e-mail: [hidden email]<
> > >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
> > >> > >> >>
> > >> > >> >>
> > >> > >> >>
> > >> > >> >> ------------------------------
> > >> > >> >>  If you reply to this email, your message will be added to the
> > >> > >> discussion
> > >> > >> >> below:
> > >> > >> >>
> > >> > >> >>
> > >> > >>
> > >> >
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
> > >> > >> >>  To unsubscribe from Apache POI, click here<
> > >> > >>
> > >> > >
> > >> > >> >> .
> > >> > >> >> NAML<
> > >> > >>
> > >> >
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >> > >> >
> > >> > >> >>
> > >> > >> >
> > >> > >> >
> > >> > >> > --
> > >> > >> > View this message in context:
> > >> > >>
> > >> >
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> > >> > >> > Sent from the POI - User mailing list archive at Nabble.com.
> > >> > >>
> > >> > >>
> > ---------------------------------------------------------------------
> > >> > >> To unsubscribe, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=4>
> > >> > >> For additional commands, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=5>
> > >> > >>
> > >> > >>
> > >> >
> > >> >
> ---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=6>
> > >> > For additional commands, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450328&i=7>
> > >> >
> > >> >
> > >> >
> > >> > ------------------------------
> > >> >  If you reply to this email, your message will be added to the
> > discussion
> > >> > below:
> > >> >
> > >> >
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450328.html
> > >> >  To unsubscribe from Apache POI, click here<
> > >>
> > >
> > >> > .
> > >> > NAML<
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450451.html
> > >> Sent from the POI - User mailing list archive at Nabble.com.
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5462516&i=3>
> > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5462516&i=4>
> >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5462516.html
> >  To unsubscribe from Apache POI, click here<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==
> >
> > .
> > NAML<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5466174.html
> Sent from the POI - User mailing list archive at Nabble.com.
>

Re: Rendering Shapes for 2003 excel

Posted by Pratik <sh...@gmail.com>.
Thanks for the information about dx1 and dy1.
Now i can find the Anchor and position of the shapes.

On Tue, Feb 7, 2012 at 2:00 PM, Yegor Kozlov-4 [via Apache POI] <
ml-node+s1045710n5462516h28@n5.nabble.com> wrote:

> Excel anchores shapes against top-left and buttom-right cells:
> col1 is the column (0 based) of the first cell
> col2 is the column (0 based) of the second cell.
> row1  is the row (0 based) of the first cell.
> row2 is  the row (0 based) of the second cell.
>
> dx1 and dx2 are horizontal offsets within the first and second cells
> in units of 1/1024 of the cell width. For example,  dx1=256  means
> that that the anchor is shifted to the 25% of the width of the first
> cell (256/1024 = 25%).
>
> dy1 and dy2 are vertical offsets  within the first and second cells in
> units of 1/256 of the row height. For example,  dy1=128  means that
> the anchor is shifted by 50% of the row height of the top cell.
>
>
> Yegor
>
> On Mon, Feb 6, 2012 at 3:38 PM, pratik sharma <[hidden email]<http://user/SendEmail.jtp?type=node&node=5462516&i=0>>
> wrote:
>
> > Hi Yegor any idea how to get an Anchor for Shaps in Excel, i m able to
> get
> > all value for eg : col1, Dx1, Row1, Dy1, col2, Dx2, Row2, Dy2.
> > How to decode these value to get an Anchor of a Shape in Excel.
> >
> > On Thu, Feb 2, 2012 at 5:38 PM, Pratik <[hidden email]<http://user/SendEmail.jtp?type=node&node=5462516&i=1>>
> wrote:
> >
> >> Hey Thanks Yegor Now i m able to get option of the Shape(ShapeType) by
> >> which i can get Name of the shape.
> >>
> >> On Thu, Feb 2, 2012 at 4:24 PM, Yegor Kozlov-4 [via Apache POI] <
> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5462516&i=2>>
> wrote:
> >>
> >> > On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=0>>
> >> > wrote:
> >> > > Ok fine i can do that by using Child Iterators, but
> >> > EscherContainerRecord
> >> > > conatins information of only one shape (first shape) in excel.
> >> >
> >> > Wrong. Top-level EscherContainerRecord  contains child containers and
> >> > they can have their own children, etc.. To iterate over shapes you
> >> > MUST walk the record tree.
> >> >
> >> > Print   escherContainer.toString()  and see the records hierarchy.
> All
> >> > shapes should be there and you should see how deep you need to walk
> >> > down to get them.
> >> >
> >> > Yegor
> >> >
> >> > > you have any idea by which i can get information of n number of
> shape
> >> in
> >> > > excel ?.....onces i can get information for n number of Shapes i
> can
> >> > Render
> >> > > that information using  EscherOptRecord and EscherSpRecord.
> >> > >
> >> > > On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=1>>
> >> > wrote:
> >> > >
> >> > >> Instead of getting the first EscherOpt record with findFirstWithId
> you
> >> > >> should walk the Escher tree. One example how to that is in
> >> > >> EscherAggregate#convertRecordsToUserModel:
> >> > >>
> >> > >>
> >> > >>
> >> >
> >>
> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
> >> > >>
> >> > >> Yegor
> >> > >>
> >> > >> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=2>>
> >> > wrote:
> >> > >> > Thanks for the Reply.
> >> > >> >
> >> > >> > By using EscherContainerRecord i m able to get a data about the
> >> > Shape.
> >> > >> > Data like shapeName (EscherSpRecord) and Shape information
> >> > >> > (EscherOptRecord).
> >> > >> >
> >> > >> > code :
> >> > >> >
> >> > >> > EscherAggregate escherAggregate =
> sheet.getDrawingEscherAggregate();
> >> > >> >
> >> > >> >  EscherContainerRecord _escherContainer =
> >> > >> > escherAggregate.getEscherContainer();
> >> > >> >
> >> > >> > EscherOptRecord escherOptRecord = (EscherOptRecord)
> >> > >> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
> >> > >> >
> >> > >> > .............
> >> > >> >
> >> > >> > but this is giving me data for only 1 shape in the sheet. is
> there a
> >> > way
> >> > >> in
> >> > >> > which i can know how many shapes are there in a sheet and can
> get
> >> > data
> >> > >> for
> >> > >> > all those shape using EscherContainerRecord ?
> >> > >> >
> >> > >> >
> >> > >> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI]
> <
> >> > >> > [hidden email] <
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=3>>
> >> > wrote:
> >> > >> >
> >> > >> >> Unfortunately, POI does not fully support reading properties of
> >> > shapes
> >> > >> >> from binary Excel files (.xls).
> >> > >> >> This is a rather fundamental limitation of POI-HSSF: it can
> create
> >> > >> >> simple drawings from scratch, but cannot modify or read
> existing
> >> > ones.
> >> > >> >>
> >> > >> >> reading basic shape properties is simple:
> >> > >> >>
> >> > >> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> >> > >> >> for(HSSFShape sh :  drawing.getChildren()){
> >> > >> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the
> shape
> >> on
> >> > the
> >> > >> >> sheet
> >> > >> >>
> >> > >> >>     if(sh instanceof HSSFTextbox){
> >> > >> >>      ....
> >> > >> >>     } else if instanceof HSSFPicture){
> >> > >> >>     ...
> >> > >> >>    }
> >> > >> >> }
> >> > >> >>
> >> > >> >> getting adjustment values and formatting (color, border, etc.)
> is
> >> > not
> >> > >> >> supported.
> >> > >> >>
> >> > >> >> Yegor
> >> > >> >>
> >> > >> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
> >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> >> > >> >> 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
> >> > >> >> > excel.
> >> > >> >>
> >> > >> >>
> >> > ---------------------------------------------------------------------
> >> > >> >> To unsubscribe, e-mail: [hidden email]<
> >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> >> > >> >> For additional commands, e-mail: [hidden email]<
> >> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
> >> > >> >>
> >> > >> >>
> >> > >> >>
> >> > >> >> ------------------------------
> >> > >> >>  If you reply to this email, your message will be added to the
> >> > >> discussion
> >> > >> >> below:
> >> > >> >>
> >> > >> >>
> >> > >>
> >> >
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
> >> > >> >>  To unsubscribe from Apache POI, click here<
> >> > >>
> >> > >
> >> > >> >> .
> >> > >> >> NAML<
> >> > >>
> >> >
> >>
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> > >> >
> >> > >> >>
> >> > >> >
> >> > >> >
> >> > >> > --
> >> > >> > View this message in context:
> >> > >>
> >> >
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> >> > >> > Sent from the POI - User mailing list archive at Nabble.com.
> >> > >>
> >> > >>
> ---------------------------------------------------------------------
> >> > >> To unsubscribe, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=4>
> >> > >> For additional commands, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=5>
> >> > >>
> >> > >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=6>
> >> > For additional commands, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450328&i=7>
> >> >
> >> >
> >> >
> >> > ------------------------------
> >> >  If you reply to this email, your message will be added to the
> discussion
> >> > below:
> >> >
> >> >
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450328.html
> >> >  To unsubscribe from Apache POI, click here<
> >>
> >
> >> > .
> >> > NAML<
> >>
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> >
> >> >
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450451.html
> >> Sent from the POI - User mailing list archive at Nabble.com.
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5462516&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5462516&i=4>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5462516.html
>  To unsubscribe from Apache POI, click here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==>
> .
> NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5466174.html
Sent from the POI - User mailing list archive at Nabble.com.

Re: Rendering Shapes for 2003 excel

Posted by Yegor Kozlov <ye...@dinom.ru>.
Excel anchores shapes against top-left and buttom-right cells:
col1 is the column (0 based) of the first cell
col2 is the column (0 based) of the second cell.
row1  is the row (0 based) of the first cell.
row2 is  the row (0 based) of the second cell.

dx1 and dx2 are horizontal offsets within the first and second cells
in units of 1/1024 of the cell width. For example,  dx1=256  means
that that the anchor is shifted to the 25% of the width of the first
cell (256/1024 = 25%).

dy1 and dy2 are vertical offsets  within the first and second cells in
units of 1/256 of the row height. For example,  dy1=128  means that
the anchor is shifted by 50% of the row height of the top cell.


Yegor

On Mon, Feb 6, 2012 at 3:38 PM, pratik sharma <sh...@gmail.com> wrote:
> Hi Yegor any idea how to get an Anchor for Shaps in Excel, i m able to get
> all value for eg : col1, Dx1, Row1, Dy1, col2, Dx2, Row2, Dy2.
> How to decode these value to get an Anchor of a Shape in Excel.
>
> On Thu, Feb 2, 2012 at 5:38 PM, Pratik <sh...@gmail.com> wrote:
>
>> Hey Thanks Yegor Now i m able to get option of the Shape(ShapeType) by
>> which i can get Name of the shape.
>>
>> On Thu, Feb 2, 2012 at 4:24 PM, Yegor Kozlov-4 [via Apache POI] <
>> ml-node+s1045710n5450328h0@n5.nabble.com> wrote:
>>
>> > On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=0>>
>> > wrote:
>> > > Ok fine i can do that by using Child Iterators, but
>> > EscherContainerRecord
>> > > conatins information of only one shape (first shape) in excel.
>> >
>> > Wrong. Top-level EscherContainerRecord  contains child containers and
>> > they can have their own children, etc.. To iterate over shapes you
>> > MUST walk the record tree.
>> >
>> > Print   escherContainer.toString()  and see the records hierarchy. All
>> > shapes should be there and you should see how deep you need to walk
>> > down to get them.
>> >
>> > Yegor
>> >
>> > > you have any idea by which i can get information of n number of shape
>> in
>> > > excel ?.....onces i can get information for n number of Shapes i can
>> > Render
>> > > that information using  EscherOptRecord and EscherSpRecord.
>> > >
>> > > On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=1>>
>> > wrote:
>> > >
>> > >> Instead of getting the first EscherOpt record with findFirstWithId you
>> > >> should walk the Escher tree. One example how to that is in
>> > >> EscherAggregate#convertRecordsToUserModel:
>> > >>
>> > >>
>> > >>
>> >
>> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
>> > >>
>> > >> Yegor
>> > >>
>> > >> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=2>>
>> > wrote:
>> > >> > Thanks for the Reply.
>> > >> >
>> > >> > By using EscherContainerRecord i m able to get a data about the
>> > Shape.
>> > >> > Data like shapeName (EscherSpRecord) and Shape information
>> > >> > (EscherOptRecord).
>> > >> >
>> > >> > code :
>> > >> >
>> > >> > EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
>> > >> >
>> > >> >  EscherContainerRecord _escherContainer =
>> > >> > escherAggregate.getEscherContainer();
>> > >> >
>> > >> > EscherOptRecord escherOptRecord = (EscherOptRecord)
>> > >> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
>> > >> >
>> > >> > .............
>> > >> >
>> > >> > but this is giving me data for only 1 shape in the sheet. is there a
>> > way
>> > >> in
>> > >> > which i can know how many shapes are there in a sheet and can get
>> > data
>> > >> for
>> > >> > all those shape using EscherContainerRecord ?
>> > >> >
>> > >> >
>> > >> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
>> > >> > [hidden email] <
>> http://user/SendEmail.jtp?type=node&node=5450328&i=3>>
>> > wrote:
>> > >> >
>> > >> >> Unfortunately, POI does not fully support reading properties of
>> > shapes
>> > >> >> from binary Excel files (.xls).
>> > >> >> This is a rather fundamental limitation of POI-HSSF: it can create
>> > >> >> simple drawings from scratch, but cannot modify or read existing
>> > ones.
>> > >> >>
>> > >> >> reading basic shape properties is simple:
>> > >> >>
>> > >> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
>> > >> >> for(HSSFShape sh :  drawing.getChildren()){
>> > >> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape
>> on
>> > the
>> > >> >> sheet
>> > >> >>
>> > >> >>     if(sh instanceof HSSFTextbox){
>> > >> >>      ....
>> > >> >>     } else if instanceof HSSFPicture){
>> > >> >>     ...
>> > >> >>    }
>> > >> >> }
>> > >> >>
>> > >> >> getting adjustment values and formatting (color, border, etc.) is
>> > not
>> > >> >> supported.
>> > >> >>
>> > >> >> Yegor
>> > >> >>
>> > >> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
>> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
>> > >> >> 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
>> > >> >> > excel.
>> > >> >>
>> > >> >>
>> > ---------------------------------------------------------------------
>> > >> >> To unsubscribe, e-mail: [hidden email]<
>> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
>> > >> >> For additional commands, e-mail: [hidden email]<
>> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >> ------------------------------
>> > >> >>  If you reply to this email, your message will be added to the
>> > >> discussion
>> > >> >> below:
>> > >> >>
>> > >> >>
>> > >>
>> >
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
>> > >> >>  To unsubscribe from Apache POI, click here<
>> > >>
>> > >
>> > >> >> .
>> > >> >> NAML<
>> > >>
>> >
>> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> > >> >
>> > >> >>
>> > >> >
>> > >> >
>> > >> > --
>> > >> > View this message in context:
>> > >>
>> >
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
>> > >> > Sent from the POI - User mailing list archive at Nabble.com.
>> > >>
>> > >> ---------------------------------------------------------------------
>> > >> To unsubscribe, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=4>
>> > >> For additional commands, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=5>
>> > >>
>> > >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=6>
>> > For additional commands, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450328&i=7>
>> >
>> >
>> >
>> > ------------------------------
>> >  If you reply to this email, your message will be added to the discussion
>> > below:
>> >
>> >
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450328.html
>> >  To unsubscribe from Apache POI, click here<
>> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==
>> >
>> > .
>> > NAML<
>> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >
>> >
>>
>>
>> --
>> View this message in context:
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450451.html
>> Sent from the POI - User mailing list archive at Nabble.com.
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Rendering Shapes for 2003 excel

Posted by pratik sharma <sh...@gmail.com>.
Hi Yegor any idea how to get an Anchor for Shaps in Excel, i m able to get
all value for eg : col1, Dx1, Row1, Dy1, col2, Dx2, Row2, Dy2.
How to decode these value to get an Anchor of a Shape in Excel.

On Thu, Feb 2, 2012 at 5:38 PM, Pratik <sh...@gmail.com> wrote:

> Hey Thanks Yegor Now i m able to get option of the Shape(ShapeType) by
> which i can get Name of the shape.
>
> On Thu, Feb 2, 2012 at 4:24 PM, Yegor Kozlov-4 [via Apache POI] <
> ml-node+s1045710n5450328h0@n5.nabble.com> wrote:
>
> > On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=0>>
> > wrote:
> > > Ok fine i can do that by using Child Iterators, but
> > EscherContainerRecord
> > > conatins information of only one shape (first shape) in excel.
> >
> > Wrong. Top-level EscherContainerRecord  contains child containers and
> > they can have their own children, etc.. To iterate over shapes you
> > MUST walk the record tree.
> >
> > Print   escherContainer.toString()  and see the records hierarchy. All
> > shapes should be there and you should see how deep you need to walk
> > down to get them.
> >
> > Yegor
> >
> > > you have any idea by which i can get information of n number of shape
> in
> > > excel ?.....onces i can get information for n number of Shapes i can
> > Render
> > > that information using  EscherOptRecord and EscherSpRecord.
> > >
> > > On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=1>>
> > wrote:
> > >
> > >> Instead of getting the first EscherOpt record with findFirstWithId you
> > >> should walk the Escher tree. One example how to that is in
> > >> EscherAggregate#convertRecordsToUserModel:
> > >>
> > >>
> > >>
> >
> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
> > >>
> > >> Yegor
> > >>
> > >> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=2>>
> > wrote:
> > >> > Thanks for the Reply.
> > >> >
> > >> > By using EscherContainerRecord i m able to get a data about the
> > Shape.
> > >> > Data like shapeName (EscherSpRecord) and Shape information
> > >> > (EscherOptRecord).
> > >> >
> > >> > code :
> > >> >
> > >> > EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
> > >> >
> > >> >  EscherContainerRecord _escherContainer =
> > >> > escherAggregate.getEscherContainer();
> > >> >
> > >> > EscherOptRecord escherOptRecord = (EscherOptRecord)
> > >> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
> > >> >
> > >> > .............
> > >> >
> > >> > but this is giving me data for only 1 shape in the sheet. is there a
> > way
> > >> in
> > >> > which i can know how many shapes are there in a sheet and can get
> > data
> > >> for
> > >> > all those shape using EscherContainerRecord ?
> > >> >
> > >> >
> > >> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
> > >> > [hidden email] <
> http://user/SendEmail.jtp?type=node&node=5450328&i=3>>
> > wrote:
> > >> >
> > >> >> Unfortunately, POI does not fully support reading properties of
> > shapes
> > >> >> from binary Excel files (.xls).
> > >> >> This is a rather fundamental limitation of POI-HSSF: it can create
> > >> >> simple drawings from scratch, but cannot modify or read existing
> > ones.
> > >> >>
> > >> >> reading basic shape properties is simple:
> > >> >>
> > >> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> > >> >> for(HSSFShape sh :  drawing.getChildren()){
> > >> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape
> on
> > the
> > >> >> sheet
> > >> >>
> > >> >>     if(sh instanceof HSSFTextbox){
> > >> >>      ....
> > >> >>     } else if instanceof HSSFPicture){
> > >> >>     ...
> > >> >>    }
> > >> >> }
> > >> >>
> > >> >> getting adjustment values and formatting (color, border, etc.) is
> > not
> > >> >> supported.
> > >> >>
> > >> >> Yegor
> > >> >>
> > >> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> > >> >> 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
> > >> >> > excel.
> > >> >>
> > >> >>
> > ---------------------------------------------------------------------
> > >> >> To unsubscribe, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> > >> >> For additional commands, e-mail: [hidden email]<
> > >> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
> > >> >>
> > >> >>
> > >> >>
> > >> >> ------------------------------
> > >> >>  If you reply to this email, your message will be added to the
> > >> discussion
> > >> >> below:
> > >> >>
> > >> >>
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
> > >> >>  To unsubscribe from Apache POI, click here<
> > >>
> > >
> > >> >> .
> > >> >> NAML<
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >> >
> > >> >>
> > >> >
> > >> >
> > >> > --
> > >> > View this message in context:
> > >>
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> > >> > Sent from the POI - User mailing list archive at Nabble.com.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=4>
> > >> For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=5>
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=6>
> > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450328&i=7>
> >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450328.html
> >  To unsubscribe from Apache POI, click here<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==
> >
> > .
> > NAML<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450451.html
> Sent from the POI - User mailing list archive at Nabble.com.
>

Re: Rendering Shapes for 2003 excel

Posted by Pratik <sh...@gmail.com>.
Hey Thanks Yegor Now i m able to get option of the Shape(ShapeType) by
which i can get Name of the shape.

On Thu, Feb 2, 2012 at 4:24 PM, Yegor Kozlov-4 [via Apache POI] <
ml-node+s1045710n5450328h0@n5.nabble.com> wrote:

> On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <[hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=0>>
> wrote:
> > Ok fine i can do that by using Child Iterators, but
> EscherContainerRecord
> > conatins information of only one shape (first shape) in excel.
>
> Wrong. Top-level EscherContainerRecord  contains child containers and
> they can have their own children, etc.. To iterate over shapes you
> MUST walk the record tree.
>
> Print   escherContainer.toString()  and see the records hierarchy. All
> shapes should be there and you should see how deep you need to walk
> down to get them.
>
> Yegor
>
> > you have any idea by which i can get information of n number of shape in
> > excel ?.....onces i can get information for n number of Shapes i can
> Render
> > that information using  EscherOptRecord and EscherSpRecord.
> >
> > On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <[hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=1>>
> wrote:
> >
> >> Instead of getting the first EscherOpt record with findFirstWithId you
> >> should walk the Escher tree. One example how to that is in
> >> EscherAggregate#convertRecordsToUserModel:
> >>
> >>
> >>
> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
> >>
> >> Yegor
> >>
> >> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <[hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=2>>
> wrote:
> >> > Thanks for the Reply.
> >> >
> >> > By using EscherContainerRecord i m able to get a data about the
> Shape.
> >> > Data like shapeName (EscherSpRecord) and Shape information
> >> > (EscherOptRecord).
> >> >
> >> > code :
> >> >
> >> > EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
> >> >
> >> >  EscherContainerRecord _escherContainer =
> >> > escherAggregate.getEscherContainer();
> >> >
> >> > EscherOptRecord escherOptRecord = (EscherOptRecord)
> >> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
> >> >
> >> > .............
> >> >
> >> > but this is giving me data for only 1 shape in the sheet. is there a
> way
> >> in
> >> > which i can know how many shapes are there in a sheet and can get
> data
> >> for
> >> > all those shape using EscherContainerRecord ?
> >> >
> >> >
> >> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5450328&i=3>>
> wrote:
> >> >
> >> >> Unfortunately, POI does not fully support reading properties of
> shapes
> >> >> from binary Excel files (.xls).
> >> >> This is a rather fundamental limitation of POI-HSSF: it can create
> >> >> simple drawings from scratch, but cannot modify or read existing
> ones.
> >> >>
> >> >> reading basic shape properties is simple:
> >> >>
> >> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> >> >> for(HSSFShape sh :  drawing.getChildren()){
> >> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape on
> the
> >> >> sheet
> >> >>
> >> >>     if(sh instanceof HSSFTextbox){
> >> >>      ....
> >> >>     } else if instanceof HSSFPicture){
> >> >>     ...
> >> >>    }
> >> >> }
> >> >>
> >> >> getting adjustment values and formatting (color, border, etc.) is
> not
> >> >> supported.
> >> >>
> >> >> Yegor
> >> >>
> >> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> >> >> 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
> >> >> > excel.
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> >> >> For additional commands, e-mail: [hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
> >> >>
> >> >>
> >> >>
> >> >> ------------------------------
> >> >>  If you reply to this email, your message will be added to the
> >> discussion
> >> >> below:
> >> >>
> >> >>
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
> >> >>  To unsubscribe from Apache POI, click here<
> >>
> >
> >> >> .
> >> >> NAML<
> >>
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> >
> >> >>
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> >> > Sent from the POI - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=4>
> >> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=5>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=6>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450328&i=7>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450328.html
>  To unsubscribe from Apache POI, click here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==>
> .
> NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450451.html
Sent from the POI - User mailing list archive at Nabble.com.

Re: Rendering Shapes for 2003 excel

Posted by Yegor Kozlov <ye...@dinom.ru>.
On Thu, Feb 2, 2012 at 2:16 PM, pratik sharma <sh...@gmail.com> wrote:
> Ok fine i can do that by using Child Iterators, but EscherContainerRecord
> conatins information of only one shape (first shape) in excel.

Wrong. Top-level EscherContainerRecord  contains child containers and
they can have their own children, etc.. To iterate over shapes you
MUST walk the record tree.

Print   escherContainer.toString()  and see the records hierarchy. All
shapes should be there and you should see how deep you need to walk
down to get them.

Yegor

> you have any idea by which i can get information of n number of shape in
> excel ?.....onces i can get information for n number of Shapes i can Render
> that information using  EscherOptRecord and EscherSpRecord.
>
> On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <ye...@dinom.ru> wrote:
>
>> Instead of getting the first EscherOpt record with findFirstWithId you
>> should walk the Escher tree. One example how to that is in
>> EscherAggregate#convertRecordsToUserModel:
>>
>>
>> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
>>
>> Yegor
>>
>> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <sh...@gmail.com> wrote:
>> > Thanks for the Reply.
>> >
>> > By using EscherContainerRecord i m able to get a data about the Shape.
>> > Data like shapeName (EscherSpRecord) and Shape information
>> > (EscherOptRecord).
>> >
>> > code :
>> >
>> > EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
>> >
>> >  EscherContainerRecord _escherContainer =
>> > escherAggregate.getEscherContainer();
>> >
>> > EscherOptRecord escherOptRecord = (EscherOptRecord)
>> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
>> >
>> > .............
>> >
>> > but this is giving me data for only 1 shape in the sheet. is there a way
>> in
>> > which i can know how many shapes are there in a sheet and can get data
>> for
>> > all those shape using EscherContainerRecord ?
>> >
>> >
>> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
>> > ml-node+s1045710n5450079h81@n5.nabble.com> wrote:
>> >
>> >> Unfortunately, POI does not fully support reading properties of shapes
>> >> from binary Excel files (.xls).
>> >> This is a rather fundamental limitation of POI-HSSF: it can create
>> >> simple drawings from scratch, but cannot modify or read existing ones.
>> >>
>> >> reading basic shape properties is simple:
>> >>
>> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
>> >> for(HSSFShape sh :  drawing.getChildren()){
>> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape on the
>> >> sheet
>> >>
>> >>     if(sh instanceof HSSFTextbox){
>> >>      ....
>> >>     } else if instanceof HSSFPicture){
>> >>     ...
>> >>    }
>> >> }
>> >>
>> >> getting adjustment values and formatting (color, border, etc.) is not
>> >> supported.
>> >>
>> >> Yegor
>> >>
>> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
>> >> 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
>> >> > excel.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
>> >> For additional commands, e-mail: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
>> >>
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
>> >>  To unsubscribe from Apache POI, click here<
>> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==
>> >
>> >> .
>> >> NAML<
>> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >
>> >>
>> >
>> >
>> > --
>> > View this message in context:
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
>> > Sent from the POI - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Rendering Shapes for 2003 excel

Posted by pratik sharma <sh...@gmail.com>.
Ok fine i can do that by using Child Iterators, but EscherContainerRecord
conatins information of only one shape (first shape) in excel.
you have any idea by which i can get information of n number of shape in
excel ?.....onces i can get information for n number of Shapes i can Render
that information using  EscherOptRecord and EscherSpRecord.

On Thu, Feb 2, 2012 at 3:36 PM, Yegor Kozlov <ye...@dinom.ru> wrote:

> Instead of getting the first EscherOpt record with findFirstWithId you
> should walk the Escher tree. One example how to that is in
> EscherAggregate#convertRecordsToUserModel:
>
>
> http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
>
> Yegor
>
> On Thu, Feb 2, 2012 at 1:47 PM, Pratik <sh...@gmail.com> wrote:
> > Thanks for the Reply.
> >
> > By using EscherContainerRecord i m able to get a data about the Shape.
> > Data like shapeName (EscherSpRecord) and Shape information
> > (EscherOptRecord).
> >
> > code :
> >
> > EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
> >
> >  EscherContainerRecord _escherContainer =
> > escherAggregate.getEscherContainer();
> >
> > EscherOptRecord escherOptRecord = (EscherOptRecord)
> > escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
> >
> > .............
> >
> > but this is giving me data for only 1 shape in the sheet. is there a way
> in
> > which i can know how many shapes are there in a sheet and can get data
> for
> > all those shape using EscherContainerRecord ?
> >
> >
> > On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
> > ml-node+s1045710n5450079h81@n5.nabble.com> wrote:
> >
> >> Unfortunately, POI does not fully support reading properties of shapes
> >> from binary Excel files (.xls).
> >> This is a rather fundamental limitation of POI-HSSF: it can create
> >> simple drawings from scratch, but cannot modify or read existing ones.
> >>
> >> reading basic shape properties is simple:
> >>
> >> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> >> for(HSSFShape sh :  drawing.getChildren()){
> >>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape on the
> >> sheet
> >>
> >>     if(sh instanceof HSSFTextbox){
> >>      ....
> >>     } else if instanceof HSSFPicture){
> >>     ...
> >>    }
> >> }
> >>
> >> getting adjustment values and formatting (color, border, etc.) is not
> >> supported.
> >>
> >> Yegor
> >>
> >> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> >> 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
> >> > excel.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> >> For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5450079&i=2>
> >>
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
> >>  To unsubscribe from Apache POI, click here<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==
> >
> >> .
> >> NAML<
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >
> >
> > --
> > View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> > Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: Rendering Shapes for 2003 excel

Posted by Yegor Kozlov <ye...@dinom.ru>.
Instead of getting the first EscherOpt record with findFirstWithId you
should walk the Escher tree. One example how to that is in
EscherAggregate#convertRecordsToUserModel:

http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java

Yegor

On Thu, Feb 2, 2012 at 1:47 PM, Pratik <sh...@gmail.com> wrote:
> Thanks for the Reply.
>
> By using EscherContainerRecord i m able to get a data about the Shape.
> Data like shapeName (EscherSpRecord) and Shape information
> (EscherOptRecord).
>
> code :
>
> EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();
>
>  EscherContainerRecord _escherContainer =
> escherAggregate.getEscherContainer();
>
> EscherOptRecord escherOptRecord = (EscherOptRecord)
> escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
>
> .............
>
> but this is giving me data for only 1 shape in the sheet. is there a way in
> which i can know how many shapes are there in a sheet and can get data for
> all those shape using EscherContainerRecord ?
>
>
> On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
> ml-node+s1045710n5450079h81@n5.nabble.com> wrote:
>
>> Unfortunately, POI does not fully support reading properties of shapes
>> from binary Excel files (.xls).
>> This is a rather fundamental limitation of POI-HSSF: it can create
>> simple drawings from scratch, but cannot modify or read existing ones.
>>
>> reading basic shape properties is simple:
>>
>> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
>> for(HSSFShape sh :  drawing.getChildren()){
>>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape on the
>> sheet
>>
>>     if(sh instanceof HSSFTextbox){
>>      ....
>>     } else if instanceof HSSFPicture){
>>     ...
>>    }
>> }
>>
>> getting adjustment values and formatting (color, border, etc.) is not
>> supported.
>>
>> Yegor
>>
>> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
>> 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
>> > excel.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=1>
>> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=2>
>>
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
>>  To unsubscribe from Apache POI, click here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==>
>> .
>> NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
> Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Rendering Shapes for 2003 excel

Posted by Pratik <sh...@gmail.com>.
Thanks for the Reply.

By using EscherContainerRecord i m able to get a data about the Shape.
Data like shapeName (EscherSpRecord) and Shape information
(EscherOptRecord).

code :

EscherAggregate escherAggregate = sheet.getDrawingEscherAggregate();

 EscherContainerRecord _escherContainer =
escherAggregate.getEscherContainer();

EscherOptRecord escherOptRecord = (EscherOptRecord)
escherAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);

.............

but this is giving me data for only 1 shape in the sheet. is there a way in
which i can know how many shapes are there in a sheet and can get data for
all those shape using EscherContainerRecord ?


On Thu, Feb 2, 2012 at 2:36 PM, Yegor Kozlov-4 [via Apache POI] <
ml-node+s1045710n5450079h81@n5.nabble.com> wrote:

> Unfortunately, POI does not fully support reading properties of shapes
> from binary Excel files (.xls).
> This is a rather fundamental limitation of POI-HSSF: it can create
> simple drawings from scratch, but cannot modify or read existing ones.
>
> reading basic shape properties is simple:
>
> HSSFPatriarch drawing = sheet.getDrawingPatriarch();
> for(HSSFShape sh :  drawing.getChildren()){
>      HSSFAnchor anchor = sh.getAnchor(); // position of the shape on the
> sheet
>
>     if(sh instanceof HSSFTextbox){
>      ....
>     } else if instanceof HSSFPicture){
>     ...
>    }
> }
>
> getting adjustment values and formatting (color, border, etc.) is not
> supported.
>
> Yegor
>
> On Thu, Feb 2, 2012 at 12:38 PM, pratik sharma <[hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=0>>
> 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
> > excel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=1>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5450079&i=2>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450079.html
>  To unsubscribe from Apache POI, click here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2280728&code=c2hhcm1wcmF0aWtAZ21haWwuY29tfDIyODA3Mjh8LTg1MjcxMjcyMw==>
> .
> NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Rendering-Shapes-for-2003-excel-tp5450023p5450172.html
Sent from the POI - User mailing list archive at Nabble.com.

Re: Rendering Shapes for 2003 excel

Posted by Yegor Kozlov <ye...@dinom.ru>.
Unfortunately, POI does not fully support reading properties of shapes
from binary Excel files (.xls).
This is a rather fundamental limitation of POI-HSSF: it can create
simple drawings from scratch, but cannot modify or read existing ones.

reading basic shape properties is simple:

HSSFPatriarch drawing = sheet.getDrawingPatriarch();
for(HSSFShape sh :  drawing.getChildren()){
     HSSFAnchor anchor = sh.getAnchor(); // position of the shape on the sheet

    if(sh instanceof HSSFTextbox){
     ....
    } else if instanceof HSSFPicture){
    ...
   }
}

getting adjustment values and formatting (color, border, etc.) is not
supported.

Yegor

On Thu, Feb 2, 2012 at 12:38 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
> excel.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org