在浏览器中将 .xls 文件数据显示为 Web 内容 [英] display .xls file data in a browser as a web content
问题描述
我正在尝试在浏览器中显示 .xls 文件数据(首选 ie、ff、chrome 和 safari)作为网络内容.
I am trying to display display .xls file data in a browser(prefer ie,ff,chrome and safari) as a web content.
问题是我的计算机中有一个 .xls 文件,我将在其中执行 xls 文件中的所有数据操作,并希望其中的数据显示在浏览器中,供其他人查看,就像网页中的内容一样.
The thing is i have an .xls file in my computer where i'll all the data manipulations in the xls file and want the data in it to b displayed in a browser for others to see just as a content in a webpage.
我正在计划使用 javascript,有人可以帮助我吗?我几乎尝试了所有可能的方法以及许多网站上关于这种程序的所有帖子,但没有什么适合我的想法.如果有人能帮我解决这个问题,我真的很感激.
I am planning this with a javascript, could anyone help me with this? i almost tried all the possible ways and all the posts in many sites about this kind of procedure but nothing suited my idea. I wld really appriciate if anyone cld get me out of this problem.
推荐答案
您几乎肯定必须在服务器端执行此转换.如果不是不可能的话,客户端 javascript 会很棘手,因为 XLS 文件不是 HTML,因此不能在其中包含 标签来告诉浏览器该做什么.您可以将 XLS 嵌入到 iframe 中,并让 JS 对其进行操作,但是 iframe 使用起来很麻烦,并且在 HTML 5 中已被弃用(据我所知).即使这可以正常工作,但听起来仍然不是原始文档的客户端处理是一个好主意.
You're almost certainly going to have to do this transformation server-side. Client-side javascript is going to be tricky if not impossible, because an XLS file is not HTML, and so cannot have <script>
tags in it to tell the browser what to do. You could possibly embed the XLS in an iframe, and have the JS operate on it, but iframes can be a pain to work with, and are deprecated in HTML 5 (to my understanding). Even if this could work cleanly it still doesn't sound like client-side processing of the raw document is a good idea.
所以第一步是研究哪些服务器端技术(例如PHP、JSP、ASP) 你有空.第二步是为其中一种技术找到一个能够打开和读取 XLS 文件的库(不是一项简单的任务).然后第三步是编写所需的代码来打开您的 XLS 文件,提取所需的信息并将其输出为 HTML.(将第三步视为将 XLS 输入转换为 HTML 输出,这可能会有所帮助,这正是您要执行的操作.
So first step is to investigate what server-side technologies (e.g. PHP, JSP, ASP) you have available. Second step is to find a library for one of these technologies that is capable of opening and reading XLS files (not a simply task). Then the third step is to write the required code to open your XLS file, extract the required information and output it as HTML. (It may help to think of this third step as transforming an XLS input into an HTML output, which is exactly what you're trying to do).
这篇关于在浏览器中将 .xls 文件数据显示为 Web 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!