ABCpdf 表格帮助

发布于 2024-11-18 23:45:05 字数 1219 浏览 2 评论 0原文

第一次发帖,请多多包涵。基本上我有一个 pdf 文档,我正在使用 ABCpdf (通过 C# 项目)即时创建,但是表行似乎是在彼此之上渲染的。我查看了所有文档等并寻找答案,但没有找到与此相关的任何内容。

我参考了创建表的示例,这些示例使我达到了现在的目的,但我无法理解导致此问题的原因。下面是我如何构建表格的示例。任何提供的帮助将不胜感激。我为 ABCpdf 创建了一个包装器,以使其使用起来更快、代码更高效,但看不到这导致了问题,因为它只是调用与我逐行编写全部代码相同的代码。

        PdfTable pdfTable = new PdfTable(_abcPdfWrapper.PdfDocument, 5, 3)   {HorizontalAlignment = 1};

        pdfTable.NextRow();
        pdfTable.NextCell();
        pdfTable.AddText(firstStageReference);

        pdfTable.NextCell();
        pdfTable.AddText(String.Format("{0:#,0.000}", materialWeight) + " Kg");
        pdfTable.NextRow();
        pdfTable.AddText(weighDepartmentMaterial.sMaterialCode ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.sMaterialName ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(String.Format("{0:#,0.000}", materialWeight) + " Kg");

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.Scale ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.AddGroup ?? String.Empty);

这些行之间还有其他代码,但除了一个循环之外,它们对表的构造没有任何意义,其中包含从 2 号往下的行来循环遍历一系列原材料并为每个原材料创建一行。

First time poster so please bear with me. Basically I have a pdf document that I am creating on the fly using ABCpdf (via C# project) however the table rows seem to be rendering on top of each other. I have looked at all the documentation etc and searched for an answer but have not found anything relating to this.

I referred to the examples on creating tables which got me to the point I am at now but I cannot understand what is causing this issue. Below is an example of how I am constructing my table. Any help offered would be greatly appreciated. I have created a wrapper for ABCpdf to make it quicker and more code efficient to use but cannot see this causing the issue as it simply calls the same code as it would if I wrote it all out line by line.

        PdfTable pdfTable = new PdfTable(_abcPdfWrapper.PdfDocument, 5, 3)   {HorizontalAlignment = 1};

        pdfTable.NextRow();
        pdfTable.NextCell();
        pdfTable.AddText(firstStageReference);

        pdfTable.NextCell();
        pdfTable.AddText(String.Format("{0:#,0.000}", materialWeight) + " Kg");
        pdfTable.NextRow();
        pdfTable.AddText(weighDepartmentMaterial.sMaterialCode ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.sMaterialName ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(String.Format("{0:#,0.000}", materialWeight) + " Kg");

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.Scale ?? String.Empty);

        pdfTable.NextCell();
        pdfTable.AddText(weighDepartmentMaterial.AddGroup ?? String.Empty);

There is other code in between these lines but they bear no significance to the construction of the table other than a loop in which the lines from number 2 down are contained to loop through a series of raw materials and create a row for each.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自由范儿 2024-11-25 23:45:05

我最终解决了这个问题,只需将这两个函数添加到我的包装类中,然后在使用表对象之前和之后调用它们。

        public void PdfTableBegin()
    {
        PdfDocument.TopDown = false;
    }


    public void PdfTableEnd()
    {
        PdfDocument.TopDown = true;
    }

I solved this issue in the end by simply adding these two functions into my wrapper class and then calling them before and after using the table object.

        public void PdfTableBegin()
    {
        PdfDocument.TopDown = false;
    }


    public void PdfTableEnd()
    {
        PdfDocument.TopDown = true;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文