Deaktivieren Sie den Kompatibilitätsprüfer in Excel mit JavaScript über C++

Deaktivieren Sie den Kompatibilitätsprüfer in Excel-Tabellen in JavaScript

Wie Sie den Kompatibilitätsprüfer in Microsoft Excel deaktivieren

Um den Kompatibilitätsprüfer in Microsoft Excel zu deaktivieren (z.B. Microsoft Excel 2007/2010):

  • (Excel 2007) Klicken Sie auf die Office-Schaltfläche, dann auf Vorbereiten, anschließend auf Kompatibilitätsprüfung ausführen und deaktivieren Sie die Option Kompatibilität beim Speichern dieser Arbeitsmappe prüfen.
  • (Excel 2010) Klicken Sie auf die Registerkarte Datei, dann auf Info, klicken Sie auf Nach Problemen suchen, klicken Sie auf Kompatibilität prüfen und deaktivieren Sie anschließend die Option Kompatibilität prüfen, wenn Sie diese Arbeitsmappe speichern.

So deaktivieren Sie den Kompatibilitätsprüfer mithilfe von Aspose.Cells-APIs

Setzen Sie die Eigenschaft Workbook.checkCompatibility auf false, um den Kompatibilitätsprüfer von Microsoft Excel zu deaktivieren.

Codebeispiele

Die folgenden Codebeispiele zeigen, wie der Kompatibilitätsprüfer mit Aspose.Cells for JavaScript via C++ deaktiviert werden kann.

<!DOCTYPE html>
<html>
    <head>
        <title>Aspose.Cells Example</title>
    </head>
    <body>
        <h1>Disable Compatibility Checker 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();

            // Instantiating a Workbook object from the uploaded file
            const workbook = new Workbook(new Uint8Array(arrayBuffer));

            // Disable the compatibility checker
            workbook.settings.checkCompatibility = false;

            // Saving the modified Excel file
            const outputData = workbook.save(SaveFormat.Xlsx);
            const blob = new Blob([outputData]);
            const downloadLink = document.getElementById('downloadLink');
            downloadLink.href = URL.createObjectURL(blob);
            downloadLink.download = 'Output_BK_CompCheck.out.xlsx';
            downloadLink.style.display = 'block';
            downloadLink.textContent = 'Download Excel File';

            document.getElementById('result').innerHTML = '<p style="color: green;">Compatibility check disabled. Click the download link to get the modified file.</p>';
        });
    </script>
</html>