Belge Bilgi Panelinde Görünen Özel Özellikler Eklemek JavaScript ve C++ ile
Contents
[
Hide
]
Belge Bilgi Paneli içinde görülebilen Özel Özellikler eklemek
Aspose.Cells for JavaScript C++ kullanarak, çalışma kitabı nesnesine özel özellikler ekleyebilirsiniz. Bu özellikler, Belge Bilgi Paneli içinde görünür. Microsoft Excel’de Belge Bilgi Panelini açmak için Dosya > Bilgi > Özellikler > Belge Panelini Göster komutlarını kullanabilirsiniz.
Lütfen belge bilgisi panelinde görünür olacak özelleştirilmiş özellik eklemek için ContentTypePropertyCollection.add(string, string) yöntemini kullanın.
Aşağıdaki örnek kod, iki özelleştirilmiş özellik ekler. Birinci özellik herhangi bir tipe sahip değildir, ikinci özellik ise tarih/zaman tipi taşır. Bu kodla oluşturulan çıktı Excel dosyasını açtığınızda, bu iki özelliği Belge Bilgisi Panelinde göreceksiniz.
<!DOCTYPE html>
<html>
<head>
<title>Aspose.Cells Example</title>
</head>
<body>
<h1>Adding Custom Properties Example</h1>
<input type="file" id="fileInput" accept=".xls,.xlsx,.csv" />
<button id="runExample">Create Workbook with Custom Properties</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 () => {
// Create workbook object
const workbook = new Workbook();
// Add simple property without any type
workbook.contentTypeProperties.add("MK31", "Simple Data");
// Add date time property with type
workbook.contentTypeProperties.add("MK32", "04-Mar-2015", "DateTime");
// Save the workbook
const outputData = workbook.save(SaveFormat.Xlsx);
const blob = new Blob([outputData]);
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'AddingCustomPropertiesVisible_out.xlsx';
downloadLink.style.display = 'block';
downloadLink.textContent = 'Download Excel File';
document.getElementById('result').innerHTML = '<p style="color: green;">Workbook created and saved. Click the download link to get the file.</p>';
});
</script>
</html>