Skip to content

Commit

Permalink
Merge pull request #381 from baswani/master
Browse files Browse the repository at this point in the history
Margins are not being set in the doc/docx format of BIRT reports
  • Loading branch information
Yulin Wang authored Mar 17, 2017
2 parents c9e6ee3 + 575aead commit 70a9abe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ public void startTable( IStyle style, int tablewidth, boolean inForeign )
{
writer.openTag( "w:tbl" );
writer.openTag( "w:tblPr" );
writeTableIndent( );
writeTableIndent( style );
writeAttrTag( "w:tblStyle", "TableGrid" );
writeAttrTag( "w:tblOverlap", "Never" );
writeBidiTable( );
writeTableWidth( tablewidth );
writeTableWidth( style, tablewidth );
writeAttrTag( "w:tblLook", "01E0" );
writeTableLayout( );
writeTableBorders( style );
Expand Down Expand Up @@ -299,14 +299,25 @@ private void writeTableWidth( int tablewidth )
writer.closeTag( "w:tblW" );
}

private void writeTableIndent( )
private void writeTableIndent( IStyle style )
{
writer.openTag( "w:tblInd" );
writer.attribute( "w:w", 0 );
writer.attribute( "w:w",
WordUtil.milliPt2Twips( PropertyUtil.getDimensionValue( style
.getProperty( StyleConstants.STYLE_MARGIN_LEFT ) ) ) );
writer.attribute( "w:type", "dxa" );
writer.closeTag( "w:tblInd" );
}

private void writeTableWidth( IStyle style, int tablewidth )
{
int leftSpace = WordUtil.milliPt2Twips( PropertyUtil.getDimensionValue(
style.getProperty( StyleConstants.STYLE_MARGIN_LEFT ) ) );
int rightSpace = WordUtil.milliPt2Twips( PropertyUtil.getDimensionValue(
style.getProperty( StyleConstants.STYLE_MARGIN_RIGHT ) ) );
writeTableWidth( tablewidth - leftSpace - rightSpace );
}

protected void writeBorders( IStyle style, int bottomMargin, int topMargin,
int leftMargin, int rightMargin )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ else if ( color.equalsIgnoreCase( "Fuchsia" ) )
return "FF00FF";
else if ( color.equalsIgnoreCase( "Maroon" ) )
return "800000";
else if ( color.equalsIgnoreCase( "Orange" ) )
return "#FFA500";
String[] values = color.substring( color.indexOf( "(" ) + 1,
color.length( ) - 1 ).split( "," );
String value = "";
Expand Down

0 comments on commit 70a9abe

Please sign in to comment.