Is there a way to make changes to a report in the manner below after
the executable is made? I'd like to parse the report according to the
user's selections. Thanks

***********code - not mine
LOCAL ARRAY laForms[1], laLinesToWipe[1], laSettings[1]
LOCAL lnCurForm, lnFormCount, llNeedsCompiling, lcOldDir,
lnNamesOnLine, ;
lcOldFont, lnNumSettings, lcTargSetting, lnLoop, lcNewExpr
*----------------------------- Program Code Begin
-------------------------
-


#define MAX_LINE_NAMES 4
#define NAME_WIDTH 28


lcOldDir = ALLTRIM(SET("DEFAULT")+ALLTRIM(CURDIR()))
IF !EMPTY(tcWhere) AND TYPE("tcWhere") = 'C'
set default to (tcWhere)
ENDIF


CLEAR


CLOSE TABLES ALL


IF MessageBox("About to clear printer info from all reports
in"+CHR(13)+CHR(13)+ ;
ALLTRIM(CURDIR())+CHR(13)+CHR(13)+ ;
"Go for it?",36,"Mass Report Update!") != 6


WAIT "Aborted." WINDOW TIMEOUT 1


set default to (lcOldDir)
RETURN .F.
ENDIF


lcOldFont = _SCREEN.FontName
_SCREEN.FontName = "Courier New"


lnNamesOnLine = 0


*
* Identify lines in FRX expr field to wipe out:
*
DIMENSION laLinesToWipe[3]
laLinesToWipe[1] = "DRIVER="
laLinesToWipe[2] = "DEVICE="
laLinesToWipe[3] = "OUTPUT="


*
* For each FRX file in the current directory:
*
lnFormCount = ADIR(laForms,"*.FRX")
ASORT(laForms,1)
FOR lnCurForm = 1 TO lnFormCount


llNeedToCompile = .F.


*
* Open the form as a table:
*
USE (laForms[lnCurForm,1]) IN 77
SELECT 77


*
* The first record has the printer info:
*
LOCATE


IF !EMPTY(tag) OR !EMPTY(tag2)
llNeedToCompile = .T.
ENDIF


*
* Clear the tag fields:
*
REPLACE tag WITH "", ;
tag2 WITH ""


*
* Remove the printer info from the expr field:
*
lnNumSettings = ALINES(laSettings,expr,.T.)
lnLoop = 1
DO WHILE lnLoop <= lnNumSettings
lnInc = 1
FOR EACH lcTargSetting IN laLinesToWipe
IF lcTargSetting $ laSettings[lnLoop]
llNeedToComile = .T.
ADEL(laSettings,lnLoop)
lnNumSettings = lnNumSettings -
1
lnInc = 0
ENDIF
ENDFOR
lnLoop = lnLoop + lnInc
ENDDO


lcNewExpr = ""
FOR lnLoop = 1 TO lnNumSettings
lcNewExpr =
lcNewExpr+ALLTRIM(laSettings[lnLoop])+CHR(13)+CHR(10)
ENDFOR
REPLACE expr WITH lcNewExpr
*MessageBox("Before: "+chr(13)+expr+chr(13)+chr(13)+"After:
"+chr(13)+lcNewExpr)


IF lnNamesOnLine < MAX_LINE_NAMES
??
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)

ELSE
?
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)

lnNamesOnLine = 0
ENDIF
lnNamesOnLine = lnNamesOnLine + 1


SELECT 77
USE


*
* Compile the FRX:
*
IF llNeedToCompile
COMPILE REPORT (laForms[lnCurForm,1])
ENDIF
ENDFOR


set default to (lcOldDir)


Marcel Jalbert seemed to utter in
news:22Wi7.289588$v5.29128506@news1.rdc1.ct.home.com:




- Hide quoted text -
- Show quoted text -

