⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paragraph.java

📁 iText是一个能够快速产生PDF文件的java类库。iText的java类对于那些要产生包含文本
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * Sets the alignment of this paragraph.
     *
     * @param	alignment		the new alignment as a <CODE>String</CODE>
     */
    public void setAlignment(String alignment) {
        if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_CENTER;
            return;
        }
        if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_RIGHT;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED_ALL;
            return;
        }
        this.alignment = Element.ALIGN_LEFT;
    }
    
    /**
     * @see com.lowagie.text.Phrase#setLeading(float)
     */
    public void setLeading(float fixedLeading) {
        this.leading = fixedLeading;
        this.multipliedLeading = 0;
    }
    
    /**
     * Sets the variable leading. The resultant leading will be
     * multipliedLeading*maxFontSize where maxFontSize is the
     * size of the bigest font in the line.
     * @param multipliedLeading the variable leading
     */
    public void setMultipliedLeading(float multipliedLeading) {
        this.leading = 0;
        this.multipliedLeading = multipliedLeading;
    }
    
    /**
     * Sets the leading fixed and variable. The resultant leading will be
     * fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
     * size of the bigest font in the line.
     * @param fixedLeading the fixed leading
     * @param multipliedLeading the variable leading
     */
    public void setLeading(float fixedLeading, float multipliedLeading) {
        this.leading = fixedLeading;
        this.multipliedLeading = multipliedLeading;
    }
    
    /**
     * Sets the indentation of this paragraph on the left side.
     *
     * @param	indentation		the new indentation
     */
    public void setIndentationLeft(float indentation) {
        this.indentationLeft = indentation;
    }
    
    /**
     * Sets the indentation of this paragraph on the right side.
     *
     * @param	indentation		the new indentation
     */
    public void setIndentationRight(float indentation) {
        this.indentationRight = indentation;
    }
    
    /**
     * Setter for property firstLineIndent.
     * @param firstLineIndent New value of property firstLineIndent.
     */
    public void setFirstLineIndent(float firstLineIndent) {
        this.firstLineIndent = firstLineIndent;
    }
    
    /**
     * Sets the spacing before this paragraph.
     *
     * @param	spacing		the new spacing
     */
    public void setSpacingBefore(float spacing) {
        this.spacingBefore = spacing;
    }
    
    /**
     * Sets the spacing after this paragraph.
     *
     * @param	spacing		the new spacing
     */
    public void setSpacingAfter(float spacing) {
        this.spacingAfter = spacing;
    }
    
    /**
     * Indicates that the paragraph has to be kept together on one page.
     *
     * @param   keeptogether    true of the paragraph may not be split over 2 pages
     */
    public void setKeepTogether(boolean keeptogether) {
        this.keeptogether = keeptogether;
    }
    
    /**
     * Checks if this paragraph has to be kept together on one page.
     *
     * @return  true if the paragraph may not be split over 2 pages.
     */
    public boolean getKeepTogether() {
        return keeptogether;
    }

    // methods to retrieve information

	/**
     * Gets the alignment of this paragraph.
     *
     * @return	alignment
     */
    public int getAlignment() {
        return alignment;
    }
    
    /**
     * Gets the variable leading
     * @return the leading
     */
    public float getMultipliedLeading() {
        return multipliedLeading;
    }
    
    /**
     * Gets the total leading.
     * This method is based on the assumption that the
     * font of the Paragraph is the font of all the elements
     * that make part of the paragraph. This isn't necessarily
     * true.
     * @return the total leading (fixed and multiplied)
     */
    public float getTotalLeading() {
    	float m = font == null ?
    			Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading);
    	if (m > 0 && !hasLeading()) {
    		return m;
    	}
    	return getLeading() + m;
    }

	/**
     * Gets the indentation of this paragraph on the left side.
     *
     * @return	the indentation
     */
    public float getIndentationLeft() {
        return indentationLeft;
    }

	/**
	 * Gets the indentation of this paragraph on the right side.
	 *
	 * @return	the indentation
	 */
    public float getIndentationRight() {
        return indentationRight;
    }
    
    /**
     * Getter for property firstLineIndent.
     * @return Value of property firstLineIndent.
     */
    public float getFirstLineIndent() {
        return this.firstLineIndent;
    }
    
    /**
     * Gets the spacing before this paragraph.
     *
     * @return	the spacing
     */
    public float spacingBefore() {
        return spacingBefore;
    }

    /**
     * Gets the spacing after this paragraph.
     *
     * @return	the spacing
     */
    public float spacingAfter() {
        return spacingAfter;
    }
    
    /**
     * Getter for property extraParagraphSpace.
     * @return Value of property extraParagraphSpace.
     */
    public float getExtraParagraphSpace() {
        return this.extraParagraphSpace;
    }
    
    /**
     * Setter for property extraParagraphSpace.
     * @param extraParagraphSpace New value of property extraParagraphSpace.
     */
    public void setExtraParagraphSpace(float extraParagraphSpace) {
        this.extraParagraphSpace = extraParagraphSpace;
    }

    // deprecated stuff
    
    /**
     * Returns a <CODE>Paragraph</CODE> that has been constructed taking in account
     * the value of some <VAR>attributes</VAR>.
     *
     * @param	attributes		Some attributes
     * @deprecated use ElementFactory.getParagraph(attributes)
     */
    public Paragraph(java.util.Properties attributes) {
        this(com.lowagie.text.factories.ElementFactory.getParagraph(attributes));
    }
    
    /**
	 * Gets the alignment of this paragraph.
	 *
	 * @return	alignment
	 * @deprecated Use {@link #getAlignment()} instead
	 */
	public int alignment() {
		return getAlignment();
	}
    
    /**
	 * Gets the indentation of this paragraph on the left side.
	 *
	 * @return	the indentation
	 * @deprecated Use {@link #getIndentationLeft()} instead
	 */
	public float indentationLeft() {
		return getIndentationLeft();
	}
    
	/**
	 * Gets the indentation of this paragraph on the right side.
	 *
	 * @return	the indentation
	 * @deprecated Use {@link #getIndentationRight()} instead
	 */
	public float indentationRight() {
		return getIndentationRight();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -