You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Rafael Paiva <ra...@coralsoftware.net> on 2009/12/02 19:26:45 UTC

Text Substitution for Word 2007 in POI 3.5

I assume it's not available. Any plans for having this back on 3.6? Any
undocumented workaround for 3.5?

 

Thanks!

 

Rafael.


Re: Text Substitution for Word 2007 in POI 3.5

Posted by MSB <ma...@tiscali.co.uk>.
Sorry to say Rafael that I am not sure what it is that you are asking. I have
just a a very quick - cursory - glance at the javadoc for the XWPFRun class
and it is possible to call methods that will recover the text the run
contains and to set the text it ought to encapsulate. Would it not be
possible to recover the text, use Java's String handling capabilities to
search for and replace text and then re-set the runs text?

Yours

Mark B


Rafael Paiva wrote:
> 
> I assume it's not available. Any plans for having this back on 3.6? Any
> undocumented workaround for 3.5?
> 
>  
> 
> Thanks!
> 
>  
> 
> Rafael.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Text-Substitution-for-Word-2007-in-POI-3.5-tp26624595p26630321.html
Sent from the POI - Dev mailing list archive at Nabble.com.


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


Re: Text Substitution for Word 2007 in POI 3.5

Posted by MSB <ma...@tiscali.co.uk>.
.........and that will not work because there is no way to recover the runs
from the paragraphs or from the document for that matter. So, without
digging deeply into the structure of the docx file via the various beans or
patching the API so that you can perfrom search and replace operations, I
think you have two options.

Assuming that it was possible to perform these operations using an earlier
version of the API, then it may be best to revert to using that version for
now. Secondly, and far, far more risky, would be to use Java code to simply
unzip the docx file, to open document.xml, search for and replace the
specific items of text, resave the file and, finally, re-zip it. This does
pose a number of risks however and it is certainly not something I would
consider lightly but I do know that it is possible because I played around
with a docx file today in exactly that manner.

Yours

Mark B


Rafael Paiva wrote:
> 
> I assume it's not available. Any plans for having this back on 3.6? Any
> undocumented workaround for 3.5?
> 
>  
> 
> Thanks!
> 
>  
> 
> Rafael.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Text-Substitution-for-Word-2007-in-POI-3.5-tp26624595p26635931.html
Sent from the POI - Dev mailing list archive at Nabble.com.


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