C# 中的 tTable 单元格和行边框在每条边上都不同
我试图在表格中动态生成报告,其中单元格或行每一侧的边框都不同,但不知道如何实现。 TableRow、TableCell 和 Table 对象均具有 BorderStyle 属性,但它似乎适用于整个边框而不仅仅是一侧。这可以在没有嵌套表的情况下完成吗?
对于我的情况,我希望在表格的前两行周围有一个实心边框(因为第一行有一个跨越两行的单元格),并在每个后续行周围有一个实心边框。
I'm trying to dynamically generate a report in a table where the borders are different on each side of a cell or row, but can't figure out how. The TableRow, TableCell, and Table objects each have a BorderStyle property, but it seems to apply to the entire border rather than just one side. Can this be done without nesting tables?
For my case, I'd like a solid border around the first two rows of a table (because the first row has a cell spanning two rows), and a solid border around each subsequent row.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是 CSS 的工作。
ASP.net 控件中的边框控件可能很笨重,甚至会误导使用。我建议向您的行和/或单元格添加一些 CssStyles,如下所示:
并在 CSS 标记内定义边框,如下所示:
至少这将使您对边框的布局有更多的控制。如果您需要表格边框的良好 CSS 参考,我会在此处查看 W3.org 页面
This looks like a job for CSS.
The border controls within the ASP.net controls can be chunky and mis-leading to use at best. I would suggest adding some CssStyles to your rows and or cells like this:
And defining up your borders within the CSS tags like this:
At the very least this will give you a lot more control over the layout of your borders. If you need a good CSS refrence for table borders I would check out the W3.org page here