LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Tuesday, May 7, 2019

canvasのwidthとheightの設定


タグ内で設定したい
<canvas id="canvas1" width=600 height="1200"></canvas>

スクリプトで設定したい
  var canvas_div = elem('canvas_div');
  var canvas = document.getElementById('canvas1');
  canvas.width = 600;
  canvas.height = 1200;


補足:スタイルで設定してもうまくいかなかった

<style>
  #canvas1 {
    width: 600;
    height1200;
  }
</style>


参考

HTMLCanvas​Element​.width
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width


HTMLCanvas​Element​.height

Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...