You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Bart Jenkins <ba...@mac.com> on 2013/03/07 23:33:38 UTC

What is the POI XWPF api call to set a column width to FIXED?

All,
  In Word (version 2010 at least), after one creates a table of n columns, one can hi-light a column, right-click and select Auto Fit and set the width to FIXED.  The other 2 choices on column widths are: 

Auto Fit to Contents
Auto Fit to Window 

The one POI API call I'm looking for is the one that will do:

Fixed Column Width (in the Auto Fit menu item).

That way, if I have a column that I have sized to be 1 inch wide, but try to stick a 2 inch wide piece of text (that has NO spaces in it), the text will automatically wrap and stay within the 1 inch width restriction.  If I DONT have this set, the column width will resize to 2 inches to fit the text.

Can anyone help here?

Thanks

Bart

Re: What is the POI XWPF api call to set a column width to FIXED?

Posted by Bart Jenkins <ba...@mac.com>.
Yep.  That's the plan!

Thanks

Bart
On Mar 8, 2013, at 7:10 AM, Nick Burch <ap...@gagravarr.org> wrote:

> On Thu, 7 Mar 2013, Bart Jenkins wrote:
>> In Word (version 2010 at least), after one creates a table of n columns, one can hi-light a column, right-click and select Auto Fit and set the width to FIXED.  The other 2 choices on column widths are:
>> 
>> Auto Fit to Contents
>> Auto Fit to Window
>> 
>> The one POI API call I'm looking for is the one that will do:
> 
> As no-one has replied with an answer, I'll give you some advice on how you can work it out for yourself. The main thing to know is that with XWPF, the .docx file format is a zip file of xml files.
> 
> So, what you'll want to do is create a simple file with a small table, with some dummy text, and save that. Then, have word change the table as you want, and save that. Next, unzip both files, and compare the xml.
> 
> From there, you should be able to find out what the xml change is for that. Now, you can get the low level CT xmlbeans objects from POI, and make those changes. Finally, please wrap that up in some nice usermodel XWPF code, and submit a patch :)
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


Re: What is the POI XWPF api call to set a column width to FIXED?

Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 7 Mar 2013, Bart Jenkins wrote:
> In Word (version 2010 at least), after one creates a table of n columns, 
> one can hi-light a column, right-click and select Auto Fit and set the 
> width to FIXED.  The other 2 choices on column widths are:
>
> Auto Fit to Contents
> Auto Fit to Window
>
> The one POI API call I'm looking for is the one that will do:

As no-one has replied with an answer, I'll give you some advice on how you 
can work it out for yourself. The main thing to know is that with XWPF, 
the .docx file format is a zip file of xml files.

So, what you'll want to do is create a simple file with a small table, 
with some dummy text, and save that. Then, have word change the table as 
you want, and save that. Next, unzip both files, and compare the xml.

>From there, you should be able to find out what the xml change is for 
that. Now, you can get the low level CT xmlbeans objects from POI, and 
make those changes. Finally, please wrap that up in some nice usermodel 
XWPF code, and submit a patch :)

Nick

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