Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
This release of Aspose.Cells for Java API has exposed the WorkbookDesigner.CallBack field and ISmartMarkerCallBack interface that together allow you to get notifications about the cell reference and/or smart marker being processed [/cells/java/getting-notifications-while-merging-data-with-smart-markers/]. The following piece of code demonstrates the usage of the ISmartMarkerCallBack interface to define a new class that handles the callback for the WorkbookDesigner.process method.
Java
public class SmartMarkerCallBack implements ISmartMarkerCallBack
{
Workbook workbook;
SmartMarkerCallBack(Workbook workbook)
{
this.workbook = workbook;
}
@Override
public void process(int sheetIndex, int rowIndex, int colIndex, String tableName, String columnName)
{
System.out.println("Processing Cell : " + workbook.getWorksheets().get(sheetIndex).getName() + "!" + CellsHelper.cellIndexToName(rowIndex, colIndex));
System.out.println("Processing Marker : " + tableName + "." + columnName);
}
}
The rest of the process includes loading the designer spreadsheet containing the smart markers with WorkbookDesigner or creating one from scratch and processing it by setting the data source. However, in order to enable the notifications, it is necessary to set the WorkbookDesigner.CallBack property before calling the WorkbookDesigner.process method as demonstrated below.
Java
//Instantiate a new Workbook designer
WorkbookDesigner report = new WorkbookDesigner();
//Get the first worksheet of the workbook
Worksheet sheet = report.getWorkbook().getWorksheets().get(0);
//Set the Variable Array marker to a cell
//You may also place this Smart Marker into a template file manually using Excel and then open this file via WorkbookDesigner
sheet.getCells().get("A1").putValue("&=$VariableArray");
//Set the data source for the marker(s)
report.setDataSource("VariableArray", new String[] { "English", "Arabic", "Hindi", "Urdu", "French" });
//Set the CallBack property
report.setCallBack(new SmartMarkerCallBack(report.getWorkbook()));
//Process the markers
report.process(false);
Aspose.Cells for Java 8.6.2 has exposed the Chart.toPdf method that can be used to directly render the chart shape to PDF format. The method currently accepts a parameter of type String as the file‑path location to store the resulting file on disk.
The following is a simple usage scenario.
Java
//Load spreadsheet containing charts
Workbook workbook = new Workbook(inputFilePath);
//Access first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
//Access first chart inside the worksheet
Chart chart = worksheet.getCharts().get(0);
//Save the chart in PDF format
chart.toPdf(outputFilePath);
Aspose.Cells for Java 8.6.2 has exposed the Workbook.removeUnusedStyles method that can be used to remove all unused Style objects from the pool of styles.
The following is a simple usage scenario.
Java
//Load spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Remove all unused styles from the template
workbook.removeUnusedStyles();
The Cells.Style property can be used to access the style for the worksheet that represents the default style.
The following is a simple usage scenario.
Java
//Load a spreadsheet
Workbook book = new Workbook(inputFilePath);
//Access the default style of worksheet
Style style = book.getWorksheets().get(0).getCells().getStyle();
Aspose.Cells.GridWeb for Java 8.6.2 has exposed the following two new events.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.