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/05/29 08:24:36 UTC

Re[2]: HSLF accent character problem

Use unicode notation. Your Java code should look something like this:

     tb.setText("Helloworld \u00e0 u00ea ...");

Yegor

> This problem occurs only on this following example.

> I copy a TextBox style to make another TextBox.

> HSLFSlideShow hslfsh = new HSLFSlideShow("template/test.ppt");
> SlideShow ppt = new SlideShow(hslfsh);
>                         
> Slide slide[] = ppt.getSlides();
>                         
> for(int i = 0 ; i < slide.length ; i++)
> {
>         Slide curSlide = slide[i];
>         Shape sh[] = curSlide.getShapes();
>                                 
>         for(int j = 0; j < sh.length ; j++ )
>         {
>                 Shape curSh = sh[j];
>                                         
>                 TextBox tb = new TextBox();
>                                         
>                 tb.setAnchor(curSh.getAnchor());
>                                         
>                 tb.setText("Helloworld e e e e a o i i o u u");
>                                 
>                 TextBox shape = (TextBox)curSh;
>                                         
>                 RichTextRun rt =
> shape.getTextRun().getRichTextRuns()[0];
>                 RichTextRun newRt =
> tb.getTextRun().getRichTextRuns()[0];
>                                         
>                 // style copy
>                 newRt.setAlignment(rt.getAlignment());
>                 newRt.setBold(rt.isBold());
>                 newRt.setFontColor(Color.black);
>                 newRt.setFontName(rt.getFontName());
>                 newRt.setFontSize(rt.getFontSize());
>                 newRt.setItalic(rt.isItalic());
>                 newRt.setUnderlined(rt.isUnderlined());
>                                         
>                 // remove old shape
>                 curSlide.removeShape(shape);
>                                         
>                 curSlide.addShape(tb);                             
>         }
> }

> Helloworld respects new style but others characters stay in Arial format.

> Maybe I have a problem in my source code?

> Thanks


> Mathieu Grosmaire wrote:
>> 
>> Hi,
>> 
>> I have some problem with specials characters such as eea...
>> Even if I set a font name in a RichTextRun, they always stay in Arial
>> format.
>> How can I solve this problem?
>> 
>> Thanks
>> 
>> Mathieu
>> 



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


Re: Re[4]: HSLF accent character problem

Posted by Mathieu Grosmaire <ma...@gmail.com>.
Hello

    This problem occurs on Office 2003 and Office 2007 version. It runs on
OpenOffice2.4

Regards
MG
-- 
View this message in context: http://www.nabble.com/HSLF-accent-character-problem-tp17512465p17750053.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: Re[4]: HSLF accent character problem

Posted by Mathieu Grosmaire <ma...@gmail.com>.
Hello

Try these characters : \u00e0 \u00e1 \u00e4 \u00e5 \u00e6 \u00e7 \u00e8
\u00e9


	SlideShow ppt = new SlideShow(new HSLFSlideShow("test7.ppt"));

	Slide s = ppt.getSlides()[0];

        TextBox tb = new TextBox();
        tb.setAnchor(new Rectangle(10,10,500,250));
        tb.setText("\u00e0\u00e1\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9");
        tb.getTextRun().getRichTextRuns()[0].setFontName("Times New Roman");

        s.addShape(tb);
        FileOutputStream out = new FileOutputStream("slideshow.ppt");
        ppt.write(out);
        out.close(); 

Regards
MG


Yegor Kozlov wrote:
> 
> What particular accent character did you use? Post it as \uxxxx.
> 
> I've just tried your code and it works for me. I can see both double
> and single accents.
> 
>         SlideShow ppt = new SlideShow(new HSLFSlideShow("test7.ppt"));
> 
>         Slide s = ppt.getSlides()[0];
> 
>         TextBox tb = new TextBox();
>         tb.setAnchor(new Rectangle(10,10,500,250));
>         tb.setText("helloworld \u02DD\u00B4\u0300");
>         tb.getTextRun().getRichTextRuns()[0].setFontName("Times New
> Roman");
> 
>         s.addShape(tb);
>         FileOutputStream out = new FileOutputStream("slideshow.ppt");
>         ppt.write(out);
>         out.close();
> 
>  Yegor
> 
> 

-- 
View this message in context: http://www.nabble.com/HSLF-accent-character-problem-tp17512465p17727680.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[4]: HSLF accent character problem

Posted by Yegor Kozlov <ye...@dinom.ru>.
What particular accent character did you use? Post it as \uxxxx.

I've just tried your code and it works for me. I can see both double
and single accents.

        SlideShow ppt = new SlideShow(new HSLFSlideShow("test7.ppt"));

        Slide s = ppt.getSlides()[0];

        TextBox tb = new TextBox();
        tb.setAnchor(new Rectangle(10,10,500,250));
        tb.setText("helloworld \u02DD\u00B4\u0300");
        tb.getTextRun().getRichTextRuns()[0].setFontName("Times New Roman");

        s.addShape(tb);
        FileOutputStream out = new FileOutputStream("slideshow.ppt");
        ppt.write(out);
        out.close();

 Yegor

> Hello

> I have tried unicode notation but it does not run. The problem comes from
> textbox insertion in an existing slideshow. Accent characters keep font name
> from Master Sheet.

> Sample code:
>         SlideShow ppt = new SlideShow(new
> HSLFSlideShow("template/test7.ppt"));
>                         
>         Slide s = ppt.getSlides()[0];
>                         
>         TextBox tb = new TextBox();
>         tb.setAnchor(new Rectangle(10,10,500,250));
>         tb.setText("helloworld eea");
>         tb.getTextRun().getRichTextRuns()[0].setFontName("Times New Roman");
>                         
>         s.addShape(tb);
>         FileOutputStream out = new
> FileOutputStream("report/slideshow.ppt");
>         ppt.write(out);
>         out.close();

> template :  http://www.nabble.com/file/p17693690/test7.ppt test7.ppt 

> Regards
> MG


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


Re: Re[2]: HSLF accent character problem

Posted by Mathieu Grosmaire <ma...@gmail.com>.
Hello

I have tried unicode notation but it does not run. The problem comes from
textbox insertion in an existing slideshow. Accent characters keep font name
from Master Sheet.

Sample code:
	SlideShow ppt = new SlideShow(new HSLFSlideShow("template/test7.ppt"));
			
	Slide s = ppt.getSlides()[0];
			
	TextBox tb = new TextBox();
	tb.setAnchor(new Rectangle(10,10,500,250));
	tb.setText("helloworld éèà");
	tb.getTextRun().getRichTextRuns()[0].setFontName("Times New Roman");
			
	s.addShape(tb);
	FileOutputStream out = new FileOutputStream("report/slideshow.ppt");
	ppt.write(out);
	out.close();

template :  http://www.nabble.com/file/p17693690/test7.ppt test7.ppt 

Regards
MG
-- 
View this message in context: http://www.nabble.com/HSLF-accent-character-problem-tp17512465p17693690.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