简体   繁体   English

在iTextSharp中设置段落和表格之间的间距?

[英]set spacing between paragraph and table in iTextSharp?

Look at the code and resume using itextsharp.. In which I have a paragraph with the text 'Education'. 查看代码,然后继续使用itextsharp。在其中,我有一个段落,文字为“ Education”。

After that I have a table which show my education details but to need to set gap between them.. 在那之后,我有一张桌子,显示我的学历细节,但需要在两者之间留出空隙。

Please see the attached picture: 请看附图:

My code: 我的代码:

在此处输入图片说明

PdfPTable table = new PdfPTable(5)
         { WidthPercentage = 100, RunDirection = PdfWriter.RUN_DIRECTION_LTR, ExtendLastRow = false };


        // table.TotalWidth = doc.PageSize.Width - doc.LeftMargin - doc.RightMargin;


          table.PaddingTop = 300f;
        table.HorizontalAlignment = Element.ALIGN_CENTER;


        table.AddCell("DEGREE");
        table.AddCell("NAME OF INSTITE");
        table.AddCell("UNVERISTY");
        table.AddCell("YEAR OF PASSING");
        table.AddCell("SCORE");

        table.AddCell(" ");
        table.AddCell(" ");
        table.AddCell( );
        table.AddCell(" ");
        table.AddCell(" ");

        table.AddCell(" ");
        table.AddCell(" c");
        table.AddCell(" ");
        table.AddCell(" ");
        table.AddCell("  %");

        table.AddCell(" ");
        table.AddCell(" ");
        table.AddCell(" d");
        table.AddCell(" ");
        table.AddCell("  %");



        doc.Add(table);

这应该工作

table.setSpacingAfter(20);

Well SpacingAfter worked for me, SpacingAfter好为我工作后,

just add table.SpacingAfter = 20; 只需添加table.SpacingAfter = 20;

and table.SpacingBefore = 20; table.SpacingBefore = 20;

worked perfectly for me 对我来说很完美

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM