Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AppendFromXlsx code and text format in Excel
Message
De
29/01/2020 11:31:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01672618
Message ID:
01672835
Vues:
75
J'aime (1)
Indeed, this was the only change made by me :-)

I will reply to your email, too.

Let me explain the code.
The spreadsheet is a zipped folder, containing xml files, along with image files.

Each sheet has a corresponding XML.
Each cell is a node with several attributes (position, formatting type, value, and so on)
Numeric values are store as they are, but strings are stored different.

Usually all strings are stored into another XML file, and the sheet itself contains as value the position (an integer) from this file (there is also an inline string, but never found to be used by someone).

So what I've done is if [t="s"] (meaning formatted as string), then the cell value contains the position in the string file, i.e.: GO VAL(m.lcVal) + 1 IN (m.cCurStr), and take from there VAL(cStr)



I used online file compare and I think this is the change which is relevant for me and I need to apply it:
IF laField[m.lni,2] $ "NFBYI"
						TRY 
							IF [t="s"] $ m.lcCell
								GO VAL(m.lcVal) + 1 IN (m.cCurStr)
								laFieldGat[m.lni] = VAL(cStr)
							ELSE
								laFieldGat[laField[m.lni,3]] = VAL(m.lcVal)
							ENDIF
						CATCH TO loErr
							laFieldGat[m.lni] = lcVal
						ENDTRY
>>>I made a change in appendfromxlsx to cope with this situation.
>>>Please try the attached version (appendfromxlsx 3.2) and give me a reply.
>>>
>>>
>>
>>I tried your new code in this test program and it worked.
>>
>>
>>use in select('csrOnHand_Quantities')
>>create cursor csrOnHand_Quantities (Department C(10), Category C(10), item C(10), ;
>>	MatrixRowValue varchar(100), MatrixColumnValue varchar(100), LocationDescription varchar(100), ;
>>	Quantity I, UnitCost n(12,4))
>>	
>>LOCAL lcFile 
>>
>>lcFile = GETFILE('xlsx')
>>
>>
>>=MESSAGEBOX(AppendFromXlsx(m.lcFile, "csrOnHand_Quantities",,2, "On-Hand Quantities", .t.))
>>browse
>>
>>Can I please email you the program I was currently using to see what needs to be adjusted in it?
>>
>>Thanks in advance.
>>
>>In my form I first used some code to extract the data and then processed all the worksheets in the file.
>
>With for instance BeyondCompare you can easily see the difference between the old version and the new. If any of the files involved are SCX or VCX, Frank Perez has made an extension for them, http://pfsolutions-mi.com/blog/category/VFP2Text.aspx
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform