打印格格式中,如何把特殊符號(hào)后的字符去掉(如下,客戶名稱中,怎樣把“^”后面的字符去掉)?


解決方法:
(1)新建公式—輸入名稱(customerName)-點(diǎn)擊使用編輯器


(2)在報(bào)表自定義函數(shù)里新建一個(gè)函數(shù)---選擇Basic語(yǔ)法,在編輯器里輸入:
Function
cheakdepart( s as string)
'先進(jìn)行判斷
'聲明已知字符串的字節(jié)數(shù)、"^"所在位置的變量
Dim n As Number
, m As Number
'聲明字符串變量
Dim s0 as string
'如果包含"^"符號(hào)截取其后文本
if ("^" in s) then
For n = 1 To Len(s) '這里用了Len函數(shù)來(lái)計(jì)算已知字符串的字節(jié)數(shù)
m = InStr(s, "^", -1) '"^"所在的位置(其中的-1是默認(rèn)的)
'顯示第一個(gè)"^"后面的字符串
s0 = Left(s, m)
next n
s0=Replace (s0, "^"," " )
else '否則直接輸出
s0=s
end if
cheakdepart =s0
End Function


(3)在公式字段customerName編輯器里,輸入cheakdepart({StockOut.cusName})


(4)把公式customerName拖出到格式即可

