JavaScript kullanarak Kriptolanmış Office Open XML OOXML Dosyalarının Dosya Formatını Tespit Etme C++ ile
Contents
[
Hide
]
Office Open XML (aynı zamanda OOXML veya Microsoft Open XML (MOX) olarak da bilinir), Microsoft tarafından geliştirilmiş ve ofis belgelerini (çeşitli elektronik tablo, grafik, sunum ve word işleme belgeleri) temsil eden XML tabanlı bir dosya formatıdır.
Aspose.Cells, şifreli Microsoft Open XML dosyalarının dosya formatını tespit etmenin bir yolunu sunar. Dosya türünü belirlemek için, aşağıdaki kod örneğinde gösterildiği gibi FileFormatUtil.detectFileFormat(Uint8Array) metodunu kullanın.
<!DOCTYPE html>
<html>
<head>
<title>Aspose.Cells Example</title>
</head>
<body>
<h1>Aspose.Cells FileFormat 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, FileFormatUtil, Utils } = 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 a small byte stream equivalent to the original JavaScript Buffer
const stream = new Uint8Array([0x50, 0x4B, 0x03, 0x04]);
// Verify password (will propagate errors if any)
FileFormatUtil.verifyPassword(stream, "1234");
// Detect file format
const fileFormatInfo = FileFormatUtil.detectFileFormat(stream);
// Use property access per universal getter/setter conversion
document.getElementById('result').innerHTML = '<p>File Format: ' + fileFormatInfo.fileFormatType + '</p>';
console.log("File Format: " + fileFormatInfo.fileFormatType);
});
});
</script>
</html>