تحديد فاصل عشري مخصص للأرقام وفاصلات مجموع للورقة العمل
Contents
[
Hide
]
يمكنك في Microsoft Excel تحديد الفاصل العشري المخصص وفاصل الآلاف بدلاً من استخدام الفواصل النظامية من خيارات Excel المتقدمة كما هو موضح في اللقطة أدناه.
يوفر Aspose.Cells الطريقتين WorkbookSettings.numberDecimalSeparator و WorkbookSettings.numberGroupSeparator لضبط الفواصل المخصصة لتنسيق / تحليل الأرقام.
تحديد الفواصل المخصصة باستخدام Microsoft Excel
تُظهر اللقطة الشاشية التالية خيارات Excel المتقدمة وتبرز القسم الخاص بتحديد الفواصل المخصصة.

تحديد فواصل مخصصة باستخدام Aspose.Cells for JavaScript عبر C++
يوضح الكود العينة التالي كيفية تحديد الفواصل المخصصة باستخدام واجهة برمجة التطبيقات Aspose.Cells. يحدد فاصل العدد المخصص وفاصل المجموعة المخصصين على أنهما نقطة ومسافة على التوالي.
رمز جافا سكريبت لتحديد فواصل الأرقام العشرية والمجمعة المخصصة
<!DOCTYPE html>
<html>
<head>
<title>Aspose.Cells Example</title>
</head>
<body>
<h1>Custom Number Separator Example</h1>
<input type="file" id="fileInput" accept=".xls,.xlsx,.csv" />
<button id="runExample">Run Example</button>
<a id="downloadLink" style="display: none;">Download Result</a>
<div id="result"></div>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, SaveFormat } = AsposeCells;
AsposeCells.onReady({
license: "/lic/aspose.cells.enc",
fontPath: "/fonts/",
fontList: [
"arial.ttf",
"NotoSansSC-Regular.ttf"
]
}).then(() => {
console.log("Aspose.Cells initialized");
});
document.getElementById('runExample').addEventListener('click', async () => {
const fileInput = document.getElementById('fileInput');
if (!fileInput.files.length) {
document.getElementById('result').innerHTML = '<p style="color: red;">Please select an Excel file.</p>';
return;
}
const file = fileInput.files[0];
const arrayBuffer = await file.arrayBuffer();
// Load workbook from uploaded file
const workbook = new Workbook(new Uint8Array(arrayBuffer));
// Specify custom separators
workbook.settings.numberDecimalSeparator = '.';
workbook.settings.numberGroupSeparator = ' ';
const worksheet = workbook.worksheets.get(0);
// Set cell value
const cell = worksheet.cells.get("A1");
cell.value = 123456.789;
// Set custom cell style
const style = cell.style;
style.custom = "#,##0.000;[Red]#,##0.000";
cell.style = style;
worksheet.autoFitColumns();
// Save workbook as pdf
const outputData = workbook.save(SaveFormat.Pdf);
const blob = new Blob([outputData], { type: 'application/pdf' });
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'CustomSeparator_out.pdf';
downloadLink.style.display = 'block';
downloadLink.textContent = 'Download PDF File';
document.getElementById('result').innerHTML = '<p style="color: green;">Operation completed successfully! Click the download link to get the PDF.</p>';
});
</script>
</html>