fix table and table's cells css processing
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cacef02b5b
commit
3743efebeb
@ -219,9 +219,9 @@ public class ExcelToHtmlConverter
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
StringBuilder borderStyle = new StringBuilder();
|
StringBuilder borderStyle = new StringBuilder();
|
||||||
borderStyle.append( ExcelToHtmlUtils.getBorderStyle( xlsBorder ) );
|
|
||||||
borderStyle.append( ' ' );
|
|
||||||
borderStyle.append( ExcelToHtmlUtils.getBorderWidth( xlsBorder ) );
|
borderStyle.append( ExcelToHtmlUtils.getBorderWidth( xlsBorder ) );
|
||||||
|
borderStyle.append( ' ' );
|
||||||
|
borderStyle.append( ExcelToHtmlUtils.getBorderStyle( xlsBorder ) );
|
||||||
|
|
||||||
final HSSFColor color = workbook.getCustomPalette().getColor(
|
final HSSFColor color = workbook.getCustomPalette().getColor(
|
||||||
borderColor );
|
borderColor );
|
||||||
@ -231,7 +231,7 @@ public class ExcelToHtmlConverter
|
|||||||
borderStyle.append( ExcelToHtmlUtils.getColor( color ) );
|
borderStyle.append( ExcelToHtmlUtils.getColor( color ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
style.append( type + "-border: " + borderStyle + "; " );
|
style.append( "border-" + type + ": " + borderStyle + "; " );
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
|
void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
|
||||||
@ -574,6 +574,8 @@ public class ExcelToHtmlConverter
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Element table = htmlDocumentFacade.createTable();
|
Element table = htmlDocumentFacade.createTable();
|
||||||
|
table.setAttribute( "class", "t" );
|
||||||
|
|
||||||
Element tableBody = htmlDocumentFacade.createTableBody();
|
Element tableBody = htmlDocumentFacade.createTableBody();
|
||||||
|
|
||||||
final List<Element> emptyRowElements = new ArrayList<Element>(
|
final List<Element> emptyRowElements = new ArrayList<Element>(
|
||||||
@ -648,6 +650,9 @@ public class ExcelToHtmlConverter
|
|||||||
processSheet( workbook, sheet );
|
processSheet( workbook, sheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stylesElement
|
||||||
|
.appendChild( htmlDocumentFacade
|
||||||
|
.createText( "table.t{border-collapse:collapse;border-spacing:0;}\n" ) );
|
||||||
if ( !cssStyleToClass.isEmpty() )
|
if ( !cssStyleToClass.isEmpty() )
|
||||||
{
|
{
|
||||||
for ( Map.Entry<String, String> entry : cssStyleToClass.entrySet() )
|
for ( Map.Entry<String, String> entry : cssStyleToClass.entrySet() )
|
||||||
|
@ -85,7 +85,8 @@ public class ExcelToHtmlUtils
|
|||||||
|
|
||||||
public static String getColor( HSSFColor color )
|
public static String getColor( HSSFColor color )
|
||||||
{
|
{
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder( 7 );
|
||||||
|
stringBuilder.append( '#' );
|
||||||
for ( short s : color.getTriplet() )
|
for ( short s : color.getTriplet() )
|
||||||
{
|
{
|
||||||
if ( s < 10 )
|
if ( s < 10 )
|
||||||
@ -93,7 +94,21 @@ public class ExcelToHtmlUtils
|
|||||||
|
|
||||||
stringBuilder.append( Integer.toHexString( s ) );
|
stringBuilder.append( Integer.toHexString( s ) );
|
||||||
}
|
}
|
||||||
return stringBuilder.toString();
|
String result = stringBuilder.toString();
|
||||||
|
|
||||||
|
if ( result.equals( "#ffffff" ) )
|
||||||
|
return "white";
|
||||||
|
|
||||||
|
if ( result.equals( "#c0c0c0" ) )
|
||||||
|
return "silver";
|
||||||
|
|
||||||
|
if ( result.equals( "#808080" ) )
|
||||||
|
return "gray";
|
||||||
|
|
||||||
|
if ( result.equals( "#000000" ) )
|
||||||
|
return "black";
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user