poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <yegor.koz...@dinom.ru>
Subject Re: Excel 97 - How to get get text zones from a Sheet
Date Wed, 20 Jun 2012 10:26:25 GMT
The text is empty becase HSSF does not fully read existing drawing
objects from sheets. POI can create new drawings from scratch but
cannotfully  read and modify existing ones.
 It is an old and known limitation and we are working to improve this
area, but for now you can only read basic shape properties.


Yegor

On Wed, Jun 20, 2012 at 2:06 PM, Denis Delangle
<denis.delangle.ml@gmail.com> wrote:
> Thanks for your quick answer,
>
> I tried this code with this file  :
> for(HSSFShape shape : wb.getSheetAt(1).getDrawingPatriarch().getChildren()) {
>                        System.out.println(">> " + shape.toString());
>                        if(shape instanceof HSSFTextbox) {
>                                HSSFTextbox txtBox = (HSSFTextbox) shape;
>                                System.out.println("-- "+txtBox.getString().length()
+
> txtBox.getString().toString());
>                        }
>
>                }
>
> But the text is always empty :
>>> org.apache.poi.hssf.usermodel.HSSFTextbox@61542a75
> -- 0
>
> Any idea why ?
>
> Denis
>
> 2012/6/20 Yegor Kozlov <yegor.kozlov@dinom.ru>:
>> Try to iterate over shapes in sheet.getDrawingPatriarch().getChildren().
>> Check if a object is HSSFTextbox and then retrive its position via
>> shape.getAnchor().
>>
>> Yegor
>>
>> On Wed, Jun 20, 2012 at 12:21 PM, Denis Delangle
>> <denis.delangle.ml@gmail.com> wrote:
>>> Hello,
>>>
>>> First of all I am an happy user of POI (using it intensively during
>>> last 2 years on various Excel files to extract data) stuck for the
>>> first time. So thanks for this nice peace of software.
>>>
>>> I would like to extract text zones from my Excel file but I really
>>> need to know to which sheet the text zone belongs to.
>>>
>>> I tried this method to get all the text zones from a workbook using
>>> TextObjectRecord and HSSFRequest :
>>> http://article.gmane.org/gmane.comp.jakarta.poi.user/8549/match=textobjectrecord
>>> But I don't have sheet information.
>>>
>>> Do you know if there is a way to get it ?
>>>
>>> Regards,
>>>
>>> Denis
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message