Cli-Soffice将CSV转换为PDF,并以分离符为定界符

发布于 2025-02-02 02:26:54 字数 887 浏览 4 评论 0原文

我想使用Soffice命令将CSV文件从命令行转换为PDF文件。但是我的CSV文件是分离的,而不是逗号。

如果我使用命令:

soffice -convert-to pdf ./samplecsvfile.csv

这将为我提供pdf文件,但文件中有;。我找到了一篇文章,用分隔符将ODS转换为CSV的文章: https://ask.libreoffice.org/t/cli-convert-ods-convert-ods-to-conver-con-csv-with-spemitolon-as-as-delimiter/5021

与我如此相似尝试:

unoconv -f pdf -e FilterOptions="59,34,0,1" ./sampleCSVFile.csv

但这无济于事。 samplecsvfile.csv如下:

Level 1;Level2
Level 1;Level2
Level 1 ;Level2 
Level 1;Level2
Level 1 ;Level2 
Level 1;Level2
Level 1;Level2
Level 1;Level2
Level 1;Level2

有没有办法将此结肠分离的CSV文件转换为PDF? (没有将定系列结肠更改为逗号)

I want to convert the csv file to pdf file from command line using soffice command. But my csv file is colon separated instead of comma.

If I use command:

soffice --convert-to pdf ./sampleCSVFile.csv

This will give me pdf file but there are ; in the file. I found a article to convert to convert ods to csv with semicolon as delimiter: https://ask.libreoffice.org/t/cli-convert-ods-to-csv-with-semicolon-as-delimiter/5021

So similar to that I tried:

unoconv -f pdf -e FilterOptions="59,34,0,1" ./sampleCSVFile.csv

But it didn't help.
sampleCSVFile.csv as follow:

Level 1;Level2
Level 1;Level2
Level 1 ;Level2 
Level 1;Level2
Level 1 ;Level2 
Level 1;Level2
Level 1;Level2
Level 1;Level2
Level 1;Level2

Is there a way to convert this colon separated csv file to pdf?
(without changing the delimiter colon to comma)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抠脚大汉 2025-02-09 02:26:54

传统上,在DOS中,您使用edline编写文本文件,然后复制或键入con,com或lpn设备(行打印机)。

Windows仍然允许打印命令来执行此操作,并且可以通过记事本作为端口作为端口来呼应文本。我会跳过这一点,因为它不太适合您的用法。

但是,举例来说,在这里,我将您的文件并实际上打印到PDF FilePort,然后将端口结果调用到控制台。我可以使用一条线而不是两行,但它的gui视觉效果更高。

但是它不是跨平台,还有其他更简单的方法可以将文本转换为每个平台的PDF。

您询问有关Soffice的信息,并且原理是相同的,因为在发明了PDF之前。 soffice -infilter =“ Calc_pdf_export” - convert-convert-to pdf samplecsvfile.csv

您传输到导出的文本与导入相同。但是,印刷盲人可以添加默认打印标头,页脚(第1页)和样式。

最基本的方法

因为它是您 c haracter s epared v v alues file.txt中 将是相似的输出。唯一的区别是,PDF中没有诸如TAB或行包裹(因为它是虚拟激光打印机),而不是机械线馈电。

Traditionally in DOS you used Edline to write a text file then either Copy or Type to the Con, Com or Lpn device (Line PriNter).

Windows still allows the print command to do that, and its possible to echo text via Notepad to a PDF virtual printer as a port. I will skip that as it not quite suited to your usage.

However by way of example, here I take your file and print virtually to PDF FilePort then call the Port result to the console. I could use one line rather than two but its more GUI visual.

enter image description here

However its not cross platform, and there are other simpler ways to convert text to pdf per platform.

You ask about Soffice and the principles are much the same since before PDFs were invented. soffice --infilter="calc_pdf_export" --convert-to pdf sampleCSVFile.csv

The text you transPort to exPort is the same as you imPort. However printing blind can add default print headers, footers (Page 1) and styles.

enter image description here

Because it is the most basic of methods

Whatever is in your Character Separated Values File.txt will be similar output. The only difference is there is no such thing as a tab or line wrap in a PDF (as its a virtual laser printer) not a mechanical line feed one.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文