Sunting DOC ing Go SDK

Gunakake REST API kanggo nyunting DOC ing Go kanthi terprogram

Nalika pangembang ngowahi DOC dokumen nganggo perpustakaan Go iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo DOC dokumen sing diwakili minangka DOM. Kanthi Go SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak DOC, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.

Ndeleng potongan kode

Sunting DOC ing Go nggunakake REST API

Pustaka Go kita menehi pangembang kemampuan kanggo ngowahi DOC dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.

Sunting teks ing DOC file nggunakake Go

Kasus sing paling populer kanggo nyunting DOC file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Go ing dokumen kasebut.

Sunting tabel ing DOC file nggunakake Go

Pilihan editing DOC liyane sing populer yaiku nyunting tabel. Go SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.

Pangembang Go bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.

Tambah gambar menyang DOC file nggunakake Go

Saliyane nyunting teks lan tabel ing DOC, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Go. Pangembang Go uga bisa nambah gambar menyang DOC file nggunakake DOM.

Sunting DOC kanthi terprogram

Coba Go SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan DOC dokumen. Nggunakake conto ing ngisor iki, muat DOC dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang DOC dokumen:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input.doc")
requestParagraph := models.ParagraphInsert{
    Text: ToStringPointer("Morbi enim nunc faucibus a."),
}

insertParagraphOnlineOptions := map[string]interface{}{}
insertParagraphRequest := &models.InsertParagraphOnlineRequest{
    Document: requestDocument,
    Paragraph: &requestParagraph,
    Optionals: insertParagraphOnlineOptions,
}
insertParagraph := wordsApi.InsertParagraphOnline(ctx, insertParagraphRequest)

convertOptions := map[string]interface{}{}
convertRequest := &models.ConvertDocumentRequest{
    Document: insertParagraph.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertOptions,
}
convert := wordsApi.ConvertDocument(ctx, convertRequest)
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input.doc")
requestTable := models.TableInsert{
    ColumnsCount: ToInt32Pointer(int32(1)),
    RowsCount: ToInt32Pointer(int32(2)),
}

insertTableOnlineOptions := map[string]interface{}{"nodePath": "",}
insertTableRequest := &models.InsertTableOnlineRequest{
    Document: requestDocument,
    Table: &requestTable,
    Optionals: insertTableOnlineOptions,
}
insertTable := wordsApi.InsertTableOnline(ctx, insertTableRequest)

convertOptions := map[string]interface{}{}
convertRequest := &models.ConvertDocumentRequest{
    Document: insertTable.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertOptions,
}
convert := wordsApi.ConvertDocument(ctx, convertRequest)
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input1.doc")
requestDrawingObject := models.DrawingObjectInsert{
    Height: ToFloat64Pointer(0),
    Left: ToFloat64Pointer(0),
    Top: ToFloat64Pointer(0),
    Width: ToFloat64Pointer(0),
    RelativeHorizontalPosition: ToStringPointer("Margin"),
    RelativeVerticalPosition: ToStringPointer("Margin"),
    WrapType: ToStringPointer("Inline"),
}

requestImageFile, _ := os.Open("Input2.doc")
insertDrawingObjectOnlineOptions := map[string]interface{}{"nodePath": "sections/0",}
insertDrawingObjectRequest := &models.InsertDrawingObjectOnlineRequest{
    Document: requestDocument,
    DrawingObject: &requestDrawingObject,
    ImageFile: requestImageFile,
    Optionals: insertDrawingObjectOnlineOptions,
}
insertDrawingObject := wordsApi.InsertDrawingObjectOnline(ctx, insertDrawingObjectRequest)

convertOptions := map[string]interface{}{}
convertRequest := &models.ConvertDocumentRequest{
    Document: insertDrawingObject.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertOptions,
}
convert := wordsApi.ConvertDocument(ctx, convertRequest)
Kode roto
  
Nyalin kode Go menyang clipboard

Cara Ngowahi DOC ing Go

  1. Pasang 'Aspose.Words Cloud kanggo Go'
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Go sampeyan
  3. Muat DOC kanggo nyunting ing Go
  4. Lebokake isi ing wiwitan DOC
  5. Download dokumen asil saka panyimpenan maya

Pustaka Go kanggo nggunakake panyuntingan DOC.

Run go get -v github.com/aspose-words-cloud/aspose-words-cloud-go/2007/api kanggo nginstal Aspose.Words Cloud SDK for Go. Sampeyan bisa entuk akeh informasi migunani babagan cara instalasi liyane saka bagean "How to use SDK".

Klone Aspose.Words Cloud SDK for Go saka GitHub lan gunakake ing proyek sampeyan. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.

Requirements Sistem

Deleng Repository Documentation kanggo ndeleng rincian.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi suntingan kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.