Answered
フォントサイズを変えずに検索、置換をしたい
4月からの税込表示に関する作業についての質問です。
500円、という表示を550円、にする際に
500を検索して550に置換するのですが
例えば500、よりも円のフォントサイズが小さい場合
そちらに引っ張られて550のフォントサイズも小さくなってしまいます。
今は置換したあとに文字スタイルで元の大きさに戻していますが
フォントサイズが変更されない置換方法があるのかどうか知りたいです。
4月からの税込表示に関する作業についての質問です。
500円、という表示を550円、にする際に
500を検索して550に置換するのですが
例えば500、よりも円のフォントサイズが小さい場合
そちらに引っ張られて550のフォントサイズも小さくなってしまいます。
今は置換したあとに文字スタイルで元の大きさに戻していますが
フォントサイズが変更されない置換方法があるのかどうか知りたいです。

var taxCalc = {
tax : 10,
base : 0,
inTax : false,
re : /(\d{1,3},)?(\d{1,3})/,
exe : function (tg){
if(tg.contents.match(this.re)!=null){
var str = tg.contents.match(this.re)[0];
var idx = tg.contents.indexOf(str);
for (var i = idx+1;i<idx+str.length;i++) {
tg.characters[idx+1].remove();
}
var num= this.rtTax(this.toN(str));
tg.characters[idx].contents = this.toS(num);
}
},
toS : function (n){
if ((n+"").length<4) return String(n);
var dl = ",";
var str = String(n);
var rslt = "";
while (str.length>3){
rslt = dl + str.substr (-3, 3) + rslt;
str = str.slice(0,str.length-3);
}
rslt = str + rslt;
if (rslt.substr(0,1)==",")
rslt = rslt.substr(1,rslt.length-1);
return rslt;
},
toN : function(st){
st = st.replace (/,/g, "");
if (this.inTax) return Math.round(Number(st/(1+this.base/100)));
else return Number(st);
},
rtTax : function (n){
return Math.round(n*(1+this.tax/100));
}
}
for (var i=0;i<app.selection.length;i++){
taxCalc.exe(app.selection[i]);
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.