You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by ma...@sdm.de on 2007/07/31 17:24:58 UTC

Excel: linebreaks in cells

Hello everybody,

is it possible to tell a HSSFCell that its content should not extend into the next cell but use multiple lines inside the cell as you can do it in Excel?

Greetings form Germany
Matthias

Re: Excel: linebreaks in cells

Posted by Richard Cote <rc...@ebi.ac.uk>.
Luciano Greiner wrote:
> I've got the same problem... when trying to insert strings with line
> breaks it just cut text and show just the part the fits in column.
> 
> Thanks
> 
> On 7/31/07, matthias.sondermann@sdm.de <ma...@sdm.de> wrote:
>> Hello everybody,
>>
>> is it possible to tell a HSSFCell that its content should not extend into the next cell but use multiple lines inside the cell as you can do it in Excel?
>>

HSSFWorkbook wb = new HSSFWorkbook();
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);

HSSFSheet sheet = wb.createSheet();
HSSFRow row = row = sheet.createRow((short)0);
HSSFCell cell = row.createCell((short)0)
cell.setCellStyle(cellStyle);
cell.setCellValue(
   new HSSFRichTextString(" Line 1 \n Line2 ");
);

Will produce a cell where the text will wrap at the line break.

Cheers,
Rc
-- 
Richard Cote
Software Engineer - PRIDE Project Team (Sequence Database Group)
European Bioinformatics Institute
Wellcome Trust Genome Campus                 rcote@ebi.ac.uk
Hinxton, Cambridge CB10 1SD                  Phone: (+44) 1223 492610
United Kingdom                               Fax  : (+44) 1223 494468

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


Re: Excel: linebreaks in cells

Posted by Luciano Greiner <lu...@gmail.com>.
I've got the same problem... when trying to insert strings with line
breaks it just cut text and show just the part the fits in column.

Thanks

On 7/31/07, matthias.sondermann@sdm.de <ma...@sdm.de> wrote:
> Hello everybody,
>
> is it possible to tell a HSSFCell that its content should not extend into the next cell but use multiple lines inside the cell as you can do it in Excel?
>
> Greetings form Germany
> Matthias
>


-- 
Luciano Greiner

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