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: [email protected]
ReportedBy: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]