You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by MSB <ma...@tiscali.co.uk> on 2009/06/10 18:22:12 UTC

Re: insert data into different textboxes using HWPF

Off of the top of my head, no I cannot offer you any Java code that will
accomplish this task but may be able to point you in the right direction.

I do not know if this is the case, but I would expect a textbox to be
considered a shape. There is a method defined on the HWPFDocument class
called getShapesTable() that returns an instance of the ShapesTable class
from which you can get a List of the Shapes in the document by calling the
getAllShapes() or getVisibleShapes() methods. I have never tried this so do
not know if it will work; even then you may be faced with the problem of
distinguishing a specific textbox from all of the others in the document.

Can I ask what control you have over the template? Could you insert
placeholders - bookmarks in effect - into the textboxes? If so, then you can
simply use the replaceText() methods that are defined on the Range class. To
be sure that you preserve any formatting that may be applied to the
placeholder, you will most likely need to recover it as an instance of the
CharacterRun class; this is a subclass of Range so should be easy enough to
do.

Hope that helps.

Yours

Mark B


tapaswini wrote:
> 
> i want to insert different data into different textboxes of wordTemplate
> using HWPF doccument.can some body help me?????????:working:
> 

-- 
View this message in context: http://www.nabble.com/insert-data-into-different-textboxes-using-HWPF-tp23960543p23965914.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: insert data into different textboxes using HWPF

Posted by tapaswini <ta...@zinniasystems.com>.
Thanks Mark for your suggestion.
I am able to get the Shape objects but problem is there is no method to set
the text in the shape object. 

Also, I am not able to get the correct Range object for the area inside the
textbox. Please let me know how can I refer to the area inside a textbox so
that I can modify the text. 

I have full control over the template and can create placeholders. But I am
not able to modify a piece of text which is inside a textbox. 

Any suggestion will be very helpful.

Regards,
Tapaswini


MSB wrote:
> 
> Off of the top of my head, no I cannot offer you any Java code that will
> accomplish this task but may be able to point you in the right direction.
> 
> I do not know if this is the case, but I would expect a textbox to be
> considered a shape. There is a method defined on the HWPFDocument class
> called getShapesTable() that returns an instance of the ShapesTable class
> from which you can get a List of the Shapes in the document by calling the
> getAllShapes() or getVisibleShapes() methods. I have never tried this so
> do not know if it will work; even then you may be faced with the problem
> of distinguishing a specific textbox from all of the others in the
> document.
> 
> Can I ask what control you have over the template? Could you insert
> placeholders - bookmarks in effect - into the textboxes? If so, then you
> can simply use the replaceText() methods that are defined on the Range
> class. To be sure that you preserve any formatting that may be applied to
> the placeholder, you will most likely need to recover it as an instance of
> the CharacterRun class; this is a subclass of Range so should be easy
> enough to do.
> 
> Hope that helps.
> 
> Yours
> 
> Mark B
> 
> 
> tapaswini wrote:
>> 
>> i want to insert different data into different textboxes of wordTemplate
>> using HWPF doccument.can some body help me?????????:working:
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/insert-data-into-different-textboxes-using-HWPF-tp23960543p23978832.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