反饋已提交
網絡繁忙
本文介紹的是儲存格字體的JS API方法。使用【addEffect】 方法,【type】 參數的兩個值分別對應【儲存格字體變化】、【儲存格所在列字體變化】。
方法
addEffect(type, opts)
滑鼠點選或者懸浮時,儲存格或所在列字體變化。
參數
type: string,
opts: {
style: {
bold: boolean,
italic: boolean,
fontFamily: string,
strikeThrough: boolean,
fontSize: number,
subscript: boolean,
underLine: {
style: string,
color: number
},
textShadow: boolean,
supscript: boolean,
trigger: string,
single: boolean
}
【type】:變化範圍,字串。
【setCellFont】:滑鼠點選/懸浮時儲存格字體變化。
【setRowFont】:滑鼠點選/懸浮時儲存格所在列字體。
【opts】:變化屬性,json 格式。 【style】: 字體格式,json 格式。
【bold】: 是否粗體,【true】 粗體,【false】 正常。
【italic】: 是否斜體,【true】 斜體,【false】 正常。
【fontFamily】: 字體,字串。
【strikeThrough】:是否有刪除線,【true】 有,【false】 無。
【fontSize】: 字號,數字。
【subscript】: 是否靠上顯示,【true】或【false】。
【underLine】: 底線樣式,json 格式。
【style】: 線型,字串,【solid】實線 ,【dashed】虛線。
【color】: number 顏色,十六進制顏色代碼。
【textShadow】: 文字是否有陰影效果,【true】或【false】。
【supscript】: 是否靠下顯示,【true】或【false】。
【color】: number 字體顏色,十六進制顏色代碼。
【trigger】: 滑鼠的操作,不寫時預設為【mouseover】。【mouseover】 :滑鼠懸浮。【mousedown】:滑鼠點選。
【single】:恢復邏輯,布林型,預設為 【true】。【true】:滑鼠點選/懸浮其他位置時恢復。【false】:滑鼠再次點選/懸浮此位置時恢復。
傳回值
void
行動端
支援行動端。
設定【addEffect】第一個參數 【type】值為 【setCellFont】 ,滑鼠點選或者懸浮儲存格,儲存格字體格式變化。
範例1:若獲取到的報表塊物件定義為 【report】 ,滑鼠懸浮時字體顯示為紅色粗體 14 號,離開時恢復。具體代碼如下代碼塊1所示。
範例2:若獲取到的報表塊物件定義為 【report】 ,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。具體代碼如下代碼塊2所示。
範例3:普通報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。具體代碼如下代碼塊3所示。
範例4:普通報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。具體代碼如下代碼塊4所示。
範例5:決策報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。具體代碼如下代碼塊5所示。
範例6:決策報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。具體代碼如下代碼塊6所示。
<!-- 滑鼠懸浮時字體顯示為紅色粗體 14 號,離開時恢復。 -->report.addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->report.addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->_g().addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->_g().addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->_g().getWidgetByName('report0').addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->_g().getWidgetByName('report0').addEffect('setCellFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
範例1:滑鼠點選儲存格時字體顯示為紅色粗體 14 號,離開時恢復。點選可下載範本:滑鼠懸浮儲存格字體變化.cpt。如下圖1所示。
範例2:滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。點選可下載範本:滑鼠點選儲存格字體變化.cpt。如下圖2所示。
設定【addEffect】 第一個參數 【type】值為 【setRowFont】,滑鼠點選或者懸浮儲存格,儲存格所在列字體格式變化。
範例1:若獲取到的報表塊物件定義為 【report】 ,滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。具體代碼如下代碼塊1所示。
<!-- 滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。 -->report.addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->report.addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->_g().addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->_g().addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->_g().getWidgetByName('report0').addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mouseover', single: true});
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->_g().getWidgetByName('report0').addEffect('setRowFont', { style: { bold: true, fontSize: 14, color: 'red' }, trigger: 'mousedown', single: false});
範例1:滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。點選可下載範本:滑鼠懸浮儲存格所在列字體變化.cpt。如下圖1所示。
範例2:滑鼠點選儲存格時,所在列字體顯示為紅色粗體 14 號,再次點選恢復。點選可下載範本:滑鼠點選儲存格所在列字體變化.cpt。如下圖2所示。
文 檔回 饋
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