You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to print a Xlsx to pdf and removing all protection from excel file, the output pdf file doesn´t include the excel data
workbook = new Workbook(rutaExcel);
vbaProject = workbook.getVbaProject();
vbaProject.protect(false, "");
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.get(1);
System.out.println("Esta protegido --> "+ worksheet.getProtection());
Protection protection = worksheet.getProtection();
// Restricting users to delete columns of the worksheet
protection.setAllowDeletingColumn(false);
// Restricting users to delete row of the worksheet
protection.setAllowDeletingRow(false);
// Restricting users to edit contents of the worksheet
protection.setAllowEditingContent(false);
// Restricting users to edit objects of the worksheet
protection.setAllowEditingObject(false);
// Restricting users to edit scenarios of the worksheet
protection.setAllowEditingScenario(false);
// Restricting users to filter
protection.setAllowFiltering(false);
// Allowing users to format cells of the worksheet
protection.setAllowFormattingCell(true);
// Allowing users to format rows of the worksheet
protection.setAllowFormattingRow(true);
// Allowing users to insert columns in the worksheet
protection.setAllowInsertingColumn(true);
// Allowing users to insert hyperlinks in the worksheet
protection.setAllowInsertingHyperlink(true);
// Allowing users to insert rows in the worksheet
protection.setAllowInsertingRow(true);
// Allowing users to select locked cells of the worksheet
protection.setAllowSelectingLockedCell(true);
// Allowing users to select unlocked cells of the worksheet
protection.setAllowSelectingUnlockedCell(true);
// Allowing users to sort
protection.setAllowSorting(true);
// Allowing users to use pivot tables in the worksheet
protection.setAllowUsingPivotTable(true);
// Saving the modified Excel file Excel XP format
worksheet.unprotect();
workbook.save(valorRuta, FileFormatType.XLSX);
workbook.save(valorRutaPDF, SaveFormat.PDF);
workbook.save(valorRutaPDF1, pdfSave);
workbook1 = new Workbook(valorRuta);
workbook1.save(rutaPDF, SaveFormat.PDF);
The text was updated successfully, but these errors were encountered:
We need your template Xlsx file to evaluate your issue. So, kindly do upload to some file sharing service (e.g Dropbox, Google drive, any other, etc.) and share the Download link, so we could check your issue precisely.
Also, please note:
If you need to unprotect a worksheet, you may simply use Worksheet.unprotect method.
If you want to unprotect a protected workbook, you may use Workbook.unprotect method.
If you need to clear the password for an encrypted file, you may try workbook.getSettings().setPassword(null)
Trying to print a Xlsx to pdf and removing all protection from excel file, the output pdf file doesn´t include the excel data
workbook = new Workbook(rutaExcel);
The text was updated successfully, but these errors were encountered: