Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AppendFromXlsx code and text format in Excel
Message
De
29/01/2020 01:31:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01672618
Message ID:
01672829
Vues:
81
This message has been marked as the solution to the initial question of the thread.
I made a change in appendfromxlsx to cope with this situation.
Please try the attached version (appendfromxlsx 3.2) and give me a reply.


Hi everybody,

Just ran into an interesting problem with my colleague. I recently updated the way I read information from Excel into a table to use this class
* Version 3.1
FUNCTION AppendFromXlsx
lparameters tcExcelFileName, tcCursorName, tcFFields, tnStartRow, tcSheetName, tlEmptyCells, tcExcludeColumn
* Parameters
* tcExcelFileName	name of the xlsx
					* nom de xlsx
					* numele xlsx-ului
* tcCursorName		name of the table / cursor ; optional ; default ALIAS()
* tcFFields			list of fields to be outputed ; optional ; default all fields
* tnStartRow		starting row (the first tnStartRow - 1 rows are skipped) ; optional ; default 1 (all rows)
					* a partir rangée (les premiers lnStartRows - 1 lignes sont passées) ; optionnel ; défaut 1 (tous les champs lignes)
					* primul rand (primele lnStartRows - 1 randuri ale tabelului din docx sunt omise); optional; implicit 1 (toate randurile)
* tcSheetName		sheet name | number	; optional ; default ''
					* nom | nomber de la feuille ; optionnel ; défaut ''
					* numele |numarul foii	; optional ; implicit ''
* tlEmptyCells		when .T., the source contains empty cells (slower import); optional ; default .F.
					* lorsque .T., la source contient des cellules vides (d'importation plus lent); optionnel ; défaut .F.
					* cand este .T., documentul sursa contine celule goale (importul este mai lent); optional; implicit .F
* tcExcludeColumn   * optional column name to exclude                   .

#DEFINE ERRLANG "En"
#IF ERRLANG = "Ro"
	#DEFINE ERRMESS0 "Eroare"
	#DEFINE ERRMESS1 "Nimic de importat"
	#DEFINE ERRMESS2 "Deschideti, va rog, tabelul / cursorul"
	#DEFINE ERRMESS3 "Foaie inexistenta"
	#DEFINE ERRMESS4 "Eroare la deschiderea"
#ELIF ERRLANG = "Fr"
I forgot who is the owner of the code, Boris, do you recognize it? Can you point me out to the link with it?

What we found is that the spreadsheet had numerical columns (quantity and unit_cost) and the resulting table got completely wrong info. Turned out that when we changed the column to use numeric format (originally it was text), the results came up correctly.

Is anyone familiar with this class? Is there anyway to prevent this possible issue in a future (in case the client gives the spreadsheet using wrong format for these columns and we forget to change)?

Thanks in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform