Skip to main content
Question

Choose cells in ExcelToPDFWriter


philippeb
Enthusiast
Forum|alt.badge.img+20

Hello,

I'm using ExcelToPDFWriter to export Excel files into PDF. It works fine.

But my Excel files are huge and many informations are useless (for me). I would like to decide which rows/columns for the sheets I want to export to PDF.

Do you have an idea how I could to that? Changing the Python code maybe?

Thanks!

6 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • April 9, 2019

@philippeb

Deciding which etc. , suggest a set of criteria to apply.

So basically that is what you need to do. The set-up will depend on your data.

It is a basic operational process and is described a lot on thit forum.

Often python is not needed for this (I prefer tcl anyway..;)). Depending on the dynamism of your data. (or of course complexity of operations)

 

For more specific answers you are encouraged to provide a set of sample data.

 

greets,

 

Gio

 


redgeographics
Celebrity
Forum|alt.badge.img+49

I haven't used the ExcelToPDFWriter but I would think using an AttributeRemover or AttributeKeeper after reading in the data to remove attributes you don't want to see in the output would be a good thing to try.


philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • April 10, 2019
redgeographics wrote:

I haven't used the ExcelToPDFWriter but I would think using an AttributeRemover or AttributeKeeper after reading in the data to remove attributes you don't want to see in the output would be a good thing to try.

It would be a good idea but unfortunatly the transorfmer doesn't work that way. It reads the file's path and creates the conversion. The XLS isn't load into the workbench. A File Pathnames Reader is all it needs to make it works.


redgeographics
Celebrity
Forum|alt.badge.img+49
philippeb wrote:

It would be a good idea but unfortunatly the transorfmer doesn't work that way. It reads the file's path and creates the conversion. The XLS isn't load into the workbench. A File Pathnames Reader is all it needs to make it works.

Right, I hadn't looked at it closely. It appears to simply be a wrapper for an Excel function and it doesn't look like there's anything in the Python code that says which columns to include.

So, unless you want to edit the Excel file itself, I think what you can do is read the Excel file using the regular reader, using an AttributeKeeper, AttributeRemover or AttributeManager to select the columns you want, then a FeatureWriter to write it to a temporary Excel file and then run that through the ExcelToPDFWriter. Clunky, I know, but I can't really think of a better way.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • April 10, 2019

The ExportAsFixedFormat which the ExcelToPDFWriter uses doesn't have a lot of scope for selecting only certain columns and rows to export, although it does look like it should be possible to only select a range instead of a whole sheet for printing.

An alternative approach would be to create excel files containing only the information you want with a featurewriter and then use the ExcelToPDFWriter following on from that, deleting the excel files at the end.


philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • April 10, 2019
redgeographics wrote:

Right, I hadn't looked at it closely. It appears to simply be a wrapper for an Excel function and it doesn't look like there's anything in the Python code that says which columns to include.

So, unless you want to edit the Excel file itself, I think what you can do is read the Excel file using the regular reader, using an AttributeKeeper, AttributeRemover or AttributeManager to select the columns you want, then a FeatureWriter to write it to a temporary Excel file and then run that through the ExcelToPDFWriter. Clunky, I know, but I can't really think of a better way.

Maybe clunky, but if it works, I'll be very happy! I think it's a very good idea!

I'll give it a try when I have some free time. Thanks a lot!! :D


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings