0

Google App Script で契約アプリケーションをコーディングしています。

販売者の署名とイニシャルの画像を含むテンプレートから GoogleDoc を作成します。

売り手が5人、テンプレートが十数種類あるので、サインやイニシャルのイメージを変える方法はありますか?

私はそれをどこから探し始めるべきか手がかりがありません。

ありがとう、良い一日を!

  • エリック

編集: DocumentApp で InlineImage について何かを見つけました...まだ探しています

4

1 に答える 1

0

これは、Google ドキュメントに画像を追加する小さなコードです。これがあなたに始めるためのアイデアを与えることを願っています. プロフィール写真と署名画像を置き換える履歴書作成アプリケーションを作成するために使用した同様の概念

//Make a UI form to upload Image
function doGet() {
  var app = UiApp.createApplication();

  //Form
  var form = app.createFormPanel().setEncoding('multipart/form-data').setId('form');
  //Add this form to the application
  app.add(form);

  //Panel to hold form elements
  var panel = app.createVerticalPanel();
  //add this panel inside form
  form.add(panel);

  //Now create form elemnts
  var label1 = app.createLabel('Upload Image');
  var uploadControl = app.createFileUpload().setName('file').setId('file');
  var submitBtn = app.createSubmitButton('Submit');
  //Add all these elemnts to the panel
  panel.add(label1).add(uploadControl).add(submitBtn);

  //Return the application to the service URL
  return app;
}

//This function is callend when the form is submitted
function doPost(e){
  var fileBlob = e.parameter.file; //This is the image blob if an image is uploded

  //Open the document
  var doc = DocumentApp.openById('ID OF GOOGLE DOC')//change Id of the document
  //get the body of document
  var docBody = doc.getActiveSection();
  //Append the iamge in document body
  docBody.appendImage(fileBlob);
  //Save and close the document
  doc.saveAndClose();
}
于 2012-12-20T15:32:44.107 に答える