实现仅包含 9 X 9 个单元格区域的窗口界面。
oExcel=CreateObject("Excel.Application")
WITH oExcel
.WorkBooks.Add
oRange = .Range("A1:I9")
WITH .ActiveWindow
.DisplayHeadings = .F.
.DisplayHorizontalScrollBar = .F.
.DisplayVerticalScrollBar = .F.
.DisplayWorkbookTab...
oExcel=CreateObject("Excel.Application")
WITH oExcel
.WorkBooks.Add
.DisplayFullScreen = .T.
.CommandBars(1).Enabled = .F.
.CommandBars("Full Screen").Controls(1).Onaction = "RestoreWindow"
WITH .ActiveWindow
.DisplayHeadings = .F.
.DisplayHorizontalScr...
在 Excel 中使用 Window 对象的 WindowState 属性返回或设置窗口的状态,该属性取值可为 XlWindowState 枚举常量之一,分别对应着窗口的 3 种状态。
XlWindowState 枚举
指定窗口的状态。
名称 值 描述
xlMaximized -4137 最大化
xlMinimized -4140 最小化
xlNormal -4143 正常
oExcel=CreateObject("Excel.Application")
WITH oExcel
.WorkBooks.Add
.WindowState = x...
oExcel=CreateObject("Excel.Application")
WITH oExcel
.WorkBooks.Add
.Caption = "XXXX信息管理系统"
.ActiveWindow.Caption = ""
.Visible = .T.
ENDWITH
* 生成数据库中表间关系名
CLEAR
CLOSE DATABASES ALL
SET SAFETY OFF
CREATE TABLE T_Rela (父表 c(20),子表 c(20),父表索标 c(20),子表索标 c(20))
OPEN DATABASE Mdf\Comm_Dbf
nRelas=ADBOBJECTS(aRela,"RELATION")
=ASORT(aRela)
FOR i=1 TO nRelas
INSERT INTO T_Rela VALUES (aRela[i,2],aRela[i,1],aRela[i,4],aRela[i,3]...
* 生成数据库中表结构明细
CLOSE DATABASES ALL
SET SAFETY OFF
CREATE TABLE Made_Dbf\T_Name (表名 c(30),字段名 c(20),字段说明 c(100),字段类型 c(1),索引类型 c(10),索引方式 c(4),宽度 n(3),小数位 n(1),表说明 c(100))
OPEN DATABASE Made_Dbf\Comm_Dbf
nTables=ADBOBJECTS(aTable,"TABLE")
=ASORT(aTable)
FOR i=1 TO nTables
USE ("Made_D...
原文本格式如下:
05 14 15 16 18 + 02 0605 14 15 16 25 + 02 0605 14 15 16 26 + 02 0605 14 15 16 27 + 02 0605 14 15 18 25 + 02 0605 14 15 18 26 + 02 0605 14 15 18 27 + 02 0605 14 15 25 26 + 02 0605 14 15 25 27 + 02 0605 14 15 26 27 + 02 0605 14 16 18 25 + 02 0605 14 16 18 26 + 02 0605 14 16 18 27 ...
因为这几个字符在行中也是出现的,所以肯定不能用简单的替换实现
比如
12345 1265345
2345
需要删除每行末尾的“345”,最终文本为:
12345 1265
2
===================================
Re = Createobject("VBScript.RegExp")
Re.Global = .T.
Re.Ignorecase = .F.
Re.Pattern ="345$"
Re.MultiLine= .T.
cStr="12345 1265345"+CHR(13)+CHR(10)+"2345...
原始文本如下面两行
abc aaaaa
123 abc 444
希望每次遇到“abc”,则替换“abc”以及其后到行尾的内容为“abc efg”
即上面的文本最终替换为:
abc efg
123 abc efg
=====================================
CLEAR
Re = Createobject("VBScript.RegExp")
Re.Global = .T.
Re.Ignorecase = .F.
RE.Pattern ="abc.*"
cStr="abc aaaaa"+CHR(13)+CHR(10)+"123...
希望把
asdadas123asdasdas456asdasdasd789asdasd
替换为:
asdadas[123]asdasdas[456]asdasdasd[789]asdasd
在VFP中也可以做到,但过程比较复杂
CLEAR
Re = Createobject("VBScript.RegExp")
Re.Global = .T.
Re.Ignorecase = .F.
RE.Pattern ="(\d{3})"
cStr="asdadas123asdasdas456asdasdasd789asdasd"
?cStr
?Re.Replace(cS...
查找出 XM 字段中除汉字以外的字符,并替换掉这些字符。
CREATE CURSOR tt (xm c(10),xm1 c(10))
INSERT INTO tt (xm) VALUES ("河南\省")
INSERT INTO tt (xm) VALUES ("河-北省")
INSERT INTO tt (xm) VALUES ("北,22京市")
INSERT INTO tt (xm) VALUES ("上海市")
INSERT INTO tt (xm) VALUES ("西安市")
re = Createobject("VBScript.RegExp")
...
CLEAR
cStr = "苹果:iphone_5s;诺基亚:Nokia_1020"
* 提取出cSrt中的"iphone_5s","Nokia_1020"
Reg = Createobject("VBScript.RegExp")
Reg.Global = .T.
Reg.Ignorecase = .T.
Reg.Pattern = "\w+"
oExec=Reg.Execute(cStr)
FOR i=0 TO oExec.Count-1
?oExec.item(i).Value
ENDFOR
...
* 删除没有空格的空行
clear
cchr=chr(10)+chr(13)
cstr="111111"+replicate(cchr,3)+"222222"+replicate(cchr,5)+"3333333"+replicate(cchr,10)+"4444"
?"====="
?cstr
re = Createobject("VBScript.RegExp")
re.Global = .T.
re.Ignorecase = .T.
re.Pattern = "\r\n" && r 代表回车,n 代表换行
?"====="
?re.replac...
CREATE CURSOR tt (班级 c(10),学号 c(10),成绩 n(3))
INSERT INTO tt VALUES ("01","X0101",86)
INSERT INTO tt VALUES ("01","X0102",92)
INSERT INTO tt VALUES ("01","X0103",72)
INSERT INTO tt VALUES ("01","X0104",86)
INSERT INTO tt VALUES ("02","X0201",75)
INSERT INTO tt VALUES ("02","X0202",81)
INSE...
clear
a=3
b=a
?"孪生素数对:"
for i=3 to 100 step 2
x=0
for j=2 to i-1
if i/j=int(i/j)
x=1
endif
endfor
if x=0
a=i
if a-b=2
?b,a
endif
b=a
endif
endfor
clear
input "请输入一个正整数=" to m
store m to n,n1
x=2
s=1
y=""
do while s<n1
if mod(n,x)=0
n=n/x
s=s*x
y=y+transform(x)+"*"
else
x=x+1
endif
enddo
messagebox(transform(s)+"="+left(y,len(y)-1))
RECNO()>RECCOUNT()-N
CREATE CURSOR Cj (班级 C(5),姓名 C(10),总分 N(4),班级名次 N(6),年级名次 N(6))
=RAND(-1)
FOR I=1 TO 1000
FOR J=1 TO 50
INSERT INTO Cj (班级,姓名,总分) VALUES ("B"+PADL(I,4,"0"),SYS(2015),RAND()*100)
ENDFOR
ENDFOR
INDEX ON 班级-STR(总分,4) TAG px DESCENDING
* 班级名次
mc=1 && 记录班级名次
nzf=0 &am...
Clear
Text To s Noshow
<tr class='citytr'><td><a href='23/2301.html'>230100000000</a></td><td><a href='23/2301.html'>哈尔滨市</a></td></tr><tr class='citytr'><td><a href='23/2302.html'>230200000000</a></td><td><a href='23/2302.html'>齐齐哈尔市</a></td></tr><tr class='citytr'><td><a href='23/2303.html'...
* 汉字十进制转换为二进制
N10=ASC('编')
MESSAGEBOX('编')
C02=''
Do While N10>0
n=Mod(N10,2)
N10=int(N10/2)
C02=Str(n,1)+C02
enddo
MESSAGEBOX(C02)
* 汉字二进制转换为十进制
N10=0
FOR lnI=1 TO LEN(c02)
N10=N10+VAL(SUBSTR(C02,lnI,1))*2^(LEN(C02)-lnI)
ENDFOR
MESSAGEBOX(CHR(N10))