You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mathieu Grosmaire <ma...@gmail.com> on 2008/06/03 18:00:05 UTC

HSLF style crashes due to '\n' in the first RichTextRun

Hello

This problem occurs only on one condition, '\n' needs to be the last
character in the first RichTextRun.

Error sample code :

	SlideShow ppt = new SlideShow();
			
	Slide s = ppt.createSlide();
	TextBox tb = new TextBox();
	TextRun tr = tb.createTextRun();
			
	tb.setAnchor(new Rectangle(10,10,500,20));
	
	tr.getRichTextRuns()[0].setText("hello\n");
	tr.getRichTextRuns()[0].setFontName("Calibri");
	tr.getRichTextRuns()[0].setFontSize(12);
	
	RichTextRun rtr = tr.appendText("world");
	rtr.setFontName("Times New Roman");
	rtr.setFontSize(12);
		
	s.addShape(tb);
	
	FileOutputStream out = new FileOutputStream("report/slideshow.ppt");
	ppt.write(out);
	out.close();

Running sample code :

	SlideShow ppt = new SlideShow();
			
	Slide s = ppt.createSlide();
	TextBox tb = new TextBox();
	TextRun tr = tb.createTextRun();
			
	tb.setAnchor(new Rectangle(10,10,500,20));
	
	tr.getRichTextRuns()[0].setText("hello\n ");
	tr.getRichTextRuns()[0].setFontName("Calibri");
	tr.getRichTextRuns()[0].setFontSize(12);
	
	RichTextRun rtr = tr.appendText("world");
	rtr.setFontName("Times New Roman");
	rtr.setFontSize(12);
		
	s.addShape(tb);
	
	FileOutputStream out = new FileOutputStream("report/slideshow.ppt");
	ppt.write(out);
	out.close();


Regards
MG
-- 
View this message in context: http://www.nabble.com/HSLF-style-crashes-due-to-%27%5Cn%27-in-the-first-RichTextRun-tp17627089p17627089.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 style crashes due to '\n' in the first RichTextRun

Posted by Yegor Kozlov <ye...@dinom.ru>.
Thanks, I confirmed the bug.
It seems to be related to https://issues.apache.org/bugzilla/show_bug.cgi?id=45088

Yegor

> Hello

> This problem occurs only on one condition, '\n' needs to be the last
> character in the first RichTextRun.

> Error sample code :

>         SlideShow ppt = new SlideShow();
>                         
>         Slide s = ppt.createSlide();
>         TextBox tb = new TextBox();
>         TextRun tr = tb.createTextRun();
>                         
>         tb.setAnchor(new Rectangle(10,10,500,20));
>         
>         tr.getRichTextRuns()[0].setText("hello\n");
>         tr.getRichTextRuns()[0].setFontName("Calibri");
>         tr.getRichTextRuns()[0].setFontSize(12);
>         
>         RichTextRun rtr = tr.appendText("world");
>         rtr.setFontName("Times New Roman");
>         rtr.setFontSize(12);
>                 
>         s.addShape(tb);
>         
>         FileOutputStream out = new
> FileOutputStream("report/slideshow.ppt");
>         ppt.write(out);
>         out.close();

> Running sample code :

>         SlideShow ppt = new SlideShow();
>                         
>         Slide s = ppt.createSlide();
>         TextBox tb = new TextBox();
>         TextRun tr = tb.createTextRun();
>                         
>         tb.setAnchor(new Rectangle(10,10,500,20));
>         
>         tr.getRichTextRuns()[0].setText("hello\n ");
>         tr.getRichTextRuns()[0].setFontName("Calibri");
>         tr.getRichTextRuns()[0].setFontSize(12);
>         
>         RichTextRun rtr = tr.appendText("world");
>         rtr.setFontName("Times New Roman");
>         rtr.setFontSize(12);
>                 
>         s.addShape(tb);
>         
>         FileOutputStream out = new
> FileOutputStream("report/slideshow.ppt");
>         ppt.write(out);
>         out.close();


> Regards
> MG


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