在 SVG 中创建表格 [英] Create a table in SVG

查看:52
本文介绍了在 SVG 中创建表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 SVG 文档中创建一个类似表格的对象.目前,由于 SVG 没有表格元素,我使用 HTML 解析器将 HTML 表格(由用户在 HTML 表格生成器中创建)转换为一组 SVG 对象,并且然后将其添加到我的整体 SVG 绘图中.我想知道是否有人能够找到这种方法的更好替代方法,例如 SVG 表构建器?我希望使用 Javascript 或 jquery 来完成此操作.任何想法或建议将不胜感激.

I'm trying to create a table-like object within an SVG document. Currently, due to the fact that SVG does not have a table element, I am using an HTML parser to go through and convert an HTML table, (created by the user in an HTML table Builder), to a group of SVG objects, and then adding that to my overall SVG drawing. I was wondering if any one was able to find a better alternative to this method, such as an SVG table builder? I'm looking to accomplish this using Javascript or jquery. Any ideas or suggestions would be appreciated.

推荐答案

我只想在我的 SVG 中嵌入一个真实的表格:

I would simply embed a real table in my SVG:

<?xml version="1.0" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg">
  <foreignObject x="10" y="10" width="100" height="150">
    <body xmlns="http://www.w3.org/1999/xhtml">
      <table><!-- ... --></table>
    </body>
  </foreignObject>
  <!-- ... -->
</svg>

这篇关于在 SVG 中创建表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