Skip to content

Commit

Permalink
Fixed TED 75059: Cell width set to 0 on the column
Browse files Browse the repository at this point in the history
  • Loading branch information
sguan-actuate committed Jul 30, 2014
1 parent 24e6c55 commit a6c11ff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
Expand Up @@ -31,6 +31,7 @@ public class TableWriter
private static final String BOTTOMBORDERLINE = "a:lnB";
private static final int DEFAULT_EMPTYCELL_FONTSIZE = 100;
private static final int MINIMUM_ROW_HEIGHT = 4000;
private static final int MINIMUM_COLUMN_WIDTH = 2000;
private int currentX;
private int currentY;
protected Stack<BoxStyle> rowStyleStack = new Stack<BoxStyle>( );
Expand Down Expand Up @@ -207,20 +208,21 @@ private void writeColumnsWidth( TableArea tablearea )
int columnWidth = 0;
int cellwidth = 0;
writer.openTag( "a:tblGrid" );
int defaultwidth = tablearea.getWidth( ) / numOfColumns;
for ( int i = 0; i < numOfColumns; i++ )
{
cellwidth = tablearea.getCellWidth( i, i + 1 );
if ( cellwidth <= 0 )
if ( cellwidth > 0 )
{
cellwidth = defaultwidth;
if ( cellwidth < MINIMUM_COLUMN_WIDTH )
{
cellwidth = MINIMUM_COLUMN_WIDTH;
}
columnWidth = canvas.getScaledValue( PPTXUtil
.convertToEnums( cellwidth ) );
writer.openTag( "a:gridCol" );
writer.attribute( "w", columnWidth );
writer.closeTag( "a:gridCol" );
}

columnWidth = PPTXUtil.convertToEnums( canvas.getScaledValue( cellwidth ) );

writer.openTag( "a:gridCol" );
writer.attribute( "w", columnWidth );
writer.closeTag( "a:gridCol" );
}
writer.closeTag( "a:tblGrid" );
}
Expand Down Expand Up @@ -281,6 +283,11 @@ private void endRow( )

protected void drawCell( CellArea cell )
{
if( cell.getWidth( ) == 0 )
{
currentCol++;
return;
}
currentX += getX( cell );
currentY += getY( cell );
updateRenderXY( );
Expand Down
Expand Up @@ -65,6 +65,7 @@ public TableArea( ContainerArea parent, LayoutContext context,
{
super( table );
layout = table.layout;
layoutInfo = table.layoutInfo;
}

public boolean contains( RowArea row )
Expand All @@ -89,6 +90,7 @@ public int getColumnCount( )
return 0;
}

@Override
protected boolean needRepeat( )
{
ITableContent table = (ITableContent) content;
Expand All @@ -99,6 +101,7 @@ protected boolean needRepeat( )
return false;
}

@Override
public TableArea cloneArea( )
{
return new TableArea( this );
Expand All @@ -123,6 +126,7 @@ public boolean isGridDesign( )
return false;
}

@Override
protected void buildProperties( IContent content, LayoutContext context )
{
IStyle style = content.getStyle( );
Expand Down Expand Up @@ -184,6 +188,7 @@ protected void buildProperties( IContent content, LayoutContext context )
action = content.getHyperlinkAction( );
}

@Override
public void initialize( ) throws BirtException
{
calculateSpecifiedWidth( content );
Expand Down Expand Up @@ -286,6 +291,7 @@ protected boolean isInHeaderBand( )
return true;
}

@Override
public SplitResult split( int height, boolean force ) throws BirtException
{
SplitResult result = super.split( height, force );
Expand Down Expand Up @@ -338,7 +344,7 @@ private UnresolvedRowHint convertRowToHint( RowArea row )
{
for ( int i = 0; i < row.cells.length; i++ )
{
AbstractArea area = (AbstractArea) row.cells[i];
AbstractArea area = row.cells[i];
String style = null;
if ( area instanceof DummyCell )
{
Expand Down Expand Up @@ -640,6 +646,7 @@ protected void addRows( ContainerArea container, TableLayout layout, String rowI
}
}

@Override
public void close( ) throws BirtException
{
/*
Expand Down Expand Up @@ -713,6 +720,7 @@ private TableLayoutInfo resolveTableFixedLayout( IContent content,
.resolveFixedLayout( parentMaxWidth - marginWidth ) );
}

@Override
protected int getDimensionValue( IContent content, DimensionType d,
int referenceLength )
{
Expand Down

0 comments on commit a6c11ff

Please sign in to comment.