ggreen86 / XLSX-Workbook-Class

VFP Class to Create an XLSX Workbook without Excel Automation or Installed
45 stars 16 forks source link

AddNamedRange for PRINT_TITLE not working #112

Closed rawilliamsjr closed 5 months ago

rawilliamsjr commented 6 months ago

To fix the issue I changed the AddNamedRange method line from using PRINT_TITLE to PRINT_TITLES

IF INLIST(UPPER(lcRangeName), "_FILTERDATABASE", "CRITERIA", "EXTRACT", "PRINT_AREA", "PRINT_TITLES")

The other fix was that I added a new method SetPrintTitles LPARAMETERS tnWB, tnSheet, tnBegRow, tnEndRow IF PCOUNT() < 4 RETURN False ENDIF IF tnBegRow <= 0 OR tnEndRow < tnBegRow RETURN False ENDIF IF SEEK(BINTOC(tnWB), "xl_workbooks", "workbook") .AND. SEEK(BINTOC(tnWB)+PADL("_xlnm.PRINT_TITLES", 50, " "), "xl_namerange", "wbrname") UPDATE xl_namerange ; SET begrow = tnBegRow, ; begcol = 0, ; endrow = tnEndRow, ; endcol = 0 ; WHERE workbook = tnWB ; AND sheet = tnSheet ; AND rname = PADL("_xlnm.PRINT_TITLES", 50, " ") ELSE INSERT INTO xl_namerange (workbook, sheet, rname, scope, begrow, begcol, endrow, endcol) ; VALUES (tnWB, tnSheet, "_xlnm.PRINT_TITLES", SCOPE_SH_NAMED_RANGE, tnBegRow, 0, tnEndRow, 0) ENDIF RETURN True

ggreen86 commented 6 months ago

Rob—

Thank you for the code correction and submission. I have incorporated the fix for the AddNamedRange method. For the new method, I do not see the need for it as it does the same thing as the AddNamedRange method. The new method you propose only eliminates the need for parameters. Can you give a compelling reason for its addition?

Greg

From: Rob Williams @.> Sent: Monday, March 4, 2024 4:16 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] AddNamedRange for PRINT_TITLE not working (Issue #112)

To fix the issue I changed the AddNamedRange method line from using PRINT_TITLE to PRINT_TITLES

IF INLIST(UPPER(lcRangeName), "_FILTERDATABASE", "CRITERIA", "EXTRACT", "PRINT_AREA", "PRINT_TITLES")

The other fix was that I added a new method SetPrintTitles LPARAMETERS tnWB, tnSheet, tnBegRow, tnEndRow IF PCOUNT() < 4 RETURN False ENDIF IF tnBegRow <= 0 OR tnEndRow < tnBegRow RETURN False ENDIF IF SEEK(BINTOC(tnWB), "xl_workbooks", "workbook") .AND. SEEK(BINTOC(tnWB)+PADL("_xlnm.PRINT_TITLES", 50, " "), "xl_namerange", "wbrname") UPDATE xl_namerange ; SET begrow = tnBegRow, ; begcol = 0, ; endrow = tnEndRow, ; endcol = 0 ; WHERE workbook = tnWB ; AND sheet = tnSheet ; AND rname = PADL("_xlnm.PRINT_TITLES", 50, " ") ELSE INSERT INTO xl_namerange (workbook, sheet, rname, scope, begrow, begcol, endrow, endcol) ; VALUES (tnWB, tnSheet, "_xlnm.PRINT_TITLES", SCOPE_SH_NAMED_RANGE, tnBegRow, 0, tnEndRow, 0) ENDIF RETURN True

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/112, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33K3J5CBBDIXHJJR6ILYWTP7FAVCNFSM6AAAAABEF6CHYOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DONZXGEZDCNA. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

rawilliamsjr commented 6 months ago

When attempting to correct PRINT_TITLES I first corrected the AddNamedRange method. We have been using the specific method of SetPrintArea but noticed it could be set using the AddNamedRange method. We decided to create a SetPrintTitles method because we liked the specific method for Print Area.

Robert Williams

Phone 971.217.0850

www.advancedgrowersolutions.comhttp://www.advancedgrower.com/

@.**@.> [cid:433b0a9e-ccd9-4c7e-9e2d-cfab51853223]


From: ggreen86 @.> Sent: Thursday, March 7, 2024 10:06 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: Robert Williams @.>; Author @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] AddNamedRange for PRINT_TITLE not working (Issue #112)

Rob—

Thank you for the code correction and submission. I have incorporated the fix for the AddNamedRange method. For the new method, I do not see the need for it as it does the same thing as the AddNamedRange method. The new method you propose only eliminates the need for parameters. Can you give a compelling reason for its addition?

Greg

From: Rob Williams @.> Sent: Monday, March 4, 2024 4:16 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] AddNamedRange for PRINT_TITLE not working (Issue #112)

To fix the issue I changed the AddNamedRange method line from using PRINT_TITLE to PRINT_TITLES

IF INLIST(UPPER(lcRangeName), "_FILTERDATABASE", "CRITERIA", "EXTRACT", "PRINT_AREA", "PRINT_TITLES")

The other fix was that I added a new method SetPrintTitles LPARAMETERS tnWB, tnSheet, tnBegRow, tnEndRow IF PCOUNT() < 4 RETURN False ENDIF IF tnBegRow <= 0 OR tnEndRow < tnBegRow RETURN False ENDIF IF SEEK(BINTOC(tnWB), "xl_workbooks", "workbook") .AND. SEEK(BINTOC(tnWB)+PADL("_xlnm.PRINT_TITLES", 50, " "), "xl_namerange", "wbrname") UPDATE xl_namerange ; SET begrow = tnBegRow, ; begcol = 0, ; endrow = tnEndRow, ; endcol = 0 ; WHERE workbook = tnWB ; AND sheet = tnSheet ; AND rname = PADL("_xlnm.PRINT_TITLES", 50, " ") ELSE INSERT INTO xl_namerange (workbook, sheet, rname, scope, begrow, begcol, endrow, endcol) ; VALUES (tnWB, tnSheet, "_xlnm.PRINT_TITLES", SCOPE_SH_NAMED_RANGE, tnBegRow, 0, tnEndRow, 0) ENDIF RETURN True

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/112, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33K3J5CBBDIXHJJR6ILYWTP7FAVCNFSM6AAAAABEF6CHYOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DONZXGEZDCNA. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/112#issuecomment-1984139837, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOXHACDHZUKBWGJQOWAEXA3YXCUDVAVCNFSM6AAAAABEF6CHYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBUGEZTSOBTG4. You are receiving this because you authored the thread.Message ID: @.***>

ggreen86 commented 5 months ago

I did not add a dedicated method as suggested; can be assigned via AddNamedRange(). Corrected the name in the method as above. Correction in R41.