Re: Excel to pdf command line
Von: B. R. 'BeAr' Ederson (br.ederson@expires-2007-08-31.arcornews.de) [Profil]
Datum: 20.08.2007 00:13
Message-ID: <12az4zpxb9yfd.dlg@br.ederson.news.arcor.de>
Newsgroup: alt.comp.freeware
Datum: 20.08.2007 00:13
Message-ID: <12az4zpxb9yfd.dlg@br.ederson.news.arcor.de>
Newsgroup: alt.comp.freeware
On Fri, 17 Aug 2007 13:18:10 -0700, gautam.bakshi@gmail.com wrote: > I am looking for a tool that converts excel files to pdf and can be > used with Microsoft windows command line. I doubt there is a directly working free program available for this. There is a workaround, though. If you right-click on *.xls files within the Windows shell, you'll see a "Print" entry. The printing is done via DDE. Take a look into your Registry. First look for *.xls in HKCR. The standard value of this key should be sth. like Excel.Sheet.8. Now browse down to a key of this name. Open the subkeys of that key to access <shell> -> <Print> -> <ddeexec> -> <ifexec>. The last one will have a DDE string as value, which will be executed if the Print entry of the right mouse menu inside the Windows shell is selected. You'll probably see: [open("%1")][print?()][quit()] (This hasn't changed at least between v97 and v2003, which versions I just checked.) Go to: www.microsoft.com/downloads/details.aspx?FamilyIDÀ9BF7F7-D30E-4CE9-8930-5D03748CA5C D to get the Excel macro help file as reference for the Print function. The possible parameters are: PRINT?(range_num, from, to, copies, draft, preview, print_what, color, feed, quality, y_resolution, selection) Only the last one is of importance, if you want to print whole workbooks rather than just the last active sheet. Change [print?()] in the DDE string above to [print?(,,,,,,,,,,,3)]. The number 3 for the "selection" parameter means: all sheets (2 = all selected sheets; 1 = selected range of the active page of all selected pages). Now you could print any *.xls file to the Windows standard printer. If you set up a *.pdf printer driver as standard, you don't need to make any more changes to the above mentioned DDE registry entry. If you prefer another printer as standard, you need to insert an entry like [PrinterSetup("MyPdfPrinter")] ahead of the print entry. (Replace "MyPdfPrinter" by the actual name of your *.pdf printer driver.) That much as preparation talk. Now a switch to freeware. ;-) If you don't already have a free *.pdf printer driver, you can get FreePdfXP here: www.shbox.de/fpx732.htm There are other ones out there. But that's the one I like best. ;-) Don't forget to install the current AFPL-Ghostscript as well, which is linked to from the same page above. To execute the printing from command line scripts: Grab the ClassExec utility written by Freddy Vulto: www.fvue.nl/wiki/ClassExec It provides the functionality to run DDE commands. HTH. BeAr -- ========================================================================== = What do you mean with: "Perfection is always an illusion"? ===============================================================--(Oops!)==[ Auf dieses Posting antworten ]
