ABCpdf 表格帮助
第一次发帖,请多多包涵。基本上我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终解决了这个问题,只需将这两个函数添加到我的包装类中,然后在使用表对象之前和之后调用它们。
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.