I'm looking for a way to get the border width of a Google Docs using the API?
I have setup a test document that has two 1-cell tables. First one with default borders and the second one with 0-width borders and a third one with 3 pt border.
https://docs.google.com/document/d/1KOiw6bmsNhdOGGr9OZDWHNHrEID5RZncyCRRFFSU_Ok/edit
I retrieve the document using the get request
I can't find any difference between the three tables in terms of border width.
According to the documentation TableCellStyle should have borderTop/Bottom/Left/Right values but I'm not sure what I need to do to have them included in the response.
All 3 tableCellStyle looks the same, like this:
"tableCellStyle": {
"rowSpan": 1,
"columnSpan": 1,
"backgroundColor": {},
"paddingLeft": {
"magnitude": 5,
"unit": "PT"
},
"paddingRight": {
"magnitude": 5,
"unit": "PT"
},
"paddingTop": {
"magnitude": 5,
"unit": "PT"
},
"paddingBottom": {
"magnitude": 5,
"unit": "PT"
},
"contentAlignment": "TOP"
}
Each table cell contain a paragraph with a the same paragraphstyle:
"borderLeft": {
"color": {},
"width": {
"unit": "PT"
},
"padding": {
"unit": "PT"
},
"dashStyle": "SOLID"
},
Update
I was setting the table border in the above example which is not represented in the API response. My assumption was that the table border was reflected in the cells in the response data since there was no property for the table border itself. Which is partly correct, see answers.
0, there is the case that the property is not shown. For example, this can be seen at Sheets API. Ref This might be the current specification. I think that about the border width of0, this is the reason of"width": {"unit": "PT"},. About the border widths of1and3, I could replicate your issue. I think that this might be a bug. Docs API is growing now. So this might be resolved in the future. - Tanaike1and3can be included in the response value from Docs API. About this issue, I think that this might be related to above situation. Because the default border color is the black which has0, 0, 0for red, green and blue, respectively. By this,rgbColorof the border color has no properties. - Tanaike