中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

利用Itext生成PDF實(shí)例

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用
    import java.io.FileOutputStream;  
    import java.io.IOException;  
      
    import com.itextpdf.text.Document;  
    import com.itextpdf.text.DocumentException;  
    import com.itextpdf.text.Element;  
    import com.itextpdf.text.Font;  
    import com.itextpdf.text.Paragraph;  
    import com.itextpdf.text.Phrase;  
    import com.itextpdf.text.pdf.BaseFont;  
    import com.itextpdf.text.pdf.PdfPCell;  
    import com.itextpdf.text.pdf.PdfPTable;  
    import com.itextpdf.text.pdf.PdfWriter;  
      
    //http://blog.csdn.net/yalove/article/details/9186127  
    public class zhaoPinTest {  
        public static void main(String[] args) throws DocumentException,  
                IOException {  
            // 標(biāo)題字體  
            BaseFont title1 = BaseFont.createFont("c:\\windows\\fonts\\simhei.ttf",  
                    BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);  
            Font titleFont = new Font(title1, 25, Font.NORMAL);  
            // 設(shè)置字體  
            Font mainFont = new Font(title1, 10, Font.NORMAL);  
            float f = 0.5f;  
            Document doc = null;  
            float lineHeight = 18f;  
            PdfPCell[][] cell = new PdfPCell[100][100];  
            int colNum = 1;  
            int rowNum = 1;  
            try {  
                doc = new Document();  
                PdfWriter.getInstance(doc, new FileOutputStream("test1.pdf"));  
                doc.open();  
                Paragraph p1 = new Paragraph("招聘員工登記表\n\n", titleFont);  
                p1.setAlignment(1);  
                doc.add(p1);  
                /** 
                 * 插入表格 
                 */  
      
                /** 
                 * 第一行 
                 */  
                PdfPTable table = new PdfPTable(7);  
                PdfPCell cell1 = new PdfPCell(new Phrase("姓名", mainFont));  
                cell1.setUseBorderPadding(true);  
                cell1.setBorderWidth(f);  
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell1.setFixedHeight(lineHeight);  
                table.addCell(cell1);  
      
                PdfPCell cell2 = new PdfPCell(new Phrase(""));  
                cell2.setUseBorderPadding(true);  
                cell2.setBorderWidth(f);  
                cell2.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2.setFixedHeight(lineHeight);  
                table.addCell(cell2);  
      
                PdfPCell cell3 = new PdfPCell(new Phrase("性別", mainFont));  
                cell3.setUseBorderPadding(true);  
                cell3.setBorderWidth(f);  
                cell3.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell3.setFixedHeight(lineHeight);  
                table.addCell(cell3);  
      
                PdfPCell cell4 = new PdfPCell(new Phrase(""));  
                cell4.setUseBorderPadding(true);  
                cell4.setBorderWidth(f);  
                cell4.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell4.setFixedHeight(lineHeight);  
                table.addCell(cell4);  
      
                PdfPCell cell5 = new PdfPCell(new Phrase("出生年月", mainFont));  
                cell5.setUseBorderPadding(true);  
                cell5.setBorderWidth(f);  
                cell5.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell5.setFixedHeight(lineHeight);  
                table.addCell(cell5);  
      
                PdfPCell cell6 = new PdfPCell(new Phrase(""));  
                cell6.setUseBorderPadding(true);  
                cell6.setBorderWidth(f);  
                cell6.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell6.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                table.addCell(cell6);  
      
                PdfPCell cell7 = new PdfPCell(new Phrase("照片", mainFont));  
                cell7.setUseBorderPadding(true);  
                cell7.setBorderWidth(f);  
                cell7.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell7.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell7.setRowspan(4);  
                table.addCell(cell7);  
      
                /** 
                 * 第二行 
                 */  
                PdfPCell cell2_1 = new PdfPCell(new Phrase("學(xué)歷", mainFont));  
                cell2_1.setUseBorderPadding(true);  
                cell2_1.setBorderWidth(f);  
                cell2_1.setHorizontalAlignment(1);  
                cell2_1.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_1.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_1.setFixedHeight(lineHeight);  
                table.addCell(cell2_1);  
      
                PdfPCell cell2_2 = new PdfPCell(new Phrase(""));  
                cell2_2.setUseBorderPadding(true);  
                cell2_2.setBorderWidth(f);  
                cell2_2.setHorizontalAlignment(1);  
                cell2_2.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_2.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_2.setFixedHeight(lineHeight);  
                table.addCell(cell2_2);  
      
                PdfPCell cell2_3 = new PdfPCell(new Phrase("婚否", mainFont));  
                cell2_3.setUseBorderPadding(true);  
                cell2_3.setBorderWidth(f);  
                cell2_3.setHorizontalAlignment(1);  
                cell2_3.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_3.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_3.setFixedHeight(lineHeight);  
                table.addCell(cell2_3);  
      
                PdfPCell cell2_4 = new PdfPCell(new Phrase(""));  
                cell2_4.setUseBorderPadding(true);  
                cell2_4.setBorderWidth(f);  
                cell2_4.setHorizontalAlignment(1);  
                cell2_4.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_4.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_4.setFixedHeight(lineHeight);  
                table.addCell(cell2_4);  
      
                PdfPCell cell2_5 = new PdfPCell(new Phrase("民族", mainFont));  
                cell2_5.setUseBorderPadding(true);  
                cell2_5.setBorderWidth(f);  
                cell2_5.setHorizontalAlignment(1);  
                cell2_5.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_5.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_5.setFixedHeight(lineHeight);  
                table.addCell(cell2_5);  
      
                PdfPCell cell2_6 = new PdfPCell(new Phrase(""));  
                cell2_6.setUseBorderPadding(true);  
                cell2_6.setBorderWidth(f);  
                cell2_6.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell2_6.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell2_6.setFixedHeight(lineHeight);  
                table.addCell(cell2_6);  
      
                /** 
                 * 第三行 
                 */  
                PdfPCell cell3_1 = new PdfPCell(new Phrase("專業(yè)", mainFont));  
                cell3_1.setUseBorderPadding(true);  
                cell3_1.setBorderWidth(f);  
                cell3_1.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell3_1.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell3_1.setFixedHeight(lineHeight);  
                table.addCell(cell3_1);  
      
                PdfPCell cell3_2 = new PdfPCell(new Phrase(""));  
                cell3_2.setUseBorderPadding(true);  
                cell3_2.setBorderWidth(f);  
                cell3_2.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell3_2.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell3_2.setFixedHeight(lineHeight);  
                cell3_2.setColspan(2);  
                table.addCell(cell3_2);  
      
                PdfPCell cell3_3 = new PdfPCell(new Phrase("別業(yè)學(xué)校", mainFont));  
                cell3_3.setUseBorderPadding(true);  
                cell3_3.setBorderWidth(f);  
                cell3_3.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell3_3.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell3_3.setFixedHeight(lineHeight);  
                table.addCell(cell3_3);  
      
                PdfPCell cell3_4 = new PdfPCell(new Phrase(""));  
                cell3_4.setUseBorderPadding(true);  
                cell3_4.setBorderWidth(f);  
                cell3_4.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell3_4.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell3_4.setFixedHeight(lineHeight);  
                cell3_4.setColspan(2);  
                ;  
                table.addCell(cell3_4);  
      
                /** 
                 * 第四行 
                 */  
                PdfPCell cell4_1 = new PdfPCell(new Phrase("健康狀況", mainFont));  
                cell4_1.setUseBorderPadding(true);  
                cell4_1.setBorderWidth(f);  
                cell4_1.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell4_1.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell4_1.setFixedHeight(lineHeight);  
                table.addCell(cell4_1);  
      
                PdfPCell cell4_2 = new PdfPCell(new Phrase(""));  
                cell4_2.setUseBorderPadding(true);  
                cell4_2.setBorderWidth(f);  
                cell4_2.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell4_2.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell4_2.setFixedHeight(lineHeight);  
                cell4_2.setColspan(2);  
                table.addCell(cell4_2);  
      
                PdfPCell cell4_3 = new PdfPCell(new Phrase("戶籍所在地", mainFont));  
                cell4_3.setUseBorderPadding(true);  
                cell4_3.setBorderWidth(f);  
                cell4_3.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell4_3.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell4_3.setFixedHeight(lineHeight);  
                table.addCell(cell4_3);  
      
                PdfPCell cell4_4 = new PdfPCell(new Phrase(""));  
                cell4_4.setUseBorderPadding(true);  
                cell4_4.setBorderWidth(f);  
                cell4_4.setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell4_4.setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell4_4.setFixedHeight(lineHeight);  
                cell4_4.setColspan(2);  
                table.addCell(cell4_4);  
      
                /** 
                 * 第五行 
                 */  
                rowNum = 5;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("政治面貌", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(2);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 3;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("身份證號碼", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 4;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(3);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第六行 
                 */  
                rowNum = 6;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("工作時間", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(2);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 3;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("有無住房", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 4;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 5;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("要求待遇", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 6;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第七行 
                 */  
                rowNum = 7;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("聯(lián)系電話", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(2);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 3;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("電子郵件", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 4;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 5;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("手機(jī)", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 6;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第八行 
                 */  
                rowNum = 8;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("聯(lián)系地址", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(6);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第九行 
                 */  
                rowNum = 9;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("工作所在地", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(6);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第十行 
                 */  
                rowNum = 10;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("離職原因", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(6);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 第十一行 
                 */  
                rowNum = 11;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("簡歷", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase(""));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setColspan(6);  
                table.addCell(cell[rowNum][colNum]);  
      
                /** 
                 * 插入表格2 
                 */  
                /** 
                 * 第一行 
                 */  
                float[] aa = new float[] { 0.06f, 0.31f, 0.31f, 0.32f };  
                PdfPTable table2 = new PdfPTable(4);  
                table2.setWidths(aa);  
                rowNum = 1;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("簡歷", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setRowspan(8);  
                table2.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("起止時間", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table2.addCell(cell[rowNum][colNum]);  
      
                colNum = 3;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("學(xué)習(xí)/工作單位", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table2.addCell(cell[rowNum][colNum]);  
      
                colNum = 4;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("專業(yè)/職位", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table2.addCell(cell[rowNum][colNum]);  
      
                for (int i = 2; i <= 8; i++) {  
                    rowNum = 3;  
                    colNum = 1;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table2.addCell(cell[rowNum][colNum]);  
      
                    colNum = 2;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table2.addCell(cell[rowNum][colNum]);  
      
                    colNum = 3;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table2.addCell(cell[rowNum][colNum]);  
      
                }  
      
                /** 
                 * 插入表格3 
                 */  
                /** 
                 * 第一行 
                 */  
                float[] aaa = new float[] { 0.06f, 0.31f, 0.1f, 0.1f, 0.1f, 0.33f };  
                PdfPTable table3 = new PdfPTable(6);  
                table3.setWidths(aaa);  
                rowNum = 1;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("家庭情況", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                cell[rowNum][colNum].setRowspan(6);  
                table3.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("姓名", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table3.addCell(cell[rowNum][colNum]);  
      
                colNum = 3;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("關(guān)系", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table3.addCell(cell[rowNum][colNum]);  
      
                colNum = 4;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("年齡", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table3.addCell(cell[rowNum][colNum]);  
      
                colNum = 5;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("文化程度", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table3.addCell(cell[rowNum][colNum]);  
      
                colNum = 6;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("現(xiàn)工作單位", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(lineHeight);  
                table3.addCell(cell[rowNum][colNum]);  
      
                for (int i = 2; i <= 6; i++) {  
                    rowNum = i;  
                    colNum = 1;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table3.addCell(cell[rowNum][colNum]);  
      
                    colNum = 2;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
      
                    table3.addCell(cell[rowNum][colNum]);  
      
                    colNum = 3;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table3.addCell(cell[rowNum][colNum]);  
      
                    colNum = 4;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table3.addCell(cell[rowNum][colNum]);  
      
                    colNum = 5;  
                    cell[rowNum][colNum] = new PdfPCell(new Phrase("", mainFont));  
                    cell[rowNum][colNum].setUseBorderPadding(true);  
                    cell[rowNum][colNum].setBorderWidth(f);  
                    cell[rowNum][colNum]  
                            .setHorizontalAlignment(Element.ALIGN_CENTER);  
                    cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                    cell[rowNum][colNum].setFixedHeight(lineHeight);  
                    table3.addCell(cell[rowNum][colNum]);  
                }  
      
                /** 
                 * 插入表格4 
                 */  
                /** 
                 * 第一行 
                 */  
                float[] aaaa = new float[] { 0.06f, 0.94f };  
                PdfPTable table4 = new PdfPTable(2);  
                table4.setWidths(aaaa);  
                rowNum = 1;  
                colNum = 1;  
                cell[rowNum][colNum] = new PdfPCell(new Phrase("特別提示", mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_CENTER);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(50f);  
                table4.addCell(cell[rowNum][colNum]);  
      
                colNum = 2;  
                cell[rowNum][colNum] = new PdfPCell(  
                        new Phrase(  
                                "   1. 本人承諾保證所填寫資料真實(shí)。\n   2. 保證遵守公司招聘有關(guān)規(guī)程和國家有關(guān)法規(guī)\n   3. 請?zhí)顚懞谜衅傅怯洷,帶齊照片、學(xué)歷、職稱證書的有效證件及相關(guān)復(fù)印件。",  
                                mainFont));  
                cell[rowNum][colNum].setUseBorderPadding(true);  
                cell[rowNum][colNum].setBorderWidth(f);  
                cell[rowNum][colNum].setHorizontalAlignment(Element.ALIGN_LEFT);  
                cell[rowNum][colNum].setVerticalAlignment(Element.ALIGN_MIDDLE);  
                cell[rowNum][colNum].setFixedHeight(100f);  
                table4.addCell(cell[rowNum][colNum]);  
      
                doc.add(table);  
                doc.add(table2);  
                doc.add(table3);  
                doc.add(table4);  
      
            } catch (Exception e) {  
                // TODO Auto-generated catch block  
                e.printStackTrace();  
            } finally {  
                doc.close();  
            }  
        }  
    }  

標(biāo)簽: 電子郵件

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:jquery輸入框添加默認(rèn)值,提交表單,獲取字符串長度,并截取字符串

下一篇:php禁止用下載工具來下載文件