Quantcast
Channel: VFPX
Viewing all articles
Browse latest Browse all 3798

New Comment on "XLSXWorkbook"

$
0
0
Thought I'd pass along some of my modifications dealing with similar issues. I've had some problems with ASC characters below 32 as well as above 128. Excel seems to have it's own way of encoding those. Here's my GetXMLString with m. and a bailout at the top for when CHARTRAN of ASC 32-128 returns empty. Testing on a 100,000 street addresses it cut the time from 90 sec to 6 sec. LPARAMETERS tcString Local lcChar, lcString, lcXMLString, lnChar, lnNdx IF isnull(m.tcString) OR EMPTY(RTRIM(m.tcString)); OR EMPTY(CHRTRAN(UPPER(m.tcString)," ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-',./?;:[]{}_=+)(*^%$#@!~",'')) RETURN '' ELSE IF EMPTY(m.tcString) RETURN "" ENDIF m.lcString = RTRIM(m.tcString) m.lcString = STRTRAN(m.lcString, CHR(38), '&amp;') m.lcString = STRTRAN(m.lcString, '>', '&gt;') m.lcString = STRTRAN(m.lcString, '<', '&lt;') m.lcString = STRTRAN(m.lcString, '"', '&quot;') IF this.CodePage = 0 m.lcXMLString = "" FOR m.lnNdx=1 TO LEN(m.lcString) m.lcChar = SUBSTR(m.lcString, m.lnNdx, 1) m.lnChar = ASC(m.lcChar) m.lcXMLString = m.lcXMLString + ICASE(m.lnchar<32,'_x00'+STRCONV(m.lcChar ,15 )+'_',; BETWEEN(m.lnChar,32, 128), m.lcChar,; "&#" + TRANSFORM(m.lnChar) + ";") ENDFOR ELSE m.lcXMLString = m.lcString ENDIF RETURN m.lcXMLString endif

Viewing all articles
Browse latest Browse all 3798

Trending Articles