我们如何使用 php 更改 table with google docs api 中整行的背景颜色?
How we can change the background color for the entire row in table with google docs api using php?
我想一次性更改整行 table 的背景颜色 go.But 我可以根据以下代码请求为特定单元格设置背景颜色。
$requests = [
new Google_Service_Docs_Request([
'insertTable' => [
'location' => ['index' => 1],
'columns' => 2,
'rows' => 2
]
]),
new Google_Service_Docs_Request([
"updateTableCellStyle" => [
"tableCellStyle" => [
"backgroundColor" => [
"color" => [
"rgbColor" => [
"red" => 0.8,
"green" => 0.8,
"blue" => 0.8,
]
]
]
],
"fields" => "backgroundColor",
"tableRange" => [
"columnSpan" => 1,
"rowSpan" => 1,
"tableCellLocation" => [
"columnIndex" => 1,
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
]
]),
];
任何人都可以告诉我我必须在上面的代码中修改什么或者我在使用 google 文档 api 一次性为整行添加背景颜色时犯了什么错误 PHP.
从你的请求正文中,发现插入的table有2列。这样的话,当你想给第2行的“A”列和“B”列都设置背景色时,可以做如下修改吗?
发件人:
"tableRange" => [
"columnSpan" => 1,
"rowSpan" => 1,
"tableCellLocation" => [
"columnIndex" => 1,
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
收件人:
"tableRange" => [
"columnSpan" => 2,
"rowSpan" => 1,
"tableCellLocation" => [
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
注:
例如,当您要为第1行的“A”和“B”列都设置背景色时,请修改如下。
"tableRange" => [
"columnSpan" => 2,
"rowSpan" => 1,
"tableCellLocation" => [
"rowIndex" => 0, // Modified
"tableStartLocation" => [
"index" => 2
]
]
]
参考:
我想一次性更改整行 table 的背景颜色 go.But 我可以根据以下代码请求为特定单元格设置背景颜色。
$requests = [
new Google_Service_Docs_Request([
'insertTable' => [
'location' => ['index' => 1],
'columns' => 2,
'rows' => 2
]
]),
new Google_Service_Docs_Request([
"updateTableCellStyle" => [
"tableCellStyle" => [
"backgroundColor" => [
"color" => [
"rgbColor" => [
"red" => 0.8,
"green" => 0.8,
"blue" => 0.8,
]
]
]
],
"fields" => "backgroundColor",
"tableRange" => [
"columnSpan" => 1,
"rowSpan" => 1,
"tableCellLocation" => [
"columnIndex" => 1,
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
]
]),
];
任何人都可以告诉我我必须在上面的代码中修改什么或者我在使用 google 文档 api 一次性为整行添加背景颜色时犯了什么错误 PHP.
从你的请求正文中,发现插入的table有2列。这样的话,当你想给第2行的“A”列和“B”列都设置背景色时,可以做如下修改吗?
发件人:
"tableRange" => [
"columnSpan" => 1,
"rowSpan" => 1,
"tableCellLocation" => [
"columnIndex" => 1,
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
收件人:
"tableRange" => [
"columnSpan" => 2,
"rowSpan" => 1,
"tableCellLocation" => [
"rowIndex" => 1,
"tableStartLocation" => [
"index" => 2
]
]
]
注:
例如,当您要为第1行的“A”和“B”列都设置背景色时,请修改如下。
"tableRange" => [ "columnSpan" => 2, "rowSpan" => 1, "tableCellLocation" => [ "rowIndex" => 0, // Modified "tableStartLocation" => [ "index" => 2 ] ] ]