Focal Point
Using excel template and macros and dos commands together

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6971082902

January 24, 2007, 02:51 PM
getit
Using excel template and macros and dos commands together
Hi,
I really need help with this from the webfocus gurus out there.
I am trying to save an excel template file onto to the server and use a macro with this to convert one of the worksheet in the template file to a *.ps file using a macro and then access this *.ps on the webfocus server thru a command line and use a program(ps2pdf) to convert this file to a *.pdf file. Then I need to open this pdf file to the user. This has to be one click. I am able to do some of it seperately. Here is the partial code that I am trying to do.

APP HOLD baseapp
TABLE FILE CAR
PRINT MODEL
BY CAR
ON TABLE HOLD AS 'PMW1' FORMAT EXL2K TEMPLATE 'pmw' SHEETNUMBER 2
END

There are two worksheets in the template , first will have all the formatting.So once the sheet2 gets loaded with webfocus data,sheet1 will get populated. I am not sure a proper way of saving this excel PMW11.xls on to the server ,so that it can be accessed later.

Also then a macro needs to run in the excel file,which will print this PMW1.XLS file to a PMW1.ps file,

Sub Macro1()
Application.ActivePrinter = "CutePDF Writer on CPW2:"
ActiveWindow.SelectedSheets.PrintOut copies:=1, ActivePrinter:= _
"CutePDF Writer on CPW2:", Collate:=True, PrintToFile:=True, PrToFileName:="c:\PMW1.ps"
End Sub

After this a dos command should run to access the PMW1.ps file stored on the WF server,

c:\ ps2pdf PMW1.ps PMW1.pdf.

Then I need to display this pdf file using htmlform. I can delete the PMW1.ps and PMW1.pdf files later.

I need help with the following in the webfocus fex,
1. saving an excel template file to the wfserver.
2. Running a macro on it to create a new file.
3. Accessing the new file from command line

Cutepdf and ps2pdf are free and let me know if you wish to download them to test this. This is just for info and they need not be downloaded to answer my concerns unless u want to test the whole process.

If this works out we would have a method to convert any excel template stored on WF server to PDF.
This is a complex process and any help is greatly appreciated.


App Studio Version 8202
windows Platform
SQL Server 2008/2012
January 24, 2007, 03:01 PM
Leah
Does your template do any calculations. I've not used excel templates per se. Would using style sheet commands and just creating a PDF file to start with work for you?


Leah
January 24, 2007, 03:10 PM
getit
No ,that did not work,
we had complex styling (inverted column titles,which we tried even to do as gif images )and images in rows not just in the heading ,which did not work with a direct pdf. Have tried all options to get this done using style sheet and pdf.
Template does not do any calculations.


App Studio Version 8202
windows Platform
SQL Server 2008/2012