1

I have a SQL that spools some results to a CSV file which then gets e-mailed out to customers. The way that Microsoft Excel (usually the end users default application for opening CSV files) is slightly confusing for some end users in that the columns usually need to be made larger (otherwise #'s are shown etc.) before it can be printed.

Is it possible to spool straight to a PDF file, or to convert the CSV to an easier to read PDF before e-mailing out?

I searched online for a command-line tool to convert a CSV to a PDF but come up blank. This is generated on a Red Hat Enterprise Linux server without a RHN subscription so something with a lot of dependencies would be a nightmare to install.

4

2 回答 2

0

是的,有几个针对不同平台的免费和专有的 txt2pdf 程序。对txt2pdf的谷歌搜索给出了大量的点击量。剩下的就是将 csv 转换为文本(这很容易,因为 csv文本)

您可能想编写(或要求)一个简单的脚本,在将 csv 转换为 pdf 之前将其更改为您的喜好。

于 2013-11-06T18:33:24.060 回答
0

添加 thom 给出的回复,您实际上可以(如果可能)编辑 SQL 文件本身以生成一个带有所需分隔符和空格的 txt 文件,从而消除将 csv 转换为 txt 的需要。就像我有一个 sql 文件,它使用逗号分隔的列值打印文本文件的每一行中的一行中存在的数据,并且每个记录(或元组)由一行“|”分隔。您可以检查我设置的每个属性及其代表什么,从而可以根据需要打印出一些东西

SET SPACE 0
SET LINESIZE 500
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET TRIMSPOOL ON
SET RECSEP each
SET RECSEPCHAR |
SPOOL spool_out.txt
select col1||','||col2||','||col3||','||col4 from table;
SPOOL OFF
exit
/

于 2013-11-10T14:42:40.083 回答