ggreen86 / XLSX-Workbook-Class

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

Recommendations for printOptions #73

Closed zulqasar closed 1 year ago

zulqasar commented 2 years ago

Another need I came across was center horizontally and vertically. I made the following changes in my code to accommodate this.

*-- createWorkingCursors method
*-   added 2 columns/fields to xl_sheets cursor
centerH L
centerV L

*-- Added a new method called setprintoptions
lparameters tnWb, tnSh, tlCenterH, tlCenterV

if this.GetSheetRecord(tnWb, tnSh)
    replace centerH with tlCenterH, centerV with tlCenterV in xl_sheets
endif

Lastly in writeSheetxmls method before sheet margin /pageMargins code, add this code


if xl_sheets.centerH or xl_sheets.centerV
    write(lhShFile, '<printOptions')
    if xl_sheets.centerH
        write(lhShFile, ' horizontalCentered="1"')
    endif
    if xl_sheets.centerV
        write(lhShFile, ' verticalCentered="1"')
    endif
    fwrite(lhShFile, '/>')
endif 
ggreen86 commented 1 year ago

This feature as been added, see method SetSheetPrintOptions().