我有一个这样的html文件,可以使用Libreoffice打开该文件,然后将其导出到Excel
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Tables</title>
<meta name="generator" content="LibreOffice 4.2.8.2 (Linux)">
<meta name="created" content="20170328;3115845446710">
<meta name="changed" content="20170328;3152295681061">
<style type="text/css"><!--
body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small }
-->
</style>
但我想知道是否存在通过命令行执行此操作的方法
如果可以在LibreOffice中正常打开文件,则可以使用此文件
libreoffice --convert-to xls myfile.html
或这个
libreoffice --convert-to xlsx myfile.html
取决于您想要的格式。更改libreoffice
为soffice
前者在您的系统上不可用
有时(尤其是如果您使用的是旧版的LibreOffice),您还需要--headless
选择
libreoffice --headless --convert-to xlsx myfile.html
您也可以使用unoconv
unoconv -f xlsx myfile.html
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句