Free Support Forum - aspose.cloud

How to add the records in table using cloud api


#1

I am using node js and i want to add some records (rows value) into table. but i am unable to find the property/parameter which i need to pass for insert the record.

I am able to create the table by using following api “https://apireference.aspose.cloud/words/#!/Tables/InsertTable”. its only created blank table with some specific row and column,

But i am unable to find the api for insert the record for the table.

Can you please send me the api for insert the record into table?


#2

@arunkamboj

You can add data to each cell using PutParagraph API as following.

const fileName = "TestTable.docx";
const destFileName = "TestTable_updated.docx";

var request = new PutParagraphRequest();
request.name = fileName;
request.folder = "";
request.destFileName=destFileName
request.paragraph =  new ParagraphInsert ({ text: "This is a new paragraph for your document" });
request.nodePath = "sections/0/tables/0/rows/0/cells/0";

wordsApi.putParagraph(request).then((result) => {    
    console.log(result.body.code);    
}).catch(function(err) {
    // Deal with an error
    console.log(err);
});

Furthermore, following directory contains the Unit Tests (examples) of each Node.js SDK API: https://github.com/aspose-words-cloud/aspose-words-cloud-node/tree/master/test

Please note, the Unit Tests are grouped by the type of action over the document. Action could be one of two types: we can somehow change document elements, e.g. bookmarks, fields etc. or we can make some document actions e.g. convert, mailmerge and so on.