تغيير اتجاه نص التعليق باستخدام Node.js عبر C++
Contents
[
Hide
]
يتيح Microsoft Excel للمستخدمين إضافة تعليقات إلى الخلايا لإضافة معلومات إضافية وتسليط الضوء على البيانات. قد يحتاج المطورون إلى تخصيص التعليق لتحديد إعدادات المحاذاة واتجاه النص. توفر Aspose.Cells for Node.js via C++ APIs لإنجاز المهمة.
توفر Aspose.Cells for Node.js via C++ خاصية Shape.getTextDirection() لضبط اتجاه نص التعليق. يوضح الكود التالي استخدام الخاصية Shape.getTextDirection() لضبط اتجاه النص في التعليق.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiate a new Workbook
const wb = new AsposeCells.Workbook();
// Get the first worksheet
const sheet = wb.getWorksheets().get(0);
// Add a comment to A1 cell
const commentIndex = sheet.getComments().add("A1");
const comment = sheet.getComments().get(commentIndex);
// Set its vertical alignment setting
comment.getCommentShape().setTextVerticalAlignment(AsposeCells.TextAlignmentType.Center);
// Set its horizontal alignment setting
comment.getCommentShape().setTextHorizontalAlignment(AsposeCells.TextAlignmentType.Right);
// Set the Text Direction - Right-to-Left
comment.getCommentShape().setTextOrientationType(AsposeCells.TextDirectionType.RightToLeft);
// Set the Comment note
comment.setNote("This is my Comment Text. This is test");
const outputFilePath = path.join(dataDir, "OutCommentShape.out.xlsx");
// Save the Excel file
wb.save(outputFilePath);