Google Word文書の内容を取得して、テキストボックスに入れたいと思っています。次のコードはエラーを吐き出します:
function listBoxClick(e) {
var tapp = UiApp.getActiveApplication();
var docName = DocsList.find(e.parameter.doclist); //find the document with the same name as what the user clicked on
var docContents = docName[0].getContentAsString(); //get contents of document
tapp.getElementById("songboxID").setValue(songfile2); //set the value of the textBox to the contents of the document
return tapp;
}
これにより、次のエラーが返されます。
Unsupported conversion requested.
Googleドキュメントではこれを実行できないとどこかで読みましたが、アップロードする他のGoogle以外のドキュメントでは実行できます。そうですか?
私は新しくて評判がないので、あと5時間は投稿できないという答えは次のとおりです。
セルジュの助けを借りて、これが私のために働いたものです:
function listBoxClick(e) {
var tapp = UiApp.getActiveApplication();
var docName = DocsList.find(e.parameter.doclist); //get document name based on what user clicked on in listBox
var docId = docName[0].getId(); //get document ID
var content = DocumentApp.openById(docId).getText(); //get contents of document
tapp.getElementById("songboxID").setValue(content); //set web app's textBox (called songboxID) to match the contents of the document the user clicked on
return tapp;
}