@ -154,15 +154,6 @@ public class FactoryProperties {
}
}
public static void createParagraph ( Paragraph p , ChainedProperties props ) {
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" ) ) {
if ( props . hasPropertyInChain ( "div" , "background" ) ) {
p . setBackground ( props . getPropertyFromChain ( "div" , "background" ) ) ;
p . setBackground ( props . getPropertyFromChain ( "div" , "background" ) ) ;
}
}
@ -173,8 +164,9 @@ public class FactoryProperties {
p . setAttribute ( "noexist-attrid" , props . getProperty ( "noexist-attrid" ) ) ;
p . setAttribute ( "noexist-attrid" , props . getProperty ( "noexist-attrid" ) ) ;
}
}
parseMarginAttr ( p , props ) ;
parseAlignAttr ( p , props ) ;
parsePaddingAttr ( p , props ) ;
parseMarginAttr ( p , props ) ;
parsePaddingAttr ( p , props ) ;
if ( props . hasPropertyInChain ( "div" , "text-indent" ) ) {
if ( props . hasPropertyInChain ( "div" , "text-indent" ) ) {
String ss = props . getPropertyFromChain ( "div" , "text-indent" ) ;
String ss = props . getPropertyFromChain ( "div" , "text-indent" ) ;
@ -187,7 +179,7 @@ public class FactoryProperties {
p . setHyphenation ( getHyphenation ( props ) ) ;
p . setHyphenation ( getHyphenation ( props ) ) ;
setParagraphLeading ( p , props . getProperty ( "leading" ) ) ;
setParagraphLeading ( p , props . getProperty ( "leading" ) ) ;
value = props . getProperty ( "before" ) ;
String value = props . getProperty ( "before" ) ;
if ( value ! = null ) {
if ( value ! = null ) {
try {
try {
p . setSpacingBefore ( Float . parseFloat ( value ) ) ;
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属性
* 解析margin属性
*
*