我正在尝试转换一个超文本标记语言页面到PDF使用ABCpdf组件。我已经使用了AddImagehtml方法来做到这一点。它起作用了。我的要求是动态获取这些值。如何将数据集中的值传递到HTML。有人能解决我的问题吗?
发布于 2012-04-11 21:03:05
在字符串生成器中动态构建HTML。
下面的伪代码
String Builder SB = new StringBuilder()
// Initialize HTML here with head body, etc
SB.AppendLine("<table>");`
foreach datarow DR in DataTable`
{
// loop through columns and add them in TR TD tags
}
// Now build the PDF from the HTML
Doc thisPDF = New Doc();
Integer iChk = thisPDF.AddImageHtml(SB.ToString());
while thisPDF.Chainable(iChk)
{
thisPDF.Page = thisPDF.AddPage();
thisPDF.FrameRect();
iChk = thisPDF.AddImageToChain(iChk);
}
// Save the PDF here, or output to HTTP stream for user to download发布于 2012-03-05 18:46:36
我认为您应该在服务器端使用其他方法动态完成此操作,例如创建一个动态表和遍历您的数据集以添加值。
检查安装文件夹中ABC PDF文档中的小表格示例和大表格示例。
https://stackoverflow.com/questions/9562375
复制相似问题