gpt4 book ai didi

html - pandoc 将带有样式表的 html 转换为 docx

转载 作者:太空狗 更新时间:2023-10-29 13:27:13 26 4
gpt4 key购买 nike

几个小时以来,我一直在努力解决这个问题,我确信解决方案非常简单,或者根本不存在。

我正在尝试将 html 文件转换为 docx!

<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #d0e4fe;
}

h1 {
color: orange;
text-align: center;
}

p {
font-family: "Times New Roman";
font-size: 20px;
}
</style>
</head>
<body>

<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>

</body>
</html>

我可以毫无问题地转换它,但我无法让样式保持不变。

pandoc -s myfile.html -o test64.docx
pandoc -s -c myfile.css myfile.html -o test64.docx

请救救我

最佳答案

以上答案不再有效。根据文档,您现在使用以下方法生成模板:

pandoc --print-default-data-file reference.docx > custom-reference.docx

有关如何使用模板的完整文档,请转到 the documentation并搜索“--reference-doc”

关于html - pandoc 将带有样式表的 html 转换为 docx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29483060/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com