0

I'm trying to add a footer to my docs in Go. Here is my code.

createFooterReq := &docs.Request{
        CreateFooter: &docs.CreateFooterRequest{
            SectionBreakLocation: &docs.Location{
                Index:     0,
                SegmentId: "",
            },
            Type: "DEFAULT",
        },
    }

    // Insert text into the footer
    footerText := "This is a footer added with Go"
    insertTextReq := &docs.Request{
        InsertText: &docs.InsertTextRequest{
            Text: footerText,
            EndOfSegmentLocation: &docs.EndOfSegmentLocation{
                SegmentId: "",
            },
        },
    }

But in the editor (I use vscode) there is no error but İn the document I guess it didn't write in the footer wrote on the top left of the document and also when i run one more time this Error is come Error 400: Invalid requests[0].createFooter: Default footer already exists., badRequest exit status 1

I didn't try a new code but the result is the same

footerText := "Hello, world!"
    requests := []*docs.Request{
        {
            CreateFooter: &docs.CreateFooterRequest{
                SectionBreakLocation: &docs.Location{
                    Index:     0,
                    SegmentId: "",
                },
                Type: "DEFAULT",
            },
        },
        {
            InsertText: &docs.InsertTextRequest{
                Text: footerText,
                EndOfSegmentLocation: &docs.EndOfSegmentLocation{
                    SegmentId: "",
                },
            },
        },
    }

I would really appreciate if you can help

I'm trying to add a footer and write on footer some text

0 Answers0