gdocsHelper

package
v0.0.0-...-2c1144f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFilePermission

func AddFilePermission(ctx context.Context, config auth.Config, fileID, email, role string) error

AddFilePermission adds permissions to a file for a specific email.

func AddLinkToText

func AddLinkToText(ctx context.Context, config auth.Config, docID, searchText, url string) error

AddLinkToText adds a hyperlink to specific text in the document.

func AddTable

func AddTable(ctx context.Context, config auth.Config, docID string, rows, columns int64) error

AddTable adds a table to the Google Doc.

func AddText

func AddText(ctx context.Context, config auth.Config, docID, text string) error

AddText appends text to the end of the document.

func AddTextAfterLine

func AddTextAfterLine(ctx context.Context, config auth.Config, docID, lineContent, textToAdd string) error

AddTextAfterLine adds text after a known line.

func AddTextAfterPatternInLine

func AddTextAfterPatternInLine(ctx context.Context, config auth.Config, docID, pattern, textToAdd string) error

AddTextAfterPatternInLine adds text after a known pattern in a line.

func AddTextBetweenLines

func AddTextBetweenLines(ctx context.Context, config auth.Config, docID, startLine, endLine, textToAdd string) error

AddTextBetweenLines adds text between two known lines.

func AddTextToTableCell

func AddTextToTableCell(ctx context.Context, config auth.Config, docID string, tableIndex, rowIndex, columnIndex int64, text string) error

AddTextToTableCell adds text to a specific cell in a table.

func CreateGoogleDoc

func CreateGoogleDoc(ctx context.Context, config auth.Config, title string) (*docs.Document, error)

CreateGoogleDoc creates a new Google Doc with the given title.

func ExportGoogleDocAsText

func ExportGoogleDocAsText(ctx context.Context, config auth.Config, fileID string) (string, error)

ExportGoogleDocAsText exports a Google Doc as plain text.

func GetDocumentEndIndex

func GetDocumentEndIndex(ctx context.Context, config auth.Config, docID string) (int64, error)

GetDocumentEndIndex retrieves the index at the end of the document's body content.

func GetDocumentURL

func GetDocumentURL(fileID string) string

GetDocumentURL constructs the URL of a Google Doc given its file ID.

func InsertTextWithLinkAndRender

func InsertTextWithLinkAndRender(ctx context.Context, config auth.Config, docID, text, url string, locationIndex int64) error

InsertTextWithLinkAndRender inserts text into a Google Doc, applies a hyperlink to it, and ensures it's rendered properly.

func MakeCopyOfGoogleDoc

func MakeCopyOfGoogleDoc(ctx context.Context, config auth.Config, fileID, newTitle string) (*drive.File, error)

MakeCopyOfGoogleDoc makes a copy of an existing Google Doc.

func RenameGoogleDoc

func RenameGoogleDoc(ctx context.Context, config auth.Config, fileID, newTitle string) error

RenameGoogleDoc renames a Google Doc.

func ReplaceMultipleTexts

func ReplaceMultipleTexts(ctx context.Context, config auth.Config, docID string, replacements map[string]string) error

ReplaceMultipleTexts replaces multiple strings in the Google Doc.

func ReplaceText

func ReplaceText(ctx context.Context, config auth.Config, docID, oldText, newText string) error

ReplaceText replaces all occurrences of oldText with newText in the document.

func SetColorToTableCell

func SetColorToTableCell(ctx context.Context, config auth.Config, docID string, tableIndex, rowIndex, columnIndex int64, color *docs.OptionalColor) error

SetColorToTableCell sets the background color of a specific table cell.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL