@ -154,15 +154,6 @@ public class FactoryProperties {
}
public static void createParagraph ( Paragraph p , ChainedProperties props ) {
String value = props . getProperty ( "align" ) ;
if ( value ! = null ) {
if ( value . equalsIgnoreCase ( "center" ) )
p . setAlignment ( Element . ALIGN_CENTER ) ;
else if ( value . equalsIgnoreCase ( "right" ) )
p . setAlignment ( Element . ALIGN_RIGHT ) ;
else if ( value . equalsIgnoreCase ( "justify" ) )
p . setAlignment ( Element . ALIGN_JUSTIFIED ) ;
}
if ( props . hasPropertyInChain ( "div" , "background" ) ) {
p . setBackground ( props . getPropertyFromChain ( "div" , "background" ) ) ;
}
@ -173,6 +164,7 @@ public class FactoryProperties {
p . setAttribute ( "noexist-attrid" , props . getProperty ( "noexist-attrid" ) ) ;
}
parseAlignAttr ( p , props ) ;
parseMarginAttr ( p , props ) ;
parsePaddingAttr ( p , props ) ;
@ -187,7 +179,7 @@ public class FactoryProperties {
p . setHyphenation ( getHyphenation ( props ) ) ;
setParagraphLeading ( p , props . getProperty ( "leading" ) ) ;
value = props . getProperty ( "before" ) ;
String value = props . getProperty ( "before" ) ;
if ( value ! = null ) {
try {
p . setSpacingBefore ( Float . parseFloat ( value ) ) ;
@ -210,6 +202,30 @@ public class FactoryProperties {
}
}
/ * *
* 解析align属性
*
* @param p
* @param props
* /
private static void parseAlignAttr ( Paragraph p , ChainedProperties props ) {
String [ ] keys = new String [ ] { Markup . CSS_KEY_ALIGN , Markup . CSS_KEY_TEXTALIGN } ;
for ( String key : keys ) {
String value = props . getPropertyFromChain ( "div" , key ) ;
if ( null = = value ) {
continue ;
}
if ( value . equalsIgnoreCase ( "center" ) )
p . setAlignment ( Element . ALIGN_CENTER ) ;
else if ( value . equalsIgnoreCase ( "right" ) )
p . setAlignment ( Element . ALIGN_RIGHT ) ;
else if ( value . equalsIgnoreCase ( "left" ) )
p . setAlignment ( Element . ALIGN_LEFT ) ;
else if ( value . equalsIgnoreCase ( "justify" ) )
p . setAlignment ( Element . ALIGN_JUSTIFIED ) ;
}
}
/ * *
* 解析margin属性
*