Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells APIs already provide the feature of converting spreadsheets to PDF. With this release of the API, users can now optimize the resultant PDF size as well. Aspose.Cells for Java 8.7.0 exposes the PdfSaveOptions.OptimizationType property along with the PdfOptimizationType enumeration in order to facilitate users in choosing the desired optimization algorithm while exporting spreadsheets to PDF format. There are two possible values for the PdfSaveOptions.OptimizationType property as detailed below.
PdfOptimizationType.MINIMUM_SIZE: Quality is compromised for the resultant file size.PdfOptimizationType.STANDARD: Quality isn’t compromised, so the resultant file size will be large.Following is the simple usage scenario.
Java
//Create an instance of PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
//Set the OptimizationType property to desired value
pdfSaveOptions.setOptimizationType(PdfOptimizationType.MINIMUM_SIZE);
//Create an instance of Workbook
//Optionally load an existing spreadsheet
Workbook book = new Workbook(inFilePath);
//Save the spreadsheet in PDF format while passing the instance of PdfSaveOptions
book.save(outFilePath, pdfSaveOptions);
Newly exposed VbaProject.isSigned property can be used to detect if the VBA project in a Workbook is digitally signed. The VbaProject.isSigned property is of type Boolean, which returns true if the VBA project is digitally signed and false otherwise.
Following is the simple usage scenario.
Java
//Create an instance of Workbook and load an existing spreadsheet
Workbook book = new Workbook(inFilePath);
//Access the VbaProject from the Workbook
VbaProject vbaProject = book.getVbaProject();
//Check if VbaProject is digitally signed
if (vbaProject.isSigned())
{
System.out.println("VbaProject is digitally signed");
}
else
{
System.out.println("VbaProject is not digitally signed");
}
Aspose.Cells APIs have enhanced the Protection class by introducing the verifyPassword method, which allows specifying a password as a String and verifies whether the same password has been used to protect the worksheet. The Protection.verifyPassword method returns true if the specified password matches the password used to protect the given worksheet, and false if the specified password does not match. The following piece of code uses the Protection.verifyPassword method in conjunction with the Protection.isProtectedWithPassword field to detect password protection and verify the password.
Following is the simple usage scenario.
Java
//Create an instance of Workbook and load a spreadsheet
Workbook book = new Workbook(inFilePath);
//Access the protected Worksheet
Worksheet sheet = book.getWorksheets().get(0);
//Check if Worksheet is password protected
if (sheet.getProtection().isProtectedWithPassword())
{
//Verify the password used to protect the Worksheet
if (sheet.getProtection().verifyPassword("password"))
{
System.out.println("Specified password has matched");
}
else
{
System.out.println("Specified password has not matched");
}
}
This release of Aspose.Cells for Java has also exposed the Protection.isProtectedWithPassword field, which can be useful for detecting whether a worksheet is password‑protected.
Following is the simple usage scenario.
Java
//Create an instance of Workbook and load an existing spreadsheet
Workbook book = new Workbook(inFilePath);
//Access the desired Worksheet via its index or name
Worksheet sheet = book.getWorksheets().get(0);
//Access Protection module of desired Worksheet
Protection protection = sheet.getProtection();
//Check if Worksheet is password protected
if (protection.isProtectedWithPassword())
{
System.out.println("Worksheet is password protected");
}
else
{
System.out.println("Worksheet is not password protected");
}
Aspose.Cells for Java 8.7.0 has exposed the ColorScale.Is3ColorScale property that can be used to create 2‑Color Scale conditional format. The property is of type Boolean with a default value of true, which means that the conditional format will be a 3‑Color Scale by default. However, setting the ColorScale.Is3ColorScale property to false will generate a 2‑Color Scale conditional format.
Following is the simple usage scenario.
Java
//Create an instance of Workbook
//Optionally load an existing spreadsheet
Workbook book = new Workbook();
//Access the Worksheet to which conditional formatting rule has to be added
Worksheet sheet = book.getWorksheets().get(0);
//Add FormatConditions to the collection
int index = sheet.getConditionalFormattings().add();
//Access newly added formatConditionCollection via its index
FormatConditionCollection formatConditionCollection = sheet.getConditionalFormattings().get(index);
//Create a CellArea on which conditional formatting rule will be applied
CellArea cellArea = CellArea.createCellArea("A1", "A5");
//Add conditional formatted cell range
formatConditionCollection.addArea(cellArea);
//Add format condition of type ColorScale
index = formatConditionCollection.addCondition(FormatConditionType.COLOR_SCALE);
//Access newly added format condition via its index
FormatCondition formatCondition = formatConditionCollection.get(index);
//Set Is3ColorScale to false in order to generate a 2-Color Scale format
formatCondition.getColorScale().setIs3ColorScale(false);
//Set other necessary properties
Aspose.Cells for Java 8.7.0 provides support to identify and parse formulas while loading CSV/TXT files containing delimited plain data. The newly exposed TxtLoadOptions.HasFormula property, when set to true, directs the API to parse the formulas from the input delimited file and assign them to the relevant cells without requiring any additional processing.
Following is the simple usage scenario.
Java
//Create an instance of TxtLoadOptions
TxtLoadOptions options = new TxtLoadOptions();
//Set HasFormula property to true
options.setHasFormula(true);
//Set the Separator property as desired
options.setSeparator(',');
//Load the CSV/TXT file using the instance of TxtLoadOptions
Workbook book = new Workbook(inFilePath, options);
//Calculate formulas in order to get the calculated values of formula in CSV
book.calculateFormula();
//Write result in any of the supported formats
book.save(outFilePath);
Another useful feature that Aspose.Cells for Java 8.7.0 has exposed is the DataLabels.ResizeShapeToFitText property, which enables the “resize shape to fit text” feature of the Excel application for a chart’s data labels.
Following is the simple usage scenario.
Java
//Create an instance of Workbook containing the Chart
Workbook book = new Workbook(inFilePath);
//Access the Worksheet that contains the Chart
Worksheet sheet = book.getWorksheets().get(0);
//Access the desired Chart via its index or name
Chart chart = sheet.getCharts().get(0);
//Access the DataLabels of desired NSeries
DataLabels labels = chart.getNSeries().get(0).getDataLabels();
//Set ResizeShapeToFitText property to true
labels.setResizeShapeToFitText(true);
//Calculate Chart
chart.calculate();
The Workbook.SaveOptions property was marked obsolete some time ago. With this release, it has been completely removed from the public API; therefore, it is advised to use the Workbook.save(Stream, SaveOptions) or Workbook.save(String, SaveOptions) method as an alternative.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.