Περιηγηθείτε στα Προϊόντα μας

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Product Docs Swagger Examples Blog Support Dashboard

Εγκατάσταση

Το πακέτο είναι διαθέσιμο στο npmjs.com και μπορεί να εγκατασταθεί μέσω npm εκτελώντας την παρακάτω εντολή:

npm install groupdocs-editor-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Απαιτήσεις

  • Node.js 4.8 ή νεότερη
  • npm
  • Διαπιστευτήρια GroupDocs Cloud — Client ID and Client Secret από τον Πίνακα ελέγχου

Εξαρτήσεις

Το SDK απαιτεί τα ακόλουθα πακέτα:

PackageConstraint
axios1.8.4
form-data*
jsonwebtoken9.0.1
qs6.11.2

Γρήγορη εκκίνηση

Λάβετε τα διαπιστευτήρια API

Για να χρησιμοποιήσετε το GroupDocs.Editor Cloud, εγγραφείτε στον GroupDocs.Cloud Dashboard και λάβετε το Client ID και το Client Secret σας.

Αρχικοποίηση του API

Χρησιμοποιήστε τον παρακάτω κώδικα για να ξεκινήσετε να χρησιμοποιείτε το GroupDocs.Editor Cloud SDK for Node.js.

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);

Δείτε το πλήρες παράδειγμα στο RunExamples.js.

Επεξεργασία εγγράφου επεξεργασίας κειμένου

Μετά την αρχικοποίηση, χρησιμοποιήστε αυτό το βασικό παράδειγμα για να φορτώσετε ένα έγγραφο Word που προστατεύεται με κωδικό, να αντικαταστήσετε κείμενο στο HTML και να το αποθηκεύσετε ξανά ως DOCX.

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);
const fileApi = editor_cloud.FileApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "WordProcessing/password-protected.docx";
    fileInfo.password = "password";
    let loadOptions = new editor_cloud.WordProcessingLoadOptions();
    loadOptions.fileInfo = fileInfo;
    loadOptions.outputPath = "output";
    let loadResult = await editApi.load(new editor_cloud.LoadRequest(loadOptions));

    let buf = await fileApi.downloadFile(new editor_cloud.DownloadFileRequest(loadResult.htmlPath));
    let htmlString = buf.toString("utf-8");
    htmlString = htmlString.replace("Sample test text", "Hello world");
    await fileApi.uploadFile(new editor_cloud.UploadFileRequest(loadResult.htmlPath, new Buffer(htmlString, "utf-8")));

    let saveOptions = new editor_cloud.WordProcessingSaveOptions();
    saveOptions.fileInfo = fileInfo;
    saveOptions.outputPath = "output/edited.docx";
    saveOptions.htmlPath = loadResult.htmlPath;
    saveOptions.resourcesPath = loadResult.resourcesPath;
    let saveResult = await editApi.save(new editor_cloud.SaveRequest(saveOptions));
    console.log("Document edited: " + saveResult.path);
})();

Δείτε το πλήρες παράδειγμα στο EditWordProcessingDocument.js.

Επεξεργασία υπολογιστικού φύλλου

Αυτό το παράδειγμα φορτώνει το πρώτο φύλλο εργασίας, επεξεργάζεται το HTML και το αποθηκεύει ξανά ως XLSX.

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);
const fileApi = editor_cloud.FileApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "Spreadsheet/four-sheets.xlsx";
    let loadOptions = new editor_cloud.SpreadsheetLoadOptions();
    loadOptions.fileInfo = fileInfo;
    loadOptions.outputPath = "output";
    loadOptions.worksheetIndex = 0;
    let loadResult = await editApi.load(new editor_cloud.LoadRequest(loadOptions));

    let buf = await fileApi.downloadFile(new editor_cloud.DownloadFileRequest(loadResult.htmlPath));
    let htmlString = buf.toString("utf-8");
    htmlString = htmlString.replace("This is sample sheet", "This is sample sheep");
    await fileApi.uploadFile(new editor_cloud.UploadFileRequest(loadResult.htmlPath, new Buffer(htmlString, "utf-8")));

    let saveOptions = new editor_cloud.SpreadsheetSaveOptions();
    saveOptions.fileInfo = fileInfo;
    saveOptions.outputPath = "output/edited.xlsx";
    saveOptions.htmlPath = loadResult.htmlPath;
    saveOptions.resourcesPath = loadResult.resourcesPath;
    let saveResult = await editApi.save(new editor_cloud.SaveRequest(saveOptions));
    console.log("Document edited: " + saveResult.path);
})();

Δείτε το πλήρες παράδειγμα στο EditSpreadsheetDocument.js.

Λήψη πληροφοριών εγγράφου

Αυτό το παράδειγμα επιστρέφει τον αριθμό σελίδων ενός εγγράφου Word που προστατεύεται με κωδικό.

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = editor_cloud.InfoApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "WordProcessing/password-protected.docx";
    fileInfo.password = "password";
    fileInfo.storageName = "First Storage";
    let request = new editor_cloud.GetInfoRequest(fileInfo);
    let response = await infoApi.getInfo(request);
    console.log("GetDocumentInfo: Page Count = " + response.pageCount);
})();

Δείτε το πλήρες παράδειγμα στο GetDocumentInfo.js.

Λήψη υποστηριζόμενων μορφών Editor

Ανακτήστε τις μορφές εγγράφων που μπορεί να επεξεργαστεί το API.

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = editor_cloud.InfoApi.fromConfig(config);

(async () => {
    let response = await infoApi.getSupportedFileFormats();
    console.log("Supported file-formats:");
    response.formats.forEach(function (format) {
        console.log(format.fileFormat + "(" + format.extension + ")");
    });
})();

Δείτε το πλήρες παράδειγμα στο GetSupportedFormats.js.

Παραδείγματα στο GitHub

Το αποθετήριο GroupDocs.Editor Cloud Node.js Examples περιλαμβάνει έτοιμα προς εκτέλεση παραδείγματα που καλύπτουν:

CategoryExamples
Edit OperationsΕπεξεργασία κειμένου, υπολογιστικό φύλλο, παρουσίαση, κείμενο και οριοθετημένα αρχεία
InfoΠληροφορίες εγγράφου, κατανάλωση άδειας, υποστηριζόμενοι τύποι αρχείων

Τρόπος εκτέλεσης των παραδειγμάτων

  1. Κλωνοποιήστε ή κατεβάστε το αποθετήριο παραδειγμάτων
  2. Επεξεργαστείτε το Examples/RunExamples.js και ορίστε τα clientId και clientSecret
  3. Μεταβείτε στον κατάλογο Examples
  4. Εκτελέστε npm install
  5. Εκτελέστε npm update
  6. Εκτελέστε npm run-script start

Για περισσότερες λεπτομέρειες, επισκεφθείτε το Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Editing API | Node.js Cloud API | GroupDocs.Editor Cloud | REST API | Word Processing Formats | Spreadsheet Formats | Presentation Formats | Text Formats | CSV Files | DOCX Documents | XLSX Documents | PPTX Presentations | Password-Protected Files | Cloud Storage Integration | Document Info Retrieval | File Operations | WYSIWYG Editing | Multi-Platform Support | Secure API Access | HTML Editing | Cross-platform API



 Ελληνικά