ggreen86 / XLSX-Workbook-Class

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

Defined Names #72

Closed zulqasar closed 2 years ago

zulqasar commented 2 years ago

localSheetId for defined names should be based on 0 index. This means localSheetId will be lnSh - 1.

Code on line 74 in writeWorkbookXml method should be

*-- line 73
if xl_namerange.scope = SCOPE_SH_NAMED_RANGE
    *-- line 74 should be as follows
    write(lhFile, ' localSheetId="' + transform(xl_namerange.sheet - 1) + '"')

I don't know what impact it will have if we have deleted sheets in between. Need to test it out.

zulqasar commented 2 years ago

Recommendations for defined names - accommodate reserved names like Print_Area, Print_Titles, etc. These reserved names are prefixed with _xlnm.. I made some changes in writeWorkbookXml method to accommodate this (For now I have only worked on Print_Area. Other reserved words will not be hard to work on)

*-- After line 64 add these lines of code
lcName = alltrim(xl_namerange.rname)
if upper(lcName) == 'PRINT_AREA'
    lcName = '_xlnm.Print_Area'
endif

In my earlier comment I made a mistake on line numbers. Those line numbers 73 and 74 are after I added this code and should actually be 68 and 69 (Sorry for any confusion)

ggreen86 commented 2 years ago

Hello--

Thank you for adding this issue. I have incorporated this into the base class which will be released in the future as the next beta.

Greg


From: zulqasar @.> Sent: Monday, August 22, 2022 7:10 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: Re: [ggreen86/XLSX-Workbook-Class] Defined Names (Issue #72)

Recommendations for defined names - accommodate reserved names like Print_Area, Print_Titles, etc. These reserved names are prefixed with _xlnm.. I made some changes in writeWorkbookXml method to accommodate this (For now I have only worked on Print_Area. Other reserved words will not be hard to work on)

*-- After line 64 add these lines of code lcName = alltrim(xl_namerange.rname) if upper(lcName) == 'PRINT_AREA' lcName = '_xlnm.Print_Area' endif

In my earlier comment I made a mistake on line numbers. Those line numbers 73 and 74 are after I added this code and should actually be 68 and 69 (Sorry for any confusion)

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

ggreen86 commented 2 years ago

Hello--

Thank you for this bug fix. It has been incorporated into the next future beta release.

Greg


From: zulqasar @.> Sent: Monday, August 22, 2022 6:46 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] Defined Names (Issue #72)

localSheetId for defined names should be based on 0 index. This means localSheetId will be lnSh - 1.

Code on line 74 in writeWorkbookXml method should be

-- line 73 if xl_namerange.scope = SCOPE_SH_NAMED_RANGE -- line 74 should be as follows write(lhFile, ' localSheetId="' + transform(xl_namerange.sheet - 1) + '"')

I don't know what impact it will have if we have deleted sheets in between. Need to test it out.

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