Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to create a tab? #3735

Unanswered
gorgulenkozxc asked this question in Q&A
Discussion options

I'm using googleapis 155.0.1 and want to create a document with two tabs and write content in them.

I found that there's a method docs_v1.Resource$Documents.create, which apparently accepts as a parameter object with requestBody of type Schema$Documentwhich itself lets to specify the tabs field. Unfortunately, however, the commentary on usage states the following:

Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document.

Indeed, the filled tabs field is ignored, and an empty document with the one default tab is created.

Then I thought that if create didn't work, maybe batchUpdate would help me, but I was unsuccessful there too. batchUpdate takes as its first parameter an object of type Params$Resource$Documents$Batchupdate, consisting of documentId and requestBody of type Schema$BatchUpdateDocumentRequest.

Schema$BatchUpdateDocumentRequest can contain only two parameters: requests of type Schema$Request and writeControl Schema$WriteControl.
According to the description «A list of updates to apply to the document», it is the requests parameter that should be of interest to me.

And that's where I stopped, not knowing what else to do.
Schema$Request has the following options:

Which of these methods creates a new tab???

createFooter, createFootnote, createHeader, createNamedRange, createParagraphBullets,
deleteContentRange, deleteFooter, deleteHeader, deleteNamedRange, deleteParagraphBullets,
deletePositionedObject, deleteTableColumn, deleteTableRow, insertInlineImage, insertPageBreak,
insertSectionBreak, insertTable, insertTableColumn, insertTableRow, insertText,
mergeTableCells, pinTableHeaderRows, replaceAllText, replaceImage, replaceNamedRangeContent,
unmergeTableCells, updateDocumentStyle, updateParagraphStyle, updateSectionStyle, updateTableCellStyle,
updateTableColumnProperties, updateTableRowStyle, updateTextStyle

insertText of type Schema$InsertTextRequest has location of type Schema$Location which has tabId and the following comment...

The tab that the location is in. When omitted, the request is applied to the first tab. In a document containing a single tab: - If provided, must match the singular tab's ID. - If omitted, the request applies to the singular tab. In a document containing multiple tabs: - If provided, the request applies to the specified tab. - If omitted, the request applies to the first tab in the document.

So if I don't provide it, text will just be placed in the first tab. If I do provide tabId, it's allowed only to be the same tabId as the first tab, meaning I just can't create new tab with text using insertText

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /