Upgrade to Pro — share decks privately, control downloads, hide ads and more …

最近のGASのアプデの話をしよう

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for godan godan
June 24, 2020

 最近のGASのアプデの話をしよう

Avatar for godan

godan

June 24, 2020
Tweet

More Decks by godan

Other Decks in Programming

Transcript

  1. DrawingClass - 実装されているメゾット getContainerInfo() getHeight() getOnAction() getSheet() getWidth() getZIndex() remove()

    setHeight(height) setOnAction(macroName) setPosition(RowPos, ColPos, x, y) setWidth(width) setZIndex(zIndex)
  2. 図形のサイズなどを取得する function printDrawSize() { const drawings =SpreadsheetApp.getActiveSheet().getDrawings(); // 縦(pixels) Logger.log(drawings[0].getHeight())

    // 横(pixels) Logger.log(drawings[0].getWidth()) // 重なり順(数字が大きいものほど手前になります ) Logger.log(drawings[0].getZIndex()) // 設置されてるシート名 Logger.log(drawings[0].getSheet()) }
  3. 図形の位置を取得する function printDrawPosition() { const drawings =SpreadsheetApp.getActiveSheet().getDrawings(); // 設置されている列番号 Logger.log(drawings[0].getContainerInfo().getAnchorColumn())

    // 設置されている行番号 Logger.log(drawings[0].getContainerInfo().getAnchorRow()) // 設置されているセルの左上からどれだけx軸で離れているか(pixcel) Logger.log(drawings[0].getContainerInfo().getOffsetX()) // 設置されているセルの左上からどれだyy軸で離れているか(pixcel) Logger.log(drawings[0].getContainerInfo().getOffsetY()) }
  4. 重い処理中データが触れないようにする function coverCell() { const drawings = SpreadsheetApp. getActiveSheet() .getDrawings();

    // 高さと横幅変更[ drawings[0].setWidth(1920) drawings[0].setHeight(1080) // 場所変更 drawings[0].setPosition(1, 1, 0, 0) // … 処理後 … // 高さと横幅変更 drawings[0].setWidth(1) drawings[0].setHeight(1) // 場所変更 drawings[0].setPosition(1, 1, 0, 0) }
  5. 重い処理中データが触れないようにする function coverCell() { const drawings = SpreadsheetApp. getActiveSheet() .getDrawings();

    // 高さと横幅変更[ drawings[0].setWidth(1920) drawings[0].setHeight(1080) // 場所変更 drawings[0].setPosition(1, 1, 0, 0) // … 処理後 … // 高さと横幅変更 drawings[0].setWidth(1) drawings[0].setHeight(1) // 場所変更 drawings[0].setPosition(1, 1, 0, 0) } ちなみに0を指定すると 450px x 325pxになる
  6. プログレスバーを作る function progressbar() { const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); const width

    = 500 const Height = 100 const drawings = spreadsheet.getSheetByName('進捗バー ').getDrawings() window = drawings[0] progress = drawings[1] // 初期化 window.setHeight(Height) window.setWidth(width) window.setPosition(1, 1, 0, 0) progress.setHeight(100) progress.setWidth(1) // \進捗ゼロ!/ progress.setPosition(1, 1, 0, 0) for(var i = 1; i <= 100; i++){ progress.setWidth((width/100) * i) } }