You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2008/08/01 09:19:35 UTC
Re: HSLF : help, change indentation on TableCell
I'm not sure quite what you're after.
Creation of multiple indentation levels within a TextRun is not yet supported.
RichTextRun.setIndentLevel() should work and set indent for the whole cell.
Yegor
> Hello
>
> It is possible to change default indentation on TableCell when contents
> take more than one line in the shape?
>
> Sample code :
>
> SlideShow ppt = new SlideShow();
> Slide slide = ppt.createSlide();
>
> Table table = new Table(4,4);
> int width = 50;
> int height = 15;
> TableCell cell = null;
> for( int i = 0 ; i < table.getNumberOfRows() ; i++)
> {
> table.setRowHeight(i, height);
> for( int j = 0 ; j < table.getNumberOfColumns() ; j++)
> {
> table.setColumnWidth(j, width);
> cell = table.getCell(i, j);
>
> Rectangle rect = cell.getAnchor();
> rect.setFrame(table.getAnchor().getX() + rect.getX() ,
> table.getAnchor().getY() +
> rect.getY() , width , height);
> cell.setAnchor(rect);
>
> RichTextRun r = cell.getTextRun().getRichTextRuns()[0];
> r.setText("helloworld");
> r.setFontName("Arial");
> r.setFontSize(10);
> r.setIndentLevel(0);
> }
> }
> slide.addShape(table);
>
> Regards
> Mathieu Grosmaire
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: HSLF : help, change indentation on TableCell
Posted by Mathieu Grosmaire <ma...@digimind.com>.
Thank you. It simplify greatly my algorithme.
--
View this message in context: http://www.nabble.com/HSLF-%3A-help%2C-change-indentation-on-TableCell-tp18689162p18773105.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: HSLF : help, change indentation on TableCell
Posted by Yegor Kozlov <ye...@dinom.ru>.
Try RichTextRun.setTextOffset(0);
BTW, setRowHeight and setColumnWidth are not meant to be called every time you inserting a cell.
These methods should be called after the table is created:
SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
Table table = new Table(4, 4);
int width = 50;
int height = 35;
TableCell cell = null;
for (int i = 0; i < table.getNumberOfRows(); i++) {
for (int j = 0; j < table.getNumberOfColumns(); j++) {
cell = table.getCell(i, j);
RichTextRun r = cell.getTextRun().getRichTextRuns()[0];
r.setText("helloworld");
r.setFontName("Arial");
r.setFontSize(10);
r.setTextOffset(0);
}
}
table.setAllBorders(new Line());
slide.addShape(table);
//set table dimensions
for (int i = 0; i < table.getNumberOfRows(); i++) table.setRowHeight(i, height);
for (int i = 0; i < table.getNumberOfColumns(); i++) table.setColumnWidth(i, width);
Regards,
Yegor
> I want to remove the marge which appears from second line when a text is
> splitted on several lines in a cell.
>
> Mathieu
>
>
> Yegor Kozlov wrote:
>> I'm not sure quite what you're after.
>>
>> Creation of multiple indentation levels within a TextRun is not yet
>> supported.
>> RichTextRun.setIndentLevel() should work and set indent for the whole
>> cell.
>>
>> Yegor
>>
>>> Hello
>>>
>>> It is possible to change default indentation on TableCell when
>>> contents
>>> take more than one line in the shape?
>>>
>>> Sample code :
>>>
>>> SlideShow ppt = new SlideShow();
>>> Slide slide = ppt.createSlide();
>>>
>>> Table table = new Table(4,4);
>>> int width = 50;
>>> int height = 15;
>>> TableCell cell = null;
>>> for( int i = 0 ; i < table.getNumberOfRows() ; i++)
>>> {
>>> table.setRowHeight(i, height);
>>> for( int j = 0 ; j < table.getNumberOfColumns() ; j++)
>>> {
>>> table.setColumnWidth(j, width);
>>> cell = table.getCell(i, j);
>>>
>>> Rectangle rect = cell.getAnchor();
>>> rect.setFrame(table.getAnchor().getX() + rect.getX() ,
>>> table.getAnchor().getY() +
>>> rect.getY() , width , height);
>>> cell.setAnchor(rect);
>>>
>>> RichTextRun r = cell.getTextRun().getRichTextRuns()[0];
>>> r.setText("helloworld");
>>> r.setFontName("Arial");
>>> r.setFontSize(10);
>>> r.setIndentLevel(0);
>>> }
>>> }
>>> slide.addShape(table);
>>>
>>> Regards
>>> Mathieu Grosmaire
>>
>> ---------------------------------------------------------------------
>> 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: HSLF : help, change indentation on TableCell
Posted by Mathieu Grosmaire <ma...@digimind.com>.
I want to remove the marge which appears from second line when a text is
splitted on several lines in a cell.
Mathieu
Yegor Kozlov wrote:
>
> I'm not sure quite what you're after.
>
> Creation of multiple indentation levels within a TextRun is not yet
> supported.
> RichTextRun.setIndentLevel() should work and set indent for the whole
> cell.
>
> Yegor
>
>> Hello
>>
>> It is possible to change default indentation on TableCell when
>> contents
>> take more than one line in the shape?
>>
>> Sample code :
>>
>> SlideShow ppt = new SlideShow();
>> Slide slide = ppt.createSlide();
>>
>> Table table = new Table(4,4);
>> int width = 50;
>> int height = 15;
>> TableCell cell = null;
>> for( int i = 0 ; i < table.getNumberOfRows() ; i++)
>> {
>> table.setRowHeight(i, height);
>> for( int j = 0 ; j < table.getNumberOfColumns() ; j++)
>> {
>> table.setColumnWidth(j, width);
>> cell = table.getCell(i, j);
>>
>> Rectangle rect = cell.getAnchor();
>> rect.setFrame(table.getAnchor().getX() + rect.getX() ,
>> table.getAnchor().getY() +
>> rect.getY() , width , height);
>> cell.setAnchor(rect);
>>
>> RichTextRun r = cell.getTextRun().getRichTextRuns()[0];
>> r.setText("helloworld");
>> r.setFontName("Arial");
>> r.setFontSize(10);
>> r.setIndentLevel(0);
>> }
>> }
>> slide.addShape(table);
>>
>> Regards
>> Mathieu Grosmaire
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/HSLF-%3A-help%2C-change-indentation-on-TableCell-tp18689162p18770077.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