Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Greg Green XLSXWorkBookVFPX for extracting from Ex
Message
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01663900
Message ID:
01663954
Views:
45
Finally success!

I created a data-driven approach in extracting records from an Excel (xlsx) file into a cursor/dbf file.
1. I create an XML file (excel2dbf) of the following format:
<?xml version="1.0" encoding="utf-8" ?> 
<FIELDS>
        <Field>
                <Column>1</Column>
                <FldName>Fld1Name</FldName>
                <FldType>C</FldType>
                <FldLen>30</FldLen>
		<FldDec>00</FldDec>
        </Field>
        <Field>
                <Column>2</Column>
                <FldName>Fld2Name</FldName>
                <FldType>C</FldType>
                <FldLen>15</FldLen>
		<FldDec>00</FldDec>
        </Field>
        <Field>
                <Column>3</Column>
                <FldName>Fld3Name</FldName>
                <FldType>N</FldType>
                <FldLen>12</FldLen>
		<FldDec>02</FldDec>
        </Field>
        <Field>
                <Column>4</Column>
                <FldName>Fld4Name</FldName>
                <FldType>D</FldType>
                <FldLen>8</FldLen>
		<FldDec>00</FldDec>
        </Field>
       ... other fields
</FIELDS>
The value in the tag Column corresponds to the Column of the spreadsheet. So that, when extracting records from xlsx I can just specify the columns I need to have.
The PRG opens the XML, creates a cursor/table and then - using Greg Green's XLSXWorkBookVFPX - extracts records and populates the target cursor/DBF.
Therefore I will be able to use it on future projects.
Thank you, Greg, and others for your help!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform