在我使用 Google Slide API 为我创建幻灯片后,我看到带有文本的文本框,上面写着“单击以添加文本”、“单击以添加标题”,以及 2 列侧相同,我该如何设置右侧的文本?单击以添加文本',左侧相同。
如何以编程方式找出那些文本框并设置我想要的文本?
这里是代码:我 1)创建一个幻灯片并使其 TITLE_AND_TWO_COLUMNS 布局 2)创建一个形状和 3)插入文本到形状。但是当我在谷歌驱动器中查看幻灯片时,我看到“点击添加文本”
IList<Request> requests = new List<Request>();
String slideId = "MyNewSlide_001";
requests.Add(new Request()
{
CreateSlide = new CreateSlideRequest()
{
ObjectId = slideId,
InsertionIndex = 1,
SlideLayoutReference = new LayoutReference()
{
PredefinedLayout = "TITLE_AND_TWO_COLUMNS"
}
}
});
String textBoxId = "MyTextBox_01";
Dimension pt350 = new Dimension()
{
Magnitude = 350.0,
Unit = "PT",
};
requests.Add(new Request()
{
CreateShape = new CreateShapeRequest()
{
ObjectId = textBoxId,
ShapeType = "TEXT_BOX",
ElementProperties = new PageElementProperties()
{
PageObjectId = slideId,
Size = new Size()
{
Height = pt350,
Width = pt350
},
},
}
});
requests.Add(new Request()
{
UpdateShapeProperties = new UpdateShapePropertiesRequest()
{
ObjectId = textBoxId,
ShapeProperties = new ShapeProperties
{
ShapeBackgroundFill = new ShapeBackgroundFill
{
SolidFill = new SolidFill
{
Color = new OpaqueColor
{
ThemeColor = "HYPERLINK"
}
}
}
},
Fields = "shapeBackgroundFill.solidFill.color,outline"
},
});
// Insert text into the box, using the object ID given to it.
requests.Add(new Request()
{
InsertText = new InsertTextRequest()
{
ObjectId = textBoxId,
InsertionIndex = 0,
Text = "New Box Text Inserted"
}
});