PyODConverter: converting CSV to PDF

363 views
Skip to first unread message

Friendlyguy

unread,
Nov 2, 2009, 4:56:54 PM11/2/09
to JODConverter
Hi,

I'm back with another question. What filter setting would you
recommend to convert CSV files to PDF?
Currently I'm getting the following error when I try to convert a
simple CSV file.

C:\temp\pdf>"c:\Program Files\OpenOffice.org 3\program\python.exe" c:
\aolserver\
bin\DocumentConverter.py 528009\538027photos.csv csv.pdf
Traceback (most recent call last):
File "c:\aolserver\bin\DocumentConverter.py", line 143, in <module>
converter.convert(argv[1], argv[2])
File "c:\aolserver\bin\DocumentConverter.py", line 82, in convert
filterName = self._filterName(document, outputExt)
File "c:\aolserver\bin\DocumentConverter.py", line 90, in
_filterName
family = self._detectFamily(document)
File "c:\aolserver\bin\DocumentConverter.py", line 101, in
_detectFamily
if document.supportsService
("com.sun.star.text.GenericTextDocument"):
AttributeError: 'NoneType' object has no attribute 'supportsService'

I tried adding each of the following to the FILTER_MAP section of
DocumentConverter.py but had no success in converting CSV documents.

"csv": { FAMILY_SPREADSHEET: "MS Excel 97" },
"csv": { FAMILY_SPREADSHEET: "Text - txt - csv (StarCalc)" },
I even tried
"csv": { FAMILY_TEXT: "Text" },

If I understand the OpenOffice output correctly, it seems to be unable
to determine the file type of the CSV. Could that be right?

many thanks again for all your assistance,
best wishes
Brian

Mirko Nasato

unread,
Nov 3, 2009, 8:10:14 AM11/3/09
to jodcon...@googlegroups.com
Hi Brian,

The filters defined in DocumentConverter.py are *export* filters, i.e.
those used when storing the output. Now to read CSVs you want an
*import* filter instead used when loading the document. JODConverter
does support import options, but the Python script is simpler and
doesn't do that at present.

After that, you'll need to understand which FilterOptions to pass
along with the CSV filter: http://bit.ly/24CdUP

Kind regards

Mirko

2009/11/2 Friendlyguy <brian....@gmail.com>:

Friendlyguy

unread,
Nov 3, 2009, 9:17:52 AM11/3/09
to JODConverter
Hi Mirko

Thanks very much for the reply. Now I understand it. That's good to
know.

many thanks for all your help
Brian

On Nov 3, 2:10 pm, Mirko Nasato <mirko.nas...@gmail.com> wrote:
> Hi Brian,
>
> The filters defined in DocumentConverter.py are *export* filters, i.e.
> those used when storing the output. Now to read CSVs you want an
> *import* filter instead used when loading the document. JODConverter
> does support import options, but the Python script is simpler and
> doesn't do that at present.
>
> After that, you'll need to understand which FilterOptions to pass
> along with the CSV filter:http://bit.ly/24CdUP
>
> Kind regards
>
> Mirko
>
> 2009/11/2 Friendlyguy <brian.fen...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages