HTML表格数据移植到可读文件的最简单方法 [英] Easiest way of porting html table data to readable document

查看:139
本文介绍了HTML表格数据移植到可读文件的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,

有关过去6个月我一直struggeling建立一个系统,让大性感文本域的形式用户输入(与表支持负载,列出等)。 pretty多使得用户能够输入数据,好像它是字。但是想要导出所有这些数据我一直没能找到工作解决方案时...

For the past 6 months i've been struggeling to build a system that allows user input in form of big sexy textareas(with loads of support for tables,list etc). Pretty much enables the user to input data as if it were word. However when wanting to export all this data I haven't been able to find a working solution...

我的第一步是尝试,发现确实从数据源支持原始HTML和呈现为普通的HTML报表软件,完美地工作除了继续共同作用是可怕的,无论是数据被劈成两半(表,清单等),我不想要。或者报告总是跳到下一个页面,以避免这种情况,最后文件内15岁以上的空页结束了。

My first step was to try and find a reporting software that did support raw HTML from the data source and render it as normal html, worked perfectly except that the keep together function is awful, either data is split in half(tables,lists etc) which I dont want. Or report always skips to the next page to avoid this, ending up in 15+ empty pages within the final document.

因此​​,进出口寻找某种尖/方向,什么是最好的解决方案,我的数据导出到一个可读的文件(PDF或Word preF)。

So Im looking for some kind of tip/direction to what would be the best solution to export my data into a readable document(pdf or word pref).

我得到的是以下数据细分,其中的数据往往是原始的HTML。

What I got is the following data breakdown, where data is often raw html.

-period

- 单位

---集团

----问题

-----数据

什么是最好的选择?试图渲染HTML到PDF或rtf?我需要提示:(

What would be the best choice? Trying to render html to pdf or rtf? I need tips :(

和有时也该数据是2-3页长,混合表列表和纯文本。

And also sometimes the data is 2-3 pages long with mixed tables lists and plain text.

推荐答案

我建议你尽量保持这个浏览器,并添加的打印样式表到HTML,使其呈现在屏幕上的一个方式的在纸上的另一种方式。添加打印样式表到HTML是那么容易,因为这样的:

I would suggest that you try to keep this in the browser, and add a print stylesheet to the HTML to make it render one way on the screen and another way on paper. Adding a print stylesheet to your HTML is as easy as this:

<link rel="stylesheet" media="print" href="print.css">

您应该能够像的Html敏捷性包解析输入它,改造它(即 XSLT ),以任何你想要的输出格式。

You should be able to parse the input it with something like Html Agility Pack and transform it (i.e. with XSLT) to whatever output format you want.

另一种方法是编写HTML浏览器,但内容类型设置到Microsoft Word特定变种(有几种可供选择,这取决于你的目标的Word版本)应该,如果用户想使用Microsoft Word打开网页浏览器的要求。与Word 2007和更新,你也可以写的Office Open XML Word中直接,因为它是基于XML的。

Another option is to write HTML to the browser, but with Content-Type set to a Microsoft Word-specific variant (there are several to choose from, depending on the version of Word you're targeting) should make the browser ask if the user wants to open the page with Microsoft Word. With Word 2007 and newer you can also write Office Open XML Word directly, since it's XML-based.

您可以使用的内容类型是:

The content-types you can use are:

application/msword

有关二进制Microsoft Word文件,也应适用于HTML。

For binary Microsoft Word files, but should also work for HTML.

application/vnd.openxmlformats-officedocument.wordprocessingml.document

有关Word 2007中的新的Office Open XML的格式和更新。

For the newer "Office Open XML" formats of Word 2007 and newer.

这篇关于HTML表格数据移植到可读文件的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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