ODS dosyalarını Node.js ve C++ kullanarak şifreyle koruma ve şifre çözme

OpenOffice Calc ile Şifrele

  1. Save as seçeneğini belirleyin ve Save With Password kutusuna tıklayın.
  2. Kaydet düğmesini tıklayın.
  3. Açılan Set Parola penceresinde, hem Açmak için Parolayı Girin hem de Parolayı Onaylayın alanlarına istediğiniz parolayı yazın.
  4. Dosyayı kaydetmek için Tamam düğmesini tıklayın.

Aspose.Cells for Node.js via C++ ile ODS dosyasını şifreleyin

Bir ODS dosyasını şifrelemek için, dosyayı yükleyin ve kaydetmeden önce WorkbookSettings.getPassword() değerini gerçek parola ile ayarlayın. Çıktı şifrelenmiş ODS dosyası yalnızca OpenOffice’da açılabilir.

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const sourceDir = path.join(__dirname, "source");
const outputDir = path.join(__dirname, "output");

// Open an ODS file
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "sampleODSFile.ods"));

// Password protect the file
workbook.getSettings().setPassword("1234");

// Save the ODS file
workbook.save(path.join(outputDir, "outputEncryptedODSFile.ods"));

Aspose.Cells for Node.js via C++ ile ODS dosyasını deşifre edin

Bir ODS dosyasını deşifre etmek için, dosyayı LoadOptions.getPassword() içeren bir parola sağlayarak yükleyin. Dosya yüklendikten sonra, WorkbookSettings.getPassword() dizesini null olarak ayarlayın.

const AsposeCells = require("aspose.cells.node");
const path = require("path");

// The path to the documents directory.
const sourceDir = path.join(__dirname, "data");
// Output directory
const outputDir = path.join(__dirname, "output");

// Open an encrypted ODS file
const loadOptions = new AsposeCells.LoadOptions(AsposeCells.LoadFormat.Ods);

// Set original password
loadOptions.setPassword("1234");

// Load the encrypted ODS file with the appropriate load options
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "sampleEncryptedODSFile.ods"), loadOptions);

// Set the password to null
workbook.getSettings().setPassword(null);

// Save the decrypted ODS file
workbook.save(outputDir + "outputDecryptedODSFile.ods");