You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/06/05 16:43:00 UTC

DO NOT REPLY [Bug 45140] New: TextShape.resizeToFitText() Not Properly Sizing TextShape

https://issues.apache.org/bugzilla/show_bug.cgi?id=45140

           Summary: TextShape.resizeToFitText() Not Properly Sizing
                    TextShape
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
        AssignedTo: dev@poi.apache.org
        ReportedBy: nmische@gmail.com


Created an attachment (id=22081)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22081)
Patch for resizeToFitText

TextShape.resizeToFitText() does not appear to properly size the TextShape.
Take for example the following code:

SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
TextBox title = slide.addTitle();
title.setText("Title Line One\nTitle Line Two");
title.resizeToFitText();

//save changes 
FileOutputStream out = new FileOutputStream("test.ppt");
ppt.write(out);
out.close();

The title TextBox created by this example is much wider than the text and is
only the height of a single line, although the title has multiple lines of
text. 

>From my investigation there appear to be two issues with the size calculation. 

First, the text doesn't seem to properly split into lines. The existing code
attempts to split on \r but I've found it needs to split on \n.

Second, the TextShape height is set to the highest line, not the cumulative
height of all of the lines.

I've attached a patch which in my testing seems to do a better job at sizing
the TextShape.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45140] TextShape.resizeToFitText() Not Properly Sizing TextShape

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45140





--- Comment #1 from Yegor Kozlov <ye...@dinom.ru>  2008-06-05 09:16:08 PST ---
Thanks for the patch. It will be included in 3.1-final.

Regards,
Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45140] TextShape.resizeToFitText() Not Properly Sizing TextShape

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45140


Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Yegor Kozlov <ye...@dinom.ru>  2008-06-08 05:32:56 PST ---
Patch applied in r664492. Thanks.

Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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