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 2007/07/30 14:13:14 UTC

DO NOT REPLY [Bug 42999] New: - HSSFPatriarch positioning problem

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999

           Summary: HSSFPatriarch positioning problem
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Keywords: APIBug
          Severity: major
          Priority: P1
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: virussu_ro@yahoo.com


Hi folks!

I have a problem positioning a picture inside a cell range. I use a code similar
to this one:

wb = new HSSFWorkbook();
sheet = wb.createSheet("report");
patriarch = sheet.createDrawingPatriarch();
loadPicture(picturePath);//custom method			
picData = getPictureBytes();
indexPicture=wb.addPicture( picData, HSSFWorkbook.PICTURE_TYPE_JPEG );
		
anchor = new HSSFClientAnchor( 500 , 0 , 300 , 255 ,(short)0,1,(short)1,3);

anchor.setAnchorType( 0 );
patriarch.createPicture(anchor, indexPicture);

And then I save the workbook.

The problem is that when the anchor is created, the positioning is bad if the
dx1 coordinate (500) is greater than the dx2 coordinate (300). The program will
actualy put the patriarch having the start coordinate in the first cell equal to
300, and the end coordinate in the last cell equal to 500. 

So it looks like if dx1>dx2, the two coordinates will switch between them.

I had some hard time trying to get around this, but I did not find a way. I also
tried to create a new patriarch with the default constructor, and then to set
each coordinate, row and column, but the result stays the same.

Should I use some other way to add a picture?

Thanks in advance,
Bogdan

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

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


DO NOT REPLY [Bug 42999] - HSSFPatriarch positioning problem

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999





------- Additional Comments From yegor@dinom.ru  2007-07-30 06:11 -------
Hi,

The bug is in org.apache.poi.hssf.model.ConvertAnchor.
This object is responsible for converting HSSF anchors to the
corresponding low-level escher record.

There is an extra check which cause dx1 ans dx2 to be swapped if dx1>dx2:
...
anchor.setDx1( (short) Math.min(a.getDx1(), a.getDx2()) );
anchor.setDy1( (short) Math.min(a.getDy1(), a.getDy2()) );
...

It does make sense for child anchors - you can't have dx2>dx1 in a child anchor.
For client anchors it is extra and can be safely removed. I will commit the
patch shortly.

Regards,
Yegor

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

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


DO NOT REPLY [Bug 42999] - HSSFPatriarch positioning problem

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999


yegor@dinom.ru changed:

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




------- Additional Comments From yegor@dinom.ru  2007-12-24 01:51 -------
Fixed

Yegor

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

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


DO NOT REPLY [Bug 42999] - HSSFPatriarch positioning problem

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999


yegor@dinom.ru changed:

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




------- Additional Comments From yegor@dinom.ru  2007-08-03 11:09 -------
Fixed

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

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


DO NOT REPLY [Bug 42999] - HSSFPatriarch positioning problem

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999


ya_ro@mail.ru changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |minor
             Status|RESOLVED                    |REOPENED
           Priority|P1                          |P5
         Resolution|FIXED                       |




------- Additional Comments From ya_ro@mail.ru  2007-12-06 07:57 -------
The same problem in AnchorHeight calculations in 
org.apache.poi.hssf.usermodel.HSSFClientAnchor

public float getAnchorHeightInPoints(HSSFSheet sheet )
{
int y1 = Math.min( getDy1(), getDy2() );
int y2 = Math.max( getDy1(), getDy2() );
int row1 = Math.min( getRow1(), getRow2() );
int row2 = Math.max( getRow1(), getRow2() );
...

Please, fix it in 3.0.2 release.

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

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


DO NOT REPLY [Bug 42999] - HSSFPatriarch positioning problem

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42999





------- Additional Comments From yegor@dinom.ru  2007-12-06 08:27 -------
OK. The fix will go in 3.0.2 beta2.

Yegor

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

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