මචන්ලා මට වෙන කෙනෙක් Nodejs වලින් හදපු ස්යිටම් එකක් පොඩි චේන්ජස් වගයක් කරන්න වෙලා තියෙනවා.එකේ මුලින් තිබ්බ ඩේටා මෙහෙම තිබුනේ
පස්සේ ක්ලයන්ට් රික්වයාමන්ට් එක මචන්
මේකට තව නෙස්ටඩ් array එකක් ඇඩ් වෙනවා මේ විදිහට
එකේ දැනට docx.js වලින් word document එකක් genarete වෙනවා
මට ඕනි section.address , එකට පහලින් හැම හොටෙල් එකකම stars ගානයි තියෙන කමෙන්ට් එකයි docx .js වලින් word file එකට ඇතුලත් කරන්න.
බොහොම ස්තුති බම්ප් එකක් වත් ගෙන යන්න.මම js වලට අලුත් මචන්ලා
JSON:
[{
"restaurantName":"Bronco",
"address":"39 Rue des Petites Écuries, 75010 Paris",
"lat":48.8737815,
"long":2.3501649
},
{
{
"restaurantName":"Babalou",
"address":"4 Rue Lamarck, 75018 Paris",
"lat":48.8865035,
"long":2.3442197
}
}
]
පස්සේ ක්ලයන්ට් රික්වයාමන්ට් එක මචන්
මේකට තව නෙස්ටඩ් array එකක් ඇඩ් වෙනවා මේ විදිහට
JSON:
[{
"restaurantName":"Bronco",
"address":"39 Rue des Petites Écuries, 75010 Paris",
"lat":48.8737815,
"long":2.3501649,
"ratings":[
{
"stars":4,
"comment":"Un excellent restaurant, j'y reviendrai !Par contre il vaut mieux aimer la viande."
},
{
"stars":5,
"comment":"Tout simplement mon restaurant préféré !"
}
]
},
{
{
"restaurantName":"Babalou",
"address":"4 Rue Lamarck, 75018 Paris",
"lat":48.8865035,
"long":2.3442197,
"ratings":[
{
"stars":5,
"comment":"Une minuscule pizzeria délicieuse cachéejuste à côté du Sacré choeur !"
},
{
"stars":3,
"comment":"J'ai trouvé ça correct, sans plus"
}
]
}]
එකේ දැනට docx.js වලින් word document එකක් genarete වෙනවා
JavaScript:
createSections(sections) {
return sections.map((section, index) => new docx.TableRow({
children: [
new docx.TableCell({
children: [new docx.Paragraph({ text: `${HotelNumber}.${5 + index}`, })],
}),
new docx.TableCell({
verticalAlign: docx.VerticalAlign.CENTER,
children: [
new docx.Paragraph({ text: section.restaurantName }),
new docx.Paragraph({
text: section.address ,
}),
මට ඕනි section.address , එකට පහලින් හැම හොටෙල් එකකම stars ගානයි තියෙන කමෙන්ට් එකයි docx .js වලින් word file එකට ඇතුලත් කරන්න.
බොහොම ස්තුති බම්ප් එකක් වත් ගෙන යන්න.මම js වලට අලුත් මචන්ලා