> I been working around a problem for years where a FoxPro report form
> fails to print to the selected printer or to the Windows default
> printer. Anyway to make a long story short, when I compose a report
> form for a printer that exists on the Desktop or Server the application
> always prints to that printer. I'm use VFP 6.0 sp4 and have seen this
> problem on Windows 95 and NT desktops and VFP 5.0. By compose I mean;
> Modify the Report, go to "Page Setup" select a printer, click OK and
> save the report form. There appears to be some hard coding in the
> report form that identifies the printer name the report form was
> designed for. If this printer name exists this hard coding seems to
> override the destination printer settings your application would
> normally print to. There are a couple of ways I get around this
> problem.

> 1) Temporarily change the name of the printer you want to compose the
> report form for, select the printer while editing the report from and
> save it. Recompile your code and rename the printer back to it usually
> name. You can't rename a printer with Windows NT.


> 2) Variations on the same theme that works with Windows NT would be to
> temporarily install a printer on the PC that the application will never
> printer to. Compose the report form for that printer, save it,
> recompile and delete the installed printer.


> 3) Have multiple copies of your report forms. Each composed for the
> printers you want the reports to go to. (Not a desirable solution)


> Has anyone else seen this problem? Is it on a FoxPro bug list? Am I
> doing somethink I shouldn't or is there a better work around?


> Thanks!
> Marcel



--

Re: Changing a report after the exe is made by Dan

Dan
Tue Mar 28 15:21:01 CST 2006

If you include the reports in the exe, they are read-only. You need to copy
them to a file on disk to write to them.

You appear to be stripping printer-specific information from the EXPR field.
Why not do that at the time the exe is built using a projecthook?

Dan

