In a similar way, a HTML document can be created.
First, the GetLocaleInfo example.
****************
* Begin code
****************
Declare INTEGER GetLocaleInfo in Win32API LONG Locale, LONG LCType, STRING @LpLCData, INTEGER cchData
LOCAL LpLCData,cchData,nretval,lni,lcPos,lcSetPoint,lcPoint,lcSetSep,lcSep,lcSetDec,lcDec,lcNumber,lcCurr,lcStr
LpLCData = space(255) && Address of buffer information.
cchData = LEN(LpLCData) && Size of buffer, LpLCData.
nretval = 0 && Number returned from API call.
RAND(-1)
**************
lcSetPoint = SET("Point")
lcSetSep = SET("Separator")
lcSetDec = SET("Decimals")
*
nretval = GetLocaleInfo(1024, 0x16, @LpLCData, cchData)
lcPoint = LEFT(LpLCData,nretval-1)
SET POINT TO lcPoint
nretval = GetLocaleInfo(1024, 0x17, @LpLCData, cchData)
lcSep = LEFT(LpLCData,nretval-1)
SET SEPARATOR TO lcSep
nretval = GetLocaleInfo(1024, 0x19, @LpLCData, cchData)
lcDec = LEFT(LpLCData,nretval-1)
SET DECIMALS TO &lcDec
nretval = GetLocaleInfo(1024, 0x14, @LpLCData, cchData)
lcCurr = LEFT(LpLCData,nretval-1)
nretval = GetLocaleInfo(1024, 0x1B, @LpLCData, cchData)
lcPos = LEFT(LpLCData,nretval-1)
lcNumber = ALLTRIM(TRANSFORM(1000000 * RAND(),"###" + REPLICATE(",###" , 4) + "." + REPLICATE("9",VAL(m.lcDec))))
lcStr = [<!DOCTYPE html><html><body>]
DO CASE
CASE lcPos = "0"
lcStr = m.lcStr + m.lcCurr + m.lcNumber
CASE lcPos = "1"
lcStr = m.lcStr + m.lcNumber + m.lcCurr
CASE lcPos = "2"
lcStr = m.lcStr + m.lcCurr + " " + m.lcNumber
CASE lcPos = "3"
lcStr = m.lcStr + m.lcNumber + " " + m.lcCurr
ENDCASE
lcStr = m.lcStr + [</body></html>]
STRTOFILE(m.lcStr,"test.htm")
SET POINT TO lcSetPoint
SET SEPARATOR TO lcSetSep
SET DECIMALS TO &lcSetDec
****************
* End code
****************
Obviously, because of Unicode the GetLocaleInfoEx example is a little more complicated.
Note the reversed order of the two UNICODE bytes, between Word and HTML
****************
* Begin code
****************
Declare INTEGER GetLocaleInfoEx in Win32API String Locale, LONG LCType, STRING @LpLCData, INTEGER cchData
LOCAL LpLCData,cchData,nretval,lni,lcPos,lcSetPoint,lcPoint,lcSetSep,lcSep,lcSetDec,lcDec,lcNumber,lcCurrh,lcStrex
LpLCData = space(255) && Address of buffer information.
cchData = LEN(LpLCData) && Size of buffer, LpLCData.
nretval = 0 && Number returned from API call.
RAND(-1)
**************
lcSetPoint = SET("Point")
lcSetSep = SET("Separator")
lcSetDec = SET("Decimals")
*
nretval = GetLocaleInfoEx(Null, 0x16, @LpLCData, cchData)
lcPoint = LEFT(LpLCData,nretval-1)
SET POINT TO lcPoint
nretval = GetLocaleInfoEx(Null, 0x17, @LpLCData, cchData)
lcSep = LEFT(LpLCData,nretval-1)
SET SEPARATOR TO lcSep
nretval = GetLocaleInfoEx(Null, 0x19, @LpLCData, cchData)
lcDec = LEFT(LpLCData,nretval-1)
SET DECIMALS TO &lcDec
nretval = GetLocaleInfoEx(Null, 0x14, @LpLCData, cchData)
lcCurrh = ""
FOR lni = 1 TO nretval-1
lcCurrh = m.lcCurrh + "&#x" + RIGHT(TRANSFORM(ASC(SUBSTR(LpLCData,2*lni)),"@0"),2) + RIGHT(TRANSFORM(ASC(SUBSTR(LpLCData,2*lni-1)),"@0"),2) + ";"
NEXT
nretval = GetLocaleInfoEx(Null, 0x1B, @LpLCData, cchData)
lcPos = LEFT(LpLCData,nretval-1)
lcNumber = ALLTRIM(TRANSFORM(1000000 * RAND(),"###" + REPLICATE(",###" , 4) + "." + REPLICATE("9",VAL(m.lcDec))))
lcStrex = [<!DOCTYPE html><html><body>]
DO CASE
CASE lcPos = "0"
lcStrex = m.lcStrex + m.lcCurrh + m.lcNumber
CASE lcPos = "1"
lcStrex = m.lcStrex + m.lcNumber + m.lcCurrh
CASE lcPos = "2"
lcStrex = m.lcStrex + m.lcCurrh + " " + m.lcNumber
CASE lcPos = "3"
lcStrex = m.lcStrex + m.lcNumber + " " + m.lcCurrh
ENDCASE
lcStrex = m.lcStrex + [</body></html>]
STRTOFILE(m.lcStrex,"testex.htm")
SET POINT TO lcSetPoint
SET SEPARATOR TO lcSetSep
SET DECIMALS TO &lcSetDec
****************
* End code
****************
Related posts
http://praisachion.blogspot.com/2015/06/using-getlocaleinfo-and-getlocaleinfoex_79.html
http://praisachion.blogspot.com/2015/06/using-getlocaleinfo-and-getlocaleinfoex_14.html
http://praisachion.blogspot.com/2015/06/using-getlocaleinfo-and-getlocaleinfoex.html
label element example codes about css html
RăspundețiȘtergereLabel sets a text for option element
Thank you for the comment, although is off topic
Ștergere