itextsharp中使用表的问题

问题描述 投票:0回答:3

我正在尝试在asp.net c#中使用itextsharp生成pdf文件。

我在itextsharp中遇到了表概念,我正在尝试使用它,即我的应用程序。使用表格时出现以下问题。

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9CVXpyYS5wbmcifQ==” alt =“在此处输入图像描述”>

包含Name of treasery单词Treasery的pdf单元格出现在下一行。我正在为每个单元格设置宽度。如果我增加宽度也没有任何变化。下图使用箭头显示的间隙始终保持不变。为什么会有这个差距?如何消除这个差距?

我只想将虚线作为一个单元格的边界。怎么做?这是我的代码

    PdfPTable line6table = new PdfPTable (3);
    float[] width = new float[] { 2.5F, 1.5F, 3.0F };
    line6table.SetWidths(width);
    line6table.HorizontalAlignment = 0;
    line6table.WidthPercentage = 100.0f;
    line6table.SpacingBefore = 6.0f;

    PdfPCell a1 = new PdfPCell(new Phrase("Head Of Account"));
    a1.Border = 1;
    a1.Indent = 2.2f;
    a1.PaddingTop = 5.0f;
    line6table.AddCell(a1);

    PdfPCell a2 = new PdfPCell(new Phrase("CHARGED"));
    a2.Border = 1;
    a2.PaddingTop = 5.0f;
    line6table.AddCell(a2);

    PdfPCell a3 = new PdfPCell(new Phrase("Name of the treasry"));
    a3.Border = 0;
    a3.Indent = 15.0f;
    a3.RightIndent = 0.0f;
    a3.HorizontalAlignment = 1;
    line6table.AddCell(a3);


    pdfDocument.Add(line6table);

请帮助我解决问题。

c# asp.net pdf-generation itextsharp
3个回答
1
投票

line6table.WidthPercentage = 100.0f;

这为我做到了。

但是现在我的下一个问题是如何使虚线到达单个单元格?


0
投票

增加列的宽度。


0
投票

[Hola buenas使我的Podrian Ayudar和como成为现实,使Bord punteado和Un PdfCell

© www.soinside.com 2019 - 2024. All rights reserved.