wipeout64@hotmail.com wrote:
> Is there a way to make changes to a report in the manner below after
> the executable is made? I'd like to parse the report according to the
> user's selections. Thanks
>
> ***********code - not mine
> LOCAL ARRAY laForms[1], laLinesToWipe[1], laSettings[1]
> LOCAL lnCurForm, lnFormCount, llNeedsCompiling, lcOldDir,
> lnNamesOnLine, ;
> lcOldFont, lnNumSettings, lcTargSetting, lnLoop, lcNewExpr
> *----------------------------- Program Code Begin
> -------------------------
> -
>
>
> #define MAX_LINE_NAMES 4
> #define NAME_WIDTH 28
>
>
> lcOldDir = ALLTRIM(SET("DEFAULT")+ALLTRIM(CURDIR()))
> IF !EMPTY(tcWhere) AND TYPE("tcWhere") = 'C'
> set default to (tcWhere)
> ENDIF
>
>
> CLEAR
>
>
> CLOSE TABLES ALL
>
>
> IF MessageBox("About to clear printer info from all reports
> in"+CHR(13)+CHR(13)+ ;
> ALLTRIM(CURDIR())+CHR(13)+CHR(13)+ ;
> "Go for it?",36,"Mass Report Update!") != 6
>
>
> WAIT "Aborted." WINDOW TIMEOUT 1
>
>
> set default to (lcOldDir)
> RETURN .F.
> ENDIF
>
>
> lcOldFont = _SCREEN.FontName
> _SCREEN.FontName = "Courier New"
>
>
> lnNamesOnLine = 0
>
>
> *
> * Identify lines in FRX expr field to wipe out:
> *
> DIMENSION laLinesToWipe[3]
> laLinesToWipe[1] = "DRIVER="
> laLinesToWipe[2] = "DEVICE="
> laLinesToWipe[3] = "OUTPUT="
>
>
> *
> * For each FRX file in the current directory:
> *
> lnFormCount = ADIR(laForms,"*.FRX")
> ASORT(laForms,1)
> FOR lnCurForm = 1 TO lnFormCount
>
>
> llNeedToCompile = .F.
>
>
> *
> * Open the form as a table:
> *
> USE (laForms[lnCurForm,1]) IN 77
> SELECT 77
>
>
> *
> * The first record has the printer info:
> *
> LOCATE
>
>
> IF !EMPTY(tag) OR !EMPTY(tag2)
> llNeedToCompile = .T.
> ENDIF
>
>
> *
> * Clear the tag fields:
> *
> REPLACE tag WITH "", ;
> tag2 WITH ""
>
>
> *
> * Remove the printer info from the expr field:
> *
> lnNumSettings = ALINES(laSettings,expr,.T.)
> lnLoop = 1
> DO WHILE lnLoop <= lnNumSettings
> lnInc = 1
> FOR EACH lcTargSetting IN laLinesToWipe
> IF lcTargSetting $ laSettings[lnLoop]
> llNeedToComile = .T.
> ADEL(laSettings,lnLoop)
> lnNumSettings = lnNumSettings
> - 1
> lnInc = 0
> ENDIF
> ENDFOR
> lnLoop = lnLoop + lnInc
> ENDDO
>
>
> lcNewExpr = ""
> FOR lnLoop = 1 TO lnNumSettings
> lcNewExpr =
> lcNewExpr+ALLTRIM(laSettings[lnLoop])+CHR(13)+CHR(10)
> ENDFOR
> REPLACE expr WITH lcNewExpr
> *MessageBox("Before: "+chr(13)+expr+chr(13)+chr(13)+"After:
> "+chr(13)+lcNewExpr)
>
>
> IF lnNamesOnLine < MAX_LINE_NAMES
> ??
> PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
>
> ELSE
> ?
> PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
>
> lnNamesOnLine = 0
> ENDIF
> lnNamesOnLine = lnNamesOnLine + 1
>
>
> SELECT 77
> USE
>
>
> *
> * Compile the FRX:
> *
> IF llNeedToCompile
> COMPILE REPORT (laForms[lnCurForm,1])
> ENDIF
> ENDFOR
>
>
> set default to (lcOldDir)
>
>
> Marcel Jalbert seemed to utter in
> news:22Wi7.289588$v5.29128506@news1.rdc1.ct.home.com:
>
>
>
>
> - Hide quoted text -
> - Show quoted text -
>
>> I been working around a problem for years where a FoxPro report form
>> fails to print to the selected printer or to the Windows default
>> printer. Anyway to make a long story short, when I compose a report
>> form for a printer that exists on the Desktop or Server the
>> application always prints to that printer. I'm use VFP 6.0 sp4 and
>> have seen this problem on Windows 95 and NT desktops and VFP 5.0.
>> By compose I mean; Modify the Report, go to "Page Setup" select a
>> printer, click OK and save the report form. There appears to be
>> some hard coding in the report form that identifies the printer name
>> the report form was designed for. If this printer name exists this
>> hard coding seems to override the destination printer settings your
>> application would normally print to. There are a couple of ways I
>> get around this problem.
>
>> 1) Temporarily change the name of the printer you want to compose the
>> report form for, select the printer while editing the report from and
>> save it. Recompile your code and rename the printer back to it
>> usually name. You can't rename a printer with Windows NT.
>
>
>> 2) Variations on the same theme that works with Windows NT would be
>> to temporarily install a printer on the PC that the application will
>> never printer to. Compose the report form for that printer, save it,
>> recompile and delete the installed printer.
>
>
>> 3) Have multiple copies of your report forms. Each composed for the
>> printers you want the reports to go to. (Not a desirable solution)
>
>
>> Has anyone else seen this problem? Is it on a FoxPro bug list? Am I
>> doing somethink I shouldn't or is there a better work around?
>
>
>> Thanks!
>> Marcel



Re: Changing a report after the exe is made by TonySper

TonySper
Tue Mar 28 18:32:36 CST 2006

I had similar problems with the printing. At times it would shut the
printer down or put it into standby. I have a small program now that I
run on all the .FRX files before I make up the exe file that strips
the printer code off of them.
TonySper

<wipeout64@hotmail.com> wrote in message
news:1143574706.441769.207890@j33g2000cwa.googlegroups.com...
Is there a way to make changes to a report in the manner below after
the executable is made? I'd like to parse the report according to the
user's selections. Thanks

