[英]Is it possible to create a cell inside an HTML table with TCPDF?
I'm actually writing a templating tool that will be able to read a test / quiz written inside a properly-formatted text file and then render it on both paper (by generating a PDF file) and for the web (by creating HTML + CSS + JS). 我实际上是在编写一个模板工具,该工具将能够读取格式正确的文本文件中编写的测试/测验,然后在纸上(通过生成PDF文件)和在网络上(通过创建HTML + CSS)进行渲染+ JS)。 To generate PDF files I have chosen TCPDF, but I'm actually having a problem: Sometimes I'd like to create tables and put checkboxes and textboxes inside of them, just like as you can see in this mock-up image :
要生成PDF文件,我选择了TCPDF,但实际上遇到了一个问题:有时,我想创建表并将复选框和文本框放在其中,就像在此模型图中可以看到的那样:
If I were to do it in HTML I would simply create some or tags and apply a border on them by using the related CSS property, for example by writing something like this: 如果要使用HTML进行操作,则可以简单地创建一些或标签,并使用相关的CSS属性在其上施加边框,例如,编写如下代码:
<style>
.dashed {
border: 2px dashed gray;
padding-left: 1em;
padding-right: 1em;
font-family: monospace;
}
.solid {
border: 2px solid gray;
padding-left: .75em;
padding-right: .75em;
margin-left: 1em;
margin-right: .5em;
font-family: monospace;
}
.solid:first-child {
margin-left: 0;
}
</style>
<table border="2" cellpadding="12" cellspacing="0">
<tr>
<td>What does 1 + 1 ?</td>
<td><span class="dashed"> </span>
</tr>
<tr>
<td>What does 2 + 2 ?</td>
<td>
<span class="solid">A</span>
One
<span class="solid">B</span>
Two
<span class="solid">C</span>
Three
<span class="solid">D</span>
Four
</td>
</tr>
</table>
(I'm actually using inline CSS for explanation purposes, I don't usually apply CSS styles this way) (我实际上是使用内联CSS进行解释,通常不以这种方式应用CSS样式)
Unfortunately, if I'm not mistaken, TCPDF doesn't support CSS Borders - so I'm feeling a little bit lost. 不幸的是,如果我没有记错的话,TCPDF不支持CSS边框 -因此我感到有些失落。 Would you give me some hints and your opinion about what I could do in order to achieve the same result?
您能否给我一些提示和您对我可以做什么以达到相同结果的意见?
Many thanks in advance 提前谢谢了
Have you tried using HTML border tags? 您是否尝试过使用HTML边框标记? eg:
border="2"
bordercolor="yellow"
bgcolor="red"
例如:
border="2"
bordercolor="yellow"
bgcolor="red"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.