0
誰でもこのコードが「無効な色ですか?」というエラーを返す理由を教えてもらえますか?無効なBACKGROUND_COLORですか?
これは、BACKGROUND_COLOR属性を参照しているようです。しかし、私は理由を理解できません。
function myFunction() {
var bibiDoc = {};
bibiDoc[DocumentApp.Attribute.BACKGROUND_COLOR] = 0x000000;
bibiDoc[DocumentApp.Attribute.FONT_FAMILY] = 'Courier New';
bibiDoc[DocumentApp.Attribute.FOREGROUND_COLOR] = 0x00FF00;
bibiDoc[DocumentApp.Attribute.FONT_SIZE] = 12;
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
var par = body.appendParagraph("test");
par.setAttributes(bibiDoc);
}
INVALID COLORが返されません。あなたのコードをテストし、背景色に関するエラーはありません。 http://imgur.com/LxBMvIZ 新しいスクリプトプロジェクトにカラーコードをコピーして、それが実際にエラーの原因であるかどうかを確認してください。 – noogui
16進数の代わりに文字列を使用してください。 (参考:https://developers.google.com/apps-script/reference/document/attribute) –