***********code - not mine
LOCAL ARRAY laForms[1], laLinesToWipe[1], laSettings[1]
LOCAL lnCurForm, lnFormCount, llNeedsCompiling, lcOldDir,
lnNamesOnLine, ;
lcOldFont, lnNumSettings, lcTargSetting, lnLoop, lcNewExpr
*----------------------------- Program Code Begin
-------------------------
-


#define MAX_LINE_NAMES 4
#define NAME_WIDTH 28


lcOldDir = ALLTRIM(SET("DEFAULT")+ALLTRIM(CURDIR()))
IF !EMPTY(tcWhere) AND TYPE("tcWhere") = 'C'
set default to (tcWhere)
ENDIF


CLEAR


CLOSE TABLES ALL


IF MessageBox("About to clear printer info from all reports
in"+CHR(13)+CHR(13)+ ;
ALLTRIM(CURDIR())+CHR(13)+CHR(13)+ ;
"Go for it?",36,"Mass Report Update!") != 6


WAIT "Aborted." WINDOW TIMEOUT 1


set default to (lcOldDir)
RETURN .F.
ENDIF


lcOldFont = _SCREEN.FontName
_SCREEN.FontName = "Courier New"


lnNamesOnLine = 0


*
* Identify lines in FRX expr field to wipe out:
*
DIMENSION laLinesToWipe[3]
laLinesToWipe[1] = "DRIVER="
laLinesToWipe[2] = "DEVICE="
laLinesToWipe[3] = "OUTPUT="


*
* For each FRX file in the current directory:
*
lnFormCount = ADIR(laForms,"*.FRX")
ASORT(laForms,1)
FOR lnCurForm = 1 TO lnFormCount


llNeedToCompile = .F.


*
* Open the form as a table:
*
USE (laForms[lnCurForm,1]) IN 77
SELECT 77


*
* The first record has the printer info:
*
LOCATE


IF !EMPTY(tag) OR !EMPTY(tag2)
llNeedToCompile = .T.
ENDIF


*
* Clear the tag fields:
*
REPLACE tag WITH "", ;
tag2 WITH ""


*
* Remove the printer info from the expr field:
*
lnNumSettings = ALINES(laSettings,expr,.T.)
lnLoop = 1
DO WHILE lnLoop <= lnNumSettings
lnInc = 1
FOR EACH lcTargSetting IN laLinesToWipe
IF lcTargSetting $ laSettings[lnLoop]
llNeedToComile = .T.
ADEL(laSettings,lnLoop)
lnNumSettings =
lnNumSettings -
1
lnInc = 0
ENDIF
ENDFOR
lnLoop = lnLoop + lnInc
ENDDO


lcNewExpr = ""
FOR lnLoop = 1 TO lnNumSettings
lcNewExpr =
lcNewExpr+ALLTRIM(laSettings[lnLoop])+CHR(13)+CHR(10)
ENDFOR
REPLACE expr WITH lcNewExpr
*MessageBox("Before: "+chr(13)+expr+chr(13)+chr(13)+"After:
"+chr(13)+lcNewExpr)


IF lnNamesOnLine < MAX_LINE_NAMES
??
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)

ELSE
?
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)

lnNamesOnLine = 0
ENDIF
lnNamesOnLine = lnNamesOnLine + 1


SELECT 77
USE


*
* Compile the FRX:
*
IF llNeedToCompile
COMPILE REPORT (laForms[lnCurForm,1])
ENDIF
ENDFOR


set default to (lcOldDir)


Marcel Jalbert seemed to utter in
news:22Wi7.289588$v5.29128506@news1.rdc1.ct.home.com:




- Hide quoted text -
- Show quoted text -

> I been working around a problem for years where a FoxPro report form
> fails to print to the selected printer or to the Windows default
> printer. Anyway to make a long story short, when I compose a report
> form for a printer that exists on the Desktop or Server the
> application
> always prints to that printer. I'm use VFP 6.0 sp4 and have seen
> this
> problem on Windows 95 and NT desktops and VFP 5.0. By compose I
> mean;
> Modify the Report, go to "Page Setup" select a printer, click OK and
> save the report form. There appears to be some hard coding in the
> report form that identifies the printer name the report form was
> designed for. If this printer name exists this hard coding seems to
> override the destination printer settings your application would
> normally print to. There are a couple of ways I get around this
> problem.

> 1) Temporarily change the name of the printer you want to compose
> the
> report form for, select the printer while editing the report from
> and
> save it. Recompile your code and rename the printer back to it
> usually
> name. You can't rename a printer with Windows NT.


> 2) Variations on the same theme that works with Windows NT would be
> to
> temporarily install a printer on the PC that the application will
> never
> printer to. Compose the report form for that printer, save it,
> recompile and delete the installed printer.


> 3) Have multiple copies of your report forms. Each composed for the
> printers you want the reports to go to. (Not a desirable solution)


> Has anyone else seen this problem? Is it on a FoxPro bug list? Am
> I
> doing somethink I shouldn't or is there a better work around?


> Thanks!
> Marcel



--



Re: Changing a report after the exe is made by TonySper

TonySper
Tue Mar 28 18:35:05 CST 2006

Dan,
Can you explain the use of "projecthook" to strip off the printer
data?? I just use a small program before I make up the .exe file. You
may have a better way.
TonySper

"Dan Freeman" <spam@microsoft.com> wrote in message
news:OmohE2qUGHA.5228@tk2msftngp13.phx.gbl...
If you include the reports in the exe, they are read-only. You need to
copy
them to a file on disk to write to them.

You appear to be stripping printer-specific information from the EXPR
field.
Why not do that at the time the exe is built using a projecthook?

Dan

wipeout64@hotmail.com wrote:
> Is there a way to make changes to a report in the manner below after
> the executable is made? I'd like to parse the report according to
> the
> user's selections. Thanks
>
> ***********code - not mine
> LOCAL ARRAY laForms[1], laLinesToWipe[1], laSettings[1]
> LOCAL lnCurForm, lnFormCount, llNeedsCompiling, lcOldDir,
> lnNamesOnLine, ;
> lcOldFont, lnNumSettings, lcTargSetting, lnLoop, lcNewExpr
> *----------------------------- Program Code Begin
> -------------------------
> -
>
>
> #define MAX_LINE_NAMES 4
> #define NAME_WIDTH 28
>
>
> lcOldDir = ALLTRIM(SET("DEFAULT")+ALLTRIM(CURDIR()))
> IF !EMPTY(tcWhere) AND TYPE("tcWhere") = 'C'
> set default to (tcWhere)
> ENDIF
>
>
> CLEAR
>
>
> CLOSE TABLES ALL
>
>
> IF MessageBox("About to clear printer info from all reports
> in"+CHR(13)+CHR(13)+ ;
> ALLTRIM(CURDIR())+CHR(13)+CHR(13)+ ;
> "Go for it?",36,"Mass Report Update!") != 6
>
>
> WAIT "Aborted." WINDOW TIMEOUT 1
>
>
> set default to (lcOldDir)
> RETURN .F.
> ENDIF
>
>
> lcOldFont = _SCREEN.FontName
> _SCREEN.FontName = "Courier New"
>
>
> lnNamesOnLine = 0
>
>
> *
> * Identify lines in FRX expr field to wipe out:
> *
> DIMENSION laLinesToWipe[3]
> laLinesToWipe[1] = "DRIVER="
> laLinesToWipe[2] = "DEVICE="
> laLinesToWipe[3] = "OUTPUT="
>
>
> *
> * For each FRX file in the current directory:
> *
> lnFormCount = ADIR(laForms,"*.FRX")
> ASORT(laForms,1)
> FOR lnCurForm = 1 TO lnFormCount
>
>
> llNeedToCompile = .F.
>
>
> *
> * Open the form as a table:
> *
> USE (laForms[lnCurForm,1]) IN 77
> SELECT 77
>
>
> *
> * The first record has the printer info:
> *
> LOCATE
>
>
> IF !EMPTY(tag) OR !EMPTY(tag2)
> llNeedToCompile = .T.
> ENDIF
>
>
> *
> * Clear the tag fields:
> *
> REPLACE tag WITH "", ;
> tag2 WITH ""
>
>
> *
> * Remove the printer info from the expr field:
> *
> lnNumSettings = ALINES(laSettings,expr,.T.)
> lnLoop = 1
> DO WHILE lnLoop <= lnNumSettings
> lnInc = 1
> FOR EACH lcTargSetting IN laLinesToWipe
> IF lcTargSetting $
> laSettings[lnLoop]
> llNeedToComile = .T.
> ADEL(laSettings,lnLoop)
> lnNumSettings =
> lnNumSettings
> - 1
> lnInc = 0
> ENDIF
> ENDFOR
> lnLoop = lnLoop + lnInc
> ENDDO
>
>
> lcNewExpr = ""
> FOR lnLoop = 1 TO lnNumSettings
> lcNewExpr =
> lcNewExpr+ALLTRIM(laSettings[lnLoop])+CHR(13)+CHR(10)
> ENDFOR
> REPLACE expr WITH lcNewExpr
> *MessageBox("Before: "+chr(13)+expr+chr(13)+chr(13)+"After:
> "+chr(13)+lcNewExpr)
>
>
> IF lnNamesOnLine < MAX_LINE_NAMES
> ??
> PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
>
> ELSE
> ?
> PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
>
> lnNamesOnLine = 0
> ENDIF
> lnNamesOnLine = lnNamesOnLine + 1
>
>
> SELECT 77
> USE
>
>
> *
> * Compile the FRX:
> *
> IF llNeedToCompile
> COMPILE REPORT (laForms[lnCurForm,1])
> ENDIF
> ENDFOR
>
>
> set default to (lcOldDir)
>
>
> Marcel Jalbert seemed to utter in
> news:22Wi7.289588$v5.29128506@news1.rdc1.ct.home.com:
>
>
>
>
> - Hide quoted text -
> - Show quoted text -
>
>> I been working around a problem for years where a FoxPro report
>> form
>> fails to print to the selected printer or to the Windows default
>> printer. Anyway to make a long story short, when I compose a
>> report
>> form for a printer that exists on the Desktop or Server the
>> application always prints to that printer. I'm use VFP 6.0 sp4 and
>> have seen this problem on Windows 95 and NT desktops and VFP 5.0.
>> By compose I mean; Modify the Report, go to "Page Setup" select a
>> printer, click OK and save the report form. There appears to be
>> some hard coding in the report form that identifies the printer
>> name
>> the report form was designed for. If this printer name exists this
>> hard coding seems to override the destination printer settings your
>> application would normally print to. There are a couple of ways I
>> get around this problem.
>
>> 1) Temporarily change the name of the printer you want to compose
>> the
>> report form for, select the printer while editing the report from
>> and
>> save it. Recompile your code and rename the printer back to it
>> usually name. You can't rename a printer with Windows NT.
>
>
>> 2) Variations on the same theme that works with Windows NT would be
>> to temporarily install a printer on the PC that the application
>> will
>> never printer to. Compose the report form for that printer, save
>> it,
>> recompile and delete the installed printer.
>
>
>> 3) Have multiple copies of your report forms. Each composed for
>> the
>> printers you want the reports to go to. (Not a desirable solution)
>
>
>> Has anyone else seen this problem? Is it on a FoxPro bug list? Am
>> I
>> doing somethink I shouldn't or is there a better work around?
>
>
>> Thanks!
>> Marcel




Re: Changing a report after the exe is made by wipeout64

wipeout64
Tue Mar 28 19:41:42 CST 2006

Thanks for the suggestion, but that isn't my code. I just cut that and
put it in because it was clean and mine has other functions mixed in
it. What I'm trying to do is alter the fillpen, etc. fields which
control the color of the printouts. We don't want to expose all our
reports. I suppose I could copy the report on the fly to a single
exposed report, then alter the exposed report, but it means changing
more code. I also failed to mention that I'm working with 7.0. I do
believe that 9.0 may cover this issue.