使用iText C#将HTML转换为Excel文档 [英] Convert HTML to Excel document using iText C#

查看:200
本文介绍了使用iText C#将HTML转换为Excel文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用iText 7将HTML文件转换为Excel? 如果iText不支持,将HTML文件转换为Excel的最佳方法是什么? 谢谢

Is there is a way to convert HTML file to Excel using iText 7? If the iText doesn't support, what is the the best way to convert HTML file to Excel? Thanks

示例HTML代码如下:

sample HTML code as below:

<h1>Test</h1>
<p>Hello World</p>

推荐答案

据我所知,iText可以生成PDF文件.这样您将无法生成Excel文件. (这两种文件的共同点很少.)

As far as I know iText makes PDF files. You won't be able to produce Excel files with this. (The two kinds of files have very little in common.)

将HTML转换为Excel的最佳方法取决于许多因素:您使用C#标记了此问题.您是在服务器上运行还是要使Excel实例自动化?您正在使用什么框架?您有权访问文件系统吗? .Net核心?

The best way to convert HTML to Excel can depend on a number of factors: you tagged this question with C#. Are you running on a server or are you trying to automate an instance of Excel? What framework are you using? Do you have access to a filesystem? .Net Core?

您可以查看Microsoft OpenXML库中创建Excel文件的一个选项,但是以我的经验,它可能很脆弱,并且需要大量故障排除才能上手.但它不需要安装或许可的Excel.

You can look at the Microsoft OpenXML library for one option to create Excel files, but in my experience it can be brittle and require a lot of troubleshooting to get started. But it doesn't need Excel installed or licensed.

这篇关于使用iText C#将HTML转换为Excel文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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