XLSX-Workbook-Class icon indicating copy to clipboard operation
XLSX-Workbook-Class copied to clipboard

About GetCellNumberFormatText()

Open jhernancanom opened this issue 3 years ago • 3 comments

Hi, Greg. I was trying to know how was the performance of .GetCellNumberFormat(), and .GetCellNumberFormatText(), but the second drives to an error, that I am going to show you.

I have included these lines for getting the Number Format in the numeric cells:

if between(M.lnCol,3,6)
   M.nOldFrm1 = M.loExcel.GetCellNumberFormat    (lnWb, lnSh, M.lnRow, M.lnCol )
   M.nOldFrm2 = ''&&M.loExcel.GetCellNumberFormatText(lnWb,lnSh,M.lnRow,M.lnCol)
 **M.nOldFrm3 = M.loExcel.GetCustomNumericFormat (lnWb, M.tnFormatCode )
   
   Messagebox( ;
      '.Row: '+str(M.lnRow,2)+_CR;
     +'.Col: '+str(M.lnCol,2)+_CR;
     +'.GetCellNumberFormat    : '+tran(M.nOldFrm1)+_CR;
     +'.GetCellNumberFormatText: '+tran(M.nOldFrm2)+_CR;
     +'',0,'Versión R'+tran(M.loExcel.ExcelXlsxRelease), 5*1000 )
endif

If I get out ''&& de M.nOldFrm2, the function GetCellNumberFormatText() shows an error message, that we can see in image 01. If I run the program again, I see (image 02) that the program --for row 1-- shows from col 3 to 6, and ok; but in row 2 shows col 3 ok, col 4 ok, but for col 5 when M.nOldFrm2 = M.loExcel .GetCellNumberFormatText(lnWb,lnSh,M.lnRow,M.lnCol), rises the error in image 03.

I decided to suspend and made some investigation. In image 3a we see that the line with the error is lcFormatCode = xl_cellxfs.formatcode, where the class tries to get the format number of a cell. And in image 3b that the method is GetCellNumberFormatText(). I look if xl_cellxfs has the field formatcode, and if find (1) xl_cellxfs has no the field formatcode; and (2) xl_numfmts does have the field formatcode; image 3c.

((images inside .doc))

Thanks for sharing this library. Mensaje-About GetCellNumberFormatText().docx About filling a template in R33-beta8.zip

jhernancanom avatar May 27 '21 07:05 jhernancanom

You are missing some screen shots I believe. Please provide an example PRG that will reproduce your error so that I can debug and fix.

ggreen86 avatar Jul 13 '21 15:07 ggreen86

Sorry, Greg. The images are inside DOCx. But here are the .DOCx, and also the images.

Mensaje-About GetCellNumberFormatText().docx imagenes-GetCellNumberFormatText.zip

The attached About filling a template in R33-beta8.zip in first message is because it is related, but it is in another issue.

Thanks.

jhernancanom avatar Jul 13 '21 16:07 jhernancanom

Thank you -- will look into the problem.


From: jhernancanom @.> Sent: Tuesday, July 13, 2021 12:14 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] About GetCellNumberFormatText() (#51)

Sorry, Greg. Here are the right .DOCx, and also the images.

Mensaje-About GetCellNumberFormatText().docxhttps://github.com/ggreen86/XLSX-Workbook-Class/files/6810375/Mensaje-About.GetCellNumberFormatText.docx imagenes-GetCellNumberFormatText.ziphttps://github.com/ggreen86/XLSX-Workbook-Class/files/6810394/imagenes-GetCellNumberFormatText.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/51#issuecomment-879221160, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33NCG2TU4Y4JYKM6YQTTXRQ7XANCNFSM45TTSS7A.

ggreen86 avatar Jul 13 '21 18:07 ggreen86

Sorry for the VERY late reply -- this was corrected sometime back. The GetCellNumberFormat() method is now returning the cell format style Id. The method GetCellNumberFormatText() will now return the numeric format from the defined style.

ggreen86 avatar Aug 14 '23 22:08 ggreen86