📄 createtable.txt
字号:
doc = Owner
sheet = doc.ActiveSheet
r = array( 100 )
ar = array( 100 )
br = array( 100 )
cr = array( 100 )
i = 0
while i < sheet.UnitCount
r.Add( sheet.Units[i] )
i = i + 1
wend
textcount = 0
shapecount = 0
linecount = 0
i = 0
while i < r.Count
d = r[i]
if d.ClassId = 1 then
textcount = textcount + 1
r.Delete( i )
i = i - 1
else if d.ClassId = 3 then
shapecount = shapecount + 1
r.Delete( i )
i = i - 1
else if d.ClassId = 6 then
linecount = linecount + 1
r.Delete( i )
i = i - 1
end if
i = i + 1
wend
if textcount > 0 then
ar.Add( "文字单元" )
br.Add( textcount )
cr.Add( 0 )
end if
if shapecount > 0 then
ar.Add( "形状单元" )
br.Add( shapecount )
cr.Add( 0 )
end if
if linecount > 0 then
ar.Add( "线条单元" )
br.Add( linecount )
cr.Add( 0 )
end if
i = 0
while i < r.Count
d = r[i]
st = d.Type
j = 0
while j < ar.Count
if st = ar[j] then
br[j] = br[j] + 1
break
end if
j = j + 1
wend
if j = ar.Count then
ar.Add( d.Type )
br.Add( 1 )
cr.Add( d )
end if
i = i + 1
wend
x = 0
y = 250
doc.BeginUpdate()
sheet.Selection.Clear()
d = sheet.AddUnit( "text", x, y, 24, 24 )
d.BackColor = doc.BackColor
sheet.Selection.Add( d )
d = sheet.AddUnit( "text", x + 24, y, 200, 24 )
d.BackColor = doc.BackColor
sheet.Selection.Add( d )
d.Text = "类型"
d = sheet.AddUnit( "text", x + 224, y, 60, 24 )
d.BackColor = doc.BackColor
sheet.Selection.Add( d )
d.Text = CStr( "数目" )
y = y + 24
extern int = SelectObject( int, int ) in Gdi32.dll
extern void = DeleteObject( int ) in Gdi32.dll
extern int = CreateCompatibleDC( int ) in Gdi32.dll
extern int = CreateCompatibleBitmap( int, int, int ) in Gdi32.dll
extern void = DeleteDC( int ) in Gdi32.dll
extern int = GetDC( int ) in User32.dll
extern void = ReleaseDC( int, int ) in User32.dll
dc = GetDC( Handle )
memdc = CreateCompatibleDC( dc )
i = 0
while i < ar.Count
d = sheet.AddUnit( "text", x, y, 24, 24 )
d.BackColor = doc.BackColor
if cr[i] <> 0 then
hBitmap = CreateCompatibleBitmap( dc, 16, 16 )
hOldBitmap = SelectObject( memdc, hBitmap )
cr[i].PaintIn( memdc, 16, 16 )
SelectObject( memdc, hOldBitmap )
d.PictureBitmap = hBitmap
DeleteObject( hBitmap )
end if
sheet.Selection.Add( d )
d = sheet.AddUnit( "text", x + 24, y, 200, 24 )
d.BackColor = doc.BackColor
sheet.Selection.Add( d )
d.Text = ar[i]
d.TextAlign = 4
d = sheet.AddUnit( "text", x + 224, y, 60, 24 )
d.BackColor = doc.BackColor
sheet.Selection.Add( d )
d.Text = CStr( br[i] )
d.TextAlign = 6
y = y + 24
i = i + 1
wend
doc.MergeElement()
DeleteDC( memdc )
ReleaseDC( Handle, dc )
doc.EndUpdate()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -