网页上的电子表格对象

发布于 2024-10-21 03:35:40 字数 765 浏览 6 评论 0原文

可能的重复:
Web 应用程序的类似电子表格的控件?

所以我不是确定有哪些类型的工具可用,所以我实际上不知道如何实现我想要的东西。

目前,我有一个网页,可以使用 javascript 解析用户提供的信息。基本上,有一个文本区域,用户只需根据我的规范复制粘贴格式化文本,在另一个文本区域中,它将根据给定的输入显示一个漂亮的格式化输出。

输入的结构类似于表格:任意数量的带标题的列和任意数量的代表唯一项目的行。这些列是用制表符分隔的,因此当我解析每个项目时,我会按制表符进行拆分,然后迭代每个字段。

因此,如果字段为空,您仍然必须有一个选项卡,以便数据正确排列。 我决定使用制表符,因为我们的数据可能包含各种字符,包括空格、逗号、句点等,因此制表符似乎是一个不错的选择。

我还发现电子表格是最容易使用的,人们只需在 Excel 上设置输入格式,然后将其作为制表符分隔值复制粘贴到我的网页上。这将完成工作所需的时间减少了十倍,他们真的很喜欢它。

一个评论是,我应该提供一种方法,允许人们直接在网页本身上格式化他们的输入,这样他们就不必在窗口之间切换或打开 Excel,但我说我不知道​​是否有办法做到这一点。

有没有办法将电子表格类型的对象放到网页上,我可以用 JavaScript 解析它?

Possible Duplicate:
Spreadsheet-like control for a web application?

So I'm not sure what sort of tools are available, and so I don't actually know how I might go about implementing what I want.

Currently, I have a webpage that parses information that the user provides using javascript. Basically, there's a textarea and users just copy-paste formatted text based on my specifications and in another textarea it will display a nice formatted output based on the input given.

The input is structured like a table: an arbitrary number of columns with headers and arbitrary number of rows representing unique items. The columns are tab-separated so when I parse each item, I split on tabs and then iterate over each field.

Because of this, if a field is empty, you must still have a tab so the data lines up properly.
I decided to use tabs because our data could contain all sorts of characters including spaces, commas, periods, etc. so tabs seemed like a pretty good option.

I've also found that a spreadsheet is the easiest to work with, where people can just format their input on excel and then copy-paste it as tab-separated values onto my webpage. This has reduced the amount of time required to get the job done by ten-fold and they really like it.

One comment was that I should provide a way to allow people to directly format their input on the webpage itself so they don't have to switch between windows or open excel, but I said I don't know if there are ways to do that.

Is there a way to get a spreadsheet-type of object onto a webpage where I can parse it with javascript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

狠疯拽 2024-10-28 03:35:40

我已经在 Rico 网格中看到了这一点( http://en.wikipedia.org/wiki /Rico_(Ajax) ) 允许您以电子表格形式查看网格。export-owc.html 在网页中嵌入了一个电子表格对象,其内容由 javascript 填写。
Microsoft 网站上的电子表格对象:
http://msdn.microsoft.com/en-我们/library/aa205671(v=office.11​​).aspx
我认为您可以使用对象上列出的所有属性和方法 - 例如提到的 Rico 文件具有以下几行,其中“ss”是电子表格对象的 id。

 var oSS=document.getElementById('ss')
  if (!oSS) {
    alert('Error! Can not find spreadsheet');
    return;
  }
  oSS.HTMLData=oDiv.innerHTML;

I've seen this in action in the Rico grids ( http://en.wikipedia.org/wiki/Rico_(Ajax) ) which allow you to view the grid as a spreadsheet. export-owc.html has an spreadsheet object embedded in the webpage, and the contents of which is filled out by javascript.
Microsoft site on spread sheet object:
http://msdn.microsoft.com/en-us/library/aa205671(v=office.11).aspx
I think you can use all the listed properties and methods on the object -- for example the Rico file mentioned has following lines where 'ss' is the id of the spreadsheet object.

 var oSS=document.getElementById('ss')
  if (!oSS) {
    alert('Error! Can not find spreadsheet');
    return;
  }
  oSS.HTMLData=oDiv.innerHTML;
与之呼应 2024-10-28 03:35:40

Sencha/EXT 框架具有数据网格功能。

The Sencha/EXT framework has data grid capabilities.

清引 2024-10-28 03:35:40

尝试 SlickGrid - 这是我们在 dirigible - v 灵活的电子表格/网格组件,可以是只读或可编辑的。我会保留文本区域供人们剪切和保存。将原始文本粘贴到其中,然后您应该能够解析它并填充页面上其他位置的 slickgrid,用户可以根据需要进行编辑。

Try SlickGrid - it's what we use on dirigible - v flexible spreadsheet/grid component, can be read-only or editable. I'd keep the textarea for ppl to cut & paste raw text into, you should then be able to parse it and populate the slickgrid elsewhere on the page, which users can then edit if they need to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文