NodeJS API to add watermark for local Microsoft Excel and OpenOffice Calc spreadsheet
NodeJS library to add watermark for local Microsoft Excel and OpenOffice Calc spreadsheet
Add watermark for local Microsoft Excel and OpenOffice Calc spreadsheet - NodeJS REST API
API Request:
POST
https://api.aspose.cloud/v3.0/cells/watermark
Adding watermark for a local spreadsheet is a complex task. Adding watermark for a local spreadsheet transitions is performed by our NodeJS SDK while maintaining the source spreadsheet's main structural and logical content. Our NodeJS library is a professional solution to adding watermark for local spreadsheets online. This Cloud SDK gives NodeJS developers powerful functionality and perfect API.
Code example in Node using REST API to add watermark for local spreadsheets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-node/ | |
const { LightCellsApi, PostWatermarkRequest } = require("asposecellscloud"); | |
const clientId = process.env.CellsCloudClientId; | |
const clientSecret = process.env.CellsCloudClientSecret; | |
const ApiURL = process.env.CellsCloudApiBaseUrl; | |
const fs = require('fs'); | |
const path = require('path'); | |
const cellsApi = new LightCellsApi(clientId, clientSecret,"v3.0",ApiURL); | |
const localPath = "D:/aspose-cells-cloud-node/TestData/" | |
const AssemblyTestXlsx = "assemblytest.xlsx"; | |
const DataSourceXlsx = "datasource.xlsx"; | |
const dataAssemblyTestXlsx = fs.createReadStream(path.join(localPath, AssemblyTestXlsx)); | |
const dataDataSourceXlsx = fs.createReadStream(path.join(localPath, DataSourceXlsx)); | |
const req = new PostWatermarkRequest ({ | |
file: { AssemblyTestXlsx: dataAssemblyTestXlsx, DataSourceXlsx: dataDataSourceXlsx }, | |
text : "Aspose.Cells Cloud", | |
color : "#fff" | |
}); | |
cellsApi.postWatermark(req) | |
.then((result) => { | |
console.log("successfully") | |
let buff = new Buffer.from(result.body.files[0].fileContent, 'base64'); | |
fs.writeFileSync(result.body.files[0].filename, buff); | |
}) | |
.catch((error) => { | |
console.error('Unhandled Promise Rejection:', error); | |
}); |
How to use Node API to add watermark
- Create an account at Dashboard to get free API quota & authorization details
- Initialize CellsApi with Client Id, Client Secret, Base URL & API version
- Call postWatermark method to get the resultant stream
System Requirements
- node v6.17.1 or newer