Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将html片段导入Excel_Excel_Aspose Cells - Fatal编程技术网

如何将html片段导入Excel

如何将html片段导入Excel,excel,aspose-cells,Excel,Aspose Cells,要求: 1.我需要将表格导出为excel文件 2.我首先在html页面中呈现它。我有一个按钮导出到html 我的意见是: 1.我从以下页面获取html: document.getElementById('content').value = document.getElementById('containerId').innerHTML; form1.submit(); 2.我从服务器response.ContentType=“application/vnd.ms excel;”获取它//它需

要求:

1.我需要将表格导出为excel文件

2.我首先在html页面中呈现它。我有一个按钮导出到html

我的意见是:

1.我从以下页面获取html:

document.getElementById('content').value = document.getElementById('containerId').innerHTML;

form1.submit();
2.我从服务器response.ContentType=“application/vnd.ms excel;”获取它//它需要客户端已经安装了Microsoft excel

3.我得到了正确的Excel文件“XXXX.xls”

但是,当我打开它的时候,它发出了警告,告诉我

  "it's not the right format of Excel, are you confirm to open it?"
看到这件事我很难过

因此,我想将HTML部分导入Excel文件,然后将正确的Excel文件响应到USER-AGENT


我在我的项目中使用了Aspose.Cells库,我不知道如何使用它来完成任务,或者是否有其他解决方案来解决它?

如果需要使用Aspose.Cells for.NET将html标记/部分解析为Excel电子表格,可以使用Cell.HtmlString属性在单元格中设置所需的html代码段,它将在生成的Excel文件中进行相应的分析。请注意,目前并非所有的html标记都受支持

Aspose.Cells for.NET还支持将Excel文件直接转换为Html文件,请参阅支持转换文件格式的文档,它可能会帮助您参考:

如果您仍然有一些问题/困惑,请使用Aspose.Cells API提供您的示例代码的详细信息,我们可以帮助您