ggreen86 / XLSX-Workbook-Class

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

FitToPage not being set in Sheets.xml #113

Closed rawilliamsjr closed 5 months ago

rawilliamsjr commented 6 months ago

Code modified or added to correct the issue.

Modified the method SetPrintToFitHeight IF INT(tnFitToHeight) >= 0 REPLACE xl_sheets.fittopage WITH IIF(tnFitToHeight>0 OR xl_sheets.fittowidth>0, 1, 0), ; xl_sheets.fittoheight WITH INT(tnFitToHeight) ; IN xl_sheets

Modified the method SetPrintToFitWidth IF INT(tnFitToWidth) >= 0 REPLACE xl_sheets.fittopage WITH IIF(xl_sheets.fittoheight>0 OR tnFitToWidth>0, 1, 0), ; xl_sheets.fittowidth WITH INT(tnFitToWidth) ; IN xl_sheets

Modified the WriteSheetXMLS IF xl_sheets.fittopage > 0 FWRITE(lhFile, '') && If uncommented; sheet will be invalid by Excel ENDIF

! DO CASE ! CASE xl_sheets.fittowidth > 0 .AND. xl_sheets.fittoheight > 0

IF xl_sheets.fittopage > 0
    FWRITE(lhFile, ' fitToWidth="'  + TRANSFORM(xl_sheets.fittowidth) + '"')
    FWRITE(lhFile, ' fitToHeight="' + TRANSFORM(xl_sheets.fittoheight) + '"')
ELSE
    IF xl_sheets.SCALE != 100
        FWRITE(lhFile, ' scale="' + TRANSFORM(xl_sheets.SCALE) + '"')
    ENDIF
ENDIF

! CASE xl_sheets.fittowidth = 0 .AND. xl_sheets.fittoheight > 0 ! FWRITE(lhFile, ' fitToHeight="' + TRANSFORM(xl_sheets.fittoheight) + '"')

! CASE xl_sheets.fittowidth > 0 .AND. xl_sheets.fittoheight = 0 ! FWRITE(lhFile, ' fitToWidth="' + TRANSFORM(xl_sheets.fittowidth) + '"') ! ! OTHERWISE ! IF xl_sheets.scale != 100 ! FWRITE(lhFile, ' scale="' + TRANSFORM(xl_sheets.scale) + '"') ! ENDIF ! ENDCASE

ggreen86 commented 5 months ago

Closing issue; corrected in R41