Skip to content

Commit

Permalink
Merge pull request #302 from sguan-actuate/master
Browse files Browse the repository at this point in the history
fix certain report design that does not convert properly in PPTX
  • Loading branch information
Yulin Wang committed May 13, 2016
2 parents 53617c4 + 609fbd2 commit 2dd964b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class Presentation extends Component

private static final String TAG_SLIDE_MASTER_ID_LIST = "p:sldMasterIdLst";

public static final int MAX_SLIDE_HEIGHT = 51206400;

private final PPTXBookmarkManager bmkmanager;

private int slideMasterId = 1;
Expand Down Expand Up @@ -181,12 +183,16 @@ public void close( ) throws IOException
writer.openTag( TAG_SLIDE_SZ );
// Set default page size to A4.
if ( width == 0 )
{
width = 612;
if ( height == 0 )
height = 792;
}


long convertedWidth = OOXmlUtil.convertPointerToEmus( width );
long convertedHeight = OOXmlUtil.convertPointerToEmus( height );

if ( convertedHeight > MAX_SLIDE_HEIGHT )
convertedHeight = MAX_SLIDE_HEIGHT;
writer.attribute( TAG_CX, convertedWidth );
writer.attribute( TAG_CY, convertedHeight );
writer.closeTag( TAG_SLIDE_SZ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ else if ( DesignChoiceConstants.UNITS_MM
else if ( DesignChoiceConstants.UNITS_PC
.equalsIgnoreCase( fromUnits ) )
targetMeasure = measure * POINTS_PER_PICA;
else if ( DesignChoiceConstants.UNITS_PX
.equalsIgnoreCase( fromUnits ) )
targetMeasure = measure * POINTS_PER_INCH / DEFAULT_DPI;
else
throw new IllegalArgumentException(
"\"fromUnits\"" + ILLEGAL_UNIT ); //$NON-NLS-1$
Expand Down

0 comments on commit 2dd964b

Please sign in to comment.