C++ ile Çalışma Sayfasını Koru ve Kaldır
Contents
[
Hide
]
Excel çalışma sayfanızdaki verilerin yanlışlıkla veya kasıtlı olarak değişmesini, taşınmasını veya silinmesini engellemek için hücreleri kilitleyebilir ve sayfayı bir şifre ile koruyabilirsiniz.
MS Excel’de Çalışma Sayfasını Koru ve Kaldır
- Tıklayın İncele > Sayfayı Koru.
- Şifre kutusuna bir şifre girin.
- izin ver seçeneklerini seçin.
- Tamam‘ı seçin, şifreyi teyit etmek için tekrar girin, ardından tekrar Tamam‘ı seçin.
Aspose.Cells for C++ kullanarak Çalışma Sayfasını Koru
Excel dosyalarının çalışma sayfasını korumak için sadece aşağıdaki basit kod satırlarına ihtiyaç vardır.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create a new workbook
Workbook workbook;
// Get the first worksheet
Worksheet sheet = workbook.GetWorksheets().Get(0);
// Protect contents of the worksheet
sheet.Protect(ProtectionType::Contents);
// Protect worksheet with password
sheet.GetProtection().SetPassword(u"test");
// Save as Excel file
workbook.Save(u"Book1.xlsx");
std::cout << "Workbook created and protected successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
Aspose.Cells for C++ kullanarak Çalışma Sayfasının korumasını kaldır
Aspose.Cells API ile çalışma sayfasını korumak kolaydır. Eğer çalışma sayfası şifre ile korunuyorsa doğru bir şifre gereklidir.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create a new workbook
Workbook workbook(u"Book1.xlsx");
// Get the first worksheet
Worksheet sheet = workbook.GetWorksheets().Get(0);
// Unprotect the worksheet with password
sheet.Unprotect(u"password");
// Save the workbook
workbook.Save(u"Book1.xlsx");
std::cout << "Worksheet unprotected successfully!" << std::endl;
Aspose::Cells::Cleanup();
}