简体   繁体   English

通过保留格式将页面内容复制到excel中

[英]Copy content of a page into excel by preserving the formatting

I have a page in angular js. 我在angular js中有一个页面。 There is a table like view on the page. 页面上有一个类似于视图的表格。 This has been achieved using div tags and not a table tag. 这是使用div标签而非表格标签实现的。 After copying this content into excel , its formatting changes. 将此内容复制到excel后,其格式会更改。 It does not get copied as it is.Any changes I can do in HTML file to copy it exactly how it is on the webpage? 它不会被原样复制。我可以在HTML文件中进行任何更改以完全复制它在网页上的显示方式吗?

In case you need a full copy of the table - you could create a separate "view" on the same page with a proper table markup (placed outside of viewport). 如果您需要表格的完整副本-您可以在同一页面上使用适当的表格标记(放置在视口之外)创建一个单独的“视图”。 And have a button to "copy table" with code attached that will put your table into clipboard. 并有一个按钮,用于“复制表”并附带代码,该代码会将表放入剪贴板。

Another guess is that you had to switch to divs because table markup didn't allow you something. 另一个猜测是您必须切换到div,因为表标记不允许您执行某些操作。 In that case - look at handsontable library for google docs like tables. 在这种情况下-查看表等Google文档的handsontable库。 They have a community version and there is some bridge for angular as well. 他们有一个社区版本,也有一些角度的桥梁。 Maybe it'll do you some good. 也许会对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM