### Working with ChartArea Source: https://reference.aspose.com/cells/java/com.aspose.cells/chartarea This example demonstrates how to get the ChartArea object, set its foreground color, and enable shadows. ```APIDOC ## Working with ChartArea ### Description This example demonstrates how to get the ChartArea object, set its foreground color, and enable shadows. ### Method ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first worksheet Worksheet worksheet = workbook.getWorksheets().get(0); //Adding a sample value to "A1" cell worksheet.getCells().get("A1").putValue(50); //Adding a sample value to "A2" cell worksheet.getCells().get("A2").putValue(100); //Adding a sample value to "A3" cell worksheet.getCells().get("A3").putValue(150); //Adding a sample value to "B1" cell worksheet.getCells().get("B1").putValue(60); //Adding a sample value to "B2" cell worksheet.getCells().get("B2").putValue(32); //Adding a sample value to "B3" cell worksheet.getCells().get("B3").putValue(50); //Adding a chart to the worksheet int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5); //Accessing the instance of the newly added chart Chart chart = worksheet.getCharts().get(chartIndex); //Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3" chart.getNSeries().add("A1:B3", true); //Getting Chart Area ChartArea chartArea = chart.getChartArea(); //Setting the foreground color of the chart area chartArea.getArea().setForegroundColor(Color.getYellow()); //Setting Chart Area Shadow chartArea.setShadow(true); //Saving the Excel file workbook.save("book1.xls"); ``` ``` -------------------------------- ### Create and Configure a Sparkline Source: https://reference.aspose.com/cells/java/com.aspose.cells/sparkline This example demonstrates how to create a Workbook, add data to cells, define a sparkline group, add a sparkline to the group, and then convert the sparkline to an image. It shows the basic setup for using sparklines in Aspose.Cells. ```java Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); sheet.getCells().get("A1").putValue(5); sheet.getCells().get("B1").putValue(2); sheet.getCells().get("C1").putValue(1); sheet.getCells().get("D1").putValue(3); // Define the CellArea CellArea ca = new CellArea(); ca.StartColumn = 4; ca.EndColumn = 4; ca.StartRow = 0; ca.EndRow = 0; int idx = sheet.getSparklineGroups().add(com.aspose.cells.SparklineType.LINE, sheet.getName() + "!A1:D1", false, ca); SparklineGroup group = sheet.getSparklineGroups().get(idx); idx = group.getSparklines().add(sheet.getName() + "!A1:D1", 0, 4); Sparkline line = group.getSparklines().get(idx); System.out.println("Saprkline data range: " + line.getDataRange() + ", row: " + line.getRow() + ", column: " + line.getColumn()); line.toImage("output.png", new ImageOrPrintOptions()); ``` -------------------------------- ### Instantiate GridWeb Control Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/mainweb This example demonstrates how to create a new instance of the GridWeb control. This is a common starting point for using the GridWeb component in your application. ```java GridWeb GridWeb1 = new GridWeb(); //do your business ``` -------------------------------- ### Instantiate Workbook and Access Row Source: https://reference.aspose.com/cells/java/com.aspose.cells/rowcollection This example demonstrates how to instantiate a Workbook, get a worksheet, and access the first row using the RowCollection. ```java Workbook workbook = new Workbook(); Worksheet worksheet = workbook.getWorksheets().get(0); Row row = worksheet.getCells().getRows().get(0); ``` -------------------------------- ### AutoFill Range with Example Source: https://reference.aspose.com/cells/java/com.aspose.cells/range Automatically fills the target range based on the source range's data. This example demonstrates filling a range with a series starting from existing values. ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); // Get the first Worksheet Cells. Cells cells = workbook.getWorksheets().get(0).getCells(); cells.get("A1").putValue(1); cells.get("A2").putValue(2); Range source = cells.createRange("A1:A2"); Range target = cells.createRange("A3:A10"); //fill 3,4,5....10 to the range A3:A10 source.autoFill(target); //Save the Excel file workbook.save("book1.xlsm"); ``` -------------------------------- ### Get Start Index Source: https://reference.aspose.com/cells/java/com.aspose.cells/fractionequationnode Gets the starting index of the characters associated with this equation node. ```java getStartIndex() ``` -------------------------------- ### Example Usage Source: https://reference.aspose.com/cells/java/com.aspose.cells/themecolor Demonstrates how to use the ThemeColor class to set font and foreground colors with theme colors and tint values in an Excel file. ```APIDOC ## Example ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); Cells cells = workbook.getWorksheets().get(0).getCells(); cells.get("A1").putValue("Hello World"); Style style = cells.get("A1").getStyle(); //Set ThemeColorType.Text2 color type with 40% lighten as the font color. style.getFont().setThemeColor(new ThemeColor(ThemeColorType.TEXT_2, 0.4)); style.setPattern(BackgroundType.SOLID); //Set ThemeColorType.Background2 color type with 75% darken as the foreground color style.setForegroundThemeColor(new ThemeColor(ThemeColorType.BACKGROUND_2, -0.75)); cells.get("A1").setStyle(style); //Saving the Excel file workbook.save("book1.xlsx"); ``` ``` -------------------------------- ### Get Start Date - Aspose.Cells Timeline Source: https://reference.aspose.com/cells/java/com.aspose.cells/timeline Gets the start date of the timeline's scrolling position. This is useful for determining the visible date range. ```java public DateTime getStartDate() ``` -------------------------------- ### Creating and Configuring a Slicer Source: https://reference.aspose.com/cells/java/com.aspose.cells/slicer This example demonstrates how to create a Workbook, add data, create a Pivot Table, and then add and configure a Slicer linked to the Pivot Table. It also shows how to select/deselect slicer items and apply styles. ```APIDOC ## Creating and Configuring a Slicer ### Description This code snippet illustrates the process of generating an Excel file with a Pivot Table and a Slicer. It involves setting up sample data, creating a Pivot Table from this data, and then adding a Slicer associated with a specific field ('fruit' in this case) from the Pivot Table. The example also covers styling the Pivot Table and the Slicer, refreshing pivot table data, and manipulating individual slicer cache items (like deselecting an item). ### Method This is a Java code example demonstrating the use of the Aspose.Cells API. ### Endpoint N/A (This is an SDK example, not an HTTP endpoint) ### Parameters N/A ### Request Example ```java Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); Cells cells = sheet.getCells(); cells.get(0, 0).setValue("fruit"); cells.get(1, 0).setValue("grape"); cells.get(2, 0).setValue("blueberry"); cells.get(3, 0).setValue("kiwi"); cells.get(4, 0).setValue("cherry"); cells.get(5, 0).setValue("grape"); cells.get(6, 0).setValue("blueberry"); cells.get(7, 0).setValue("kiwi"); cells.get(8, 0).setValue("cherry"); cells.get(0, 1).setValue("year"); cells.get(1, 1).setValue(2020); cells.get(2, 1).setValue(2020); cells.get(3, 1).setValue(2020); cells.get(4, 1).setValue(2020); cells.get(5, 1).setValue(2021); cells.get(6, 1).setValue(2021); cells.get(7, 1).setValue(2021); cells.get(8, 1).setValue(2021); cells.get(0, 2).setValue("amount"); cells.get(1, 2).setValue(50); cells.get(2, 2).setValue(60); cells.get(3, 2).setValue(70); cells.get(4, 2).setValue(80); cells.get(5, 2).setValue(90); cells.get(6, 2).setValue(100); cells.get(7, 2).setValue(110); cells.get(8, 2).setValue(120); PivotTableCollection pivots = sheet.getPivotTables(); int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable"); PivotTable pivot = pivots.get(pivotIndex); pivot.addFieldToArea(PivotFieldType.ROW, "fruit"); pivot.addFieldToArea(PivotFieldType.COLUMN, "year"); pivot.addFieldToArea(PivotFieldType.DATA, "amount"); pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10); pivot.refreshData(); pivot.calculateData(); SlicerCollection slicers = sheet.getSlicers(); int slicerIndex = slicers.add(pivot, "E12", "fruit"); Slicer slicer = slicers.get(slicerIndex); slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_2); SlicerCacheItemCollection items = slicer.getSlicerCache().getSlicerCacheItems(); SlicerCacheItem item = items.get(0); item.setSelected(false); //do your business book.save("out.xlsx"); ``` ### Response N/A (This is a code execution example that saves a file.) ``` -------------------------------- ### Get Start Index Source: https://reference.aspose.com/cells/java/com.aspose.cells/accentequationnode Gets the starting index of the characters within the equation node. This can be useful for text processing or referencing specific parts of the equation. ```java public int getStartIndex() ``` -------------------------------- ### get(int index) Source: https://reference.aspose.com/cells/java/com.aspose.cells/shapeguidecollection Gets a shape guide by its index. ```APIDOC ## get(int index) ### Description Gets a shape guide by index ### Method ```java public ShapeGuide get(int index) ``` ### Parameters #### Path Parameters - **index** (int) - Required - The index of the shape guide to retrieve. ### Returns ShapeGuide - The shape guide at the specified index. ``` -------------------------------- ### Create and Configure a Table with ListColumns Source: https://reference.aspose.com/cells/java/com.aspose.cells/listcolumn Demonstrates how to create a workbook, populate cells, add a table, and configure a specific ListColumn with a total calculation and formula. ```java Workbook workbook = new Workbook(); Cells cells = workbook.getWorksheets().get(0).getCells(); for (int i = 0; i < 5; i++) { cells.get(0,i).putValue(CellsHelper.columnIndexToName(i)); } for (int row = 1; row < 10; row++) { for (int column = 0; column < 5; column++) { cells.get(row, column).putValue(row * column); } } ListObjectCollection tables = workbook.getWorksheets().get(0).getListObjects(); int index = tables.add(0, 0, 9, 4, true); ListObject table = tables.get(0); table.setShowTotals(true); ListColumn listColumn = table.getListColumns().get(4); listColumn.setTotalsCalculation(com.aspose.cells.TotalsCalculation.SUM); listColumn.setFormula("=[A]"); workbook.save("Book1.xlsx"); ``` -------------------------------- ### Get Page Setup Source: https://reference.aspose.com/cells/java/com.aspose.cells/worksheet Retrieves the page setup configuration for the worksheet. ```APIDOC ## getPageSetup() ### Description Represents the page setup description in this sheet. ### Method GET ### Endpoint /worksheet/pageSetup ``` -------------------------------- ### Configuration and Initialization Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/gridwebbean Methods for initializing and configuring the GridWebBean. ```APIDOC ## init() ### Description The bean shall be initialized by the servlet request and response of the current page. ### Method init ``` ```APIDOC ## setACWClientPath(String value) ### Description Sets the web path of the script/image files of the control. ### Method setACWClientPath ### Parameters #### Path Parameters - **value** (String) - Required - The web path for client resources. ``` ```APIDOC ## setACWLanguageFileUrl(String value) ### Description Sets the web URL of the language file of the control. ### Method setACWLanguageFileUrl ### Parameters #### Path Parameters - **value** (String) - Required - The web URL for the language file. ``` ```APIDOC ## setBeanID(String beanID) ### Description Sets the HTML ID of the bean. ### Method setBeanID ### Parameters #### Path Parameters - **beanID** (String) - Required - The HTML ID for the bean. ``` -------------------------------- ### Get Shape Guide Value Source: https://reference.aspose.com/cells/java/com.aspose.cells/shapeguide Retrieves the current value of the shape guide. This is useful for inspecting the guide's state. ```java public double getValue() ``` -------------------------------- ### init() Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/gridwebbean Initializes the GridWebBean with the current servlet request and response. ```APIDOC ## init() ### Description Initializes the GridWebBean with the current servlet request and response. ### Method public void init() ``` -------------------------------- ### Create and Populate Workbook with PivotTable Source: https://reference.aspose.com/cells/java/com.aspose.cells/timelinecollection This example demonstrates creating an Excel workbook, adding data to a worksheet, applying date styles, creating a PivotTable, and refreshing its data. This is useful for preparing data for pivot analysis. ```java Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); Cells cells = sheet.getCells(); cells.get(0, 0).setValue("fruit"); cells.get(1, 0).setValue("grape"); cells.get(2, 0).setValue("blueberry"); cells.get(3, 0).setValue("kiwi"); cells.get(4, 0).setValue("cherry"); //Create date style Style dateStyle = new CellsFactory().createStyle(); dateStyle.setCustom("m/d/yyyy"); cells.get(0, 1).setValue("date"); cells.get(1, 1).setValue(new DateTime(2021, 2, 5)); cells.get(2, 1).setValue(new DateTime(2022, 3, 8)); cells.get(3, 1).setValue(new DateTime(2023, 4, 10)); cells.get(4, 1).setValue(new DateTime(2024, 5, 16)); //Set date style cells.get(1, 1).setStyle(dateStyle); cells.get(2, 1).setStyle(dateStyle); cells.get(3, 1).setStyle(dateStyle); cells.get(4, 1).setStyle(dateStyle); cells.get(0, 2).setValue("amount"); cells.get(1, 2).setValue(50); cells.get(2, 2).setValue(60); cells.get(3, 2).setValue(70); cells.get(4, 2).setValue(80); PivotTableCollection pivots = sheet.getPivotTables(); //Add a PivotTable int pivotIndex = pivots.add("=Sheet1!A1:C5", "A12", "TestPivotTable"); PivotTable pivot = pivots.get(pivotIndex); pivot.addFieldToArea(PivotFieldType.ROW, "fruit"); pivot.addFieldToArea(PivotFieldType.COLUMN, "date"); pivot.addFieldToArea(PivotFieldType.DATA, "amount"); pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10); //Refresh PivotTable data pivot.refreshData(); pivot.calculateData(); //do your business book.save("out.xlsx"); ``` -------------------------------- ### Get Timeline Start Date Source: https://reference.aspose.com/cells/java/com.aspose.cells/timeline Retrieves the start date of the timespan scrolling position of this timeline. ```java public DateTime getStartDate() ``` -------------------------------- ### Example Usage Source: https://reference.aspose.com/cells/java/com.aspose.cells/workbookmetadata Demonstrates how to create a WorkbookMetadata object, add a custom property, and save the changes. ```APIDOC ```java MetadataOptions options = new MetadataOptions(MetadataType.DOCUMENT_PROPERTIES); WorkbookMetadata meta = new WorkbookMetadata("book1.xlsx", options); meta.getCustomDocumentProperties().add("test", "test"); meta.save("book2.xlsx"); ``` ``` -------------------------------- ### Get Cell by Row and Column Index Example Source: https://reference.aspose.com/cells/java/com.aspose.cells/cells Demonstrates how to get a specific cell using its row and column indices. This example shows obtaining the cell at the first row and first column (A1). ```java Workbook excel = new Workbook(); Cells cells = excel.getWorksheets().get(0).getCells(); Cell cell = cells.get(0, 0); //Gets the cell at "A1" ``` -------------------------------- ### Create and Configure a Pie Chart Source: https://reference.aspose.com/cells/java/com.aspose.cells/chartshape This example demonstrates how to create a pie chart, add data, configure data labels, and adjust the chart shape's properties like lower right column and delta X. It saves the resulting Excel file. ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first worksheet Worksheet worksheet = workbook.getWorksheets().get(0); //Adding a sample value to "A1" cell worksheet.getCells().get("A1").putValue(50); //Adding a sample value to "A2" cell worksheet.getCells().get("A2").putValue(100); //Adding a sample value to "A3" cell worksheet.getCells().get("A3").putValue(150); //Adding a sample value to "B1" cell worksheet.getCells().get("B1").putValue(60); //Adding a sample value to "B2" cell worksheet.getCells().get("B2").putValue(32); //Adding a sample value to "B3" cell worksheet.getCells().get("B3").putValue(50); //Adding a chart to the worksheet int chartIndex = worksheet.getCharts().add(ChartType.PIE_EXPLODED, 5, 0, 25, 10); //Accessing the instance of the newly added chart Chart chart = worksheet.getCharts().get(chartIndex); //Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3" chart.getNSeries().add("A1:B3", true); //Show Data Labels chart.getNSeries().get(0).getDataLabels().setShowValue(true); //Getting Chart Shape ChartShape chartShape = chart.getChartObject(); //Set Lower Right Column chartShape.setLowerRightColumn(10); //Set LowerDeltaX chartShape.setLowerDeltaX(1024); //Saving the Excel file workbook.save("book1.xls"); ``` -------------------------------- ### getStartCell() Source: https://reference.aspose.com/cells/java/com.aspose.cells/jsonloadoptions Gets the start cell. ```APIDOC ## getStartCell() ### Description Gets the start cell. ### Returns java.lang.String ``` -------------------------------- ### getStartId() Source: https://reference.aspose.com/cells/java/com.aspose.cells/sqlscriptsaveoptions Gets the starting ID for sequences. ```APIDOC ## getStartId() ### Description Gets the start id. ### Method ```java public int getStartId() ``` ``` -------------------------------- ### ExtWebControl Constructor Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/extwebcontrol Initializes a new instance of the ExtWebControl class. ```APIDOC ## ExtWebControl() ### Description Initializes a new instance of the ExtWebControl class. ### Method ```java public ExtWebControl() ``` ``` -------------------------------- ### getStartRow() Source: https://reference.aspose.com/cells/java/com.aspose.cells/listobject Gets the start row of the range. ```APIDOC ## getStartRow() ### Description Gets the start row of the range. ### Method ```java public int getStartRow() ``` ### Returns int ``` -------------------------------- ### getStartColumn() Source: https://reference.aspose.com/cells/java/com.aspose.cells/listobject Gets the start column of the range. ```APIDOC ## getStartColumn() ### Description Gets the start column of the range. ### Method ```java public int getStartColumn() ``` ### Returns int ``` -------------------------------- ### getStartAt Source: https://reference.aspose.com/cells/java/com.aspose.cells/autonumberedbulletvalue Gets the starting number of the bullet. ```APIDOC ## getStartAt() ### Description Gets the starting number of the bullet. ### Method ```java public int getStartAt() ``` ### Returns int ``` -------------------------------- ### Creating and Configuring a ListObject Source: https://reference.aspose.com/cells/java/com.aspose.cells/listobject This example demonstrates how to create a new table (ListObject) in a worksheet, populate it with data, and configure its properties like showing totals and setting a calculation for a specific column. ```APIDOC ## Creating and Configuring a ListObject ### Description This example demonstrates how to create a new table (ListObject) in a worksheet, populate it with data, and configure its properties like showing totals and setting a calculation for a specific column. ### Method ```java Workbook workbook = new Workbook(); Cells cells = workbook.getWorksheets().get(0).getCells(); for (int i = 0; i < 5; i++) { cells.get(0,i).putValue(CellsHelper.columnIndexToName(i)); } for (int row = 1; row < 10; row++) { for (int column = 0; column < 5; column++) { cells.get(row, column).putValue(row * column); } } ListObjectCollection tables = workbook.getWorksheets().get(0).getListObjects(); int index = tables.add(0, 0, 9, 4, true); ListObject table = tables.get(0); table.setShowTotals(true); table.getListColumns().get(4).setTotalsCalculation(com.aspose.cells.TotalsCalculation.SUM); workbook.save("Book1.xlsx"); ``` ``` -------------------------------- ### getStartIndex() Source: https://reference.aspose.com/cells/java/com.aspose.cells/accentequationnode Gets the start index of the characters. ```APIDOC ## getStartIndex() ### Description Gets the start index of the characters. ### Method public int getStartIndex() ``` -------------------------------- ### Working with PivotTableCollection Source: https://reference.aspose.com/cells/java/com.aspose.cells/pivottablecollection This example demonstrates how to create a PivotTable, add fields to it, apply styles, filters, and format conditions, and then refresh and calculate its data. ```APIDOC ## Working with PivotTableCollection ### Description This example demonstrates how to create a PivotTable, add fields to it, apply styles, filters, and format conditions, and then refresh and calculate its data. ### Method ```java // Add a new PivotTable to the collection int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable"); PivotTable pivot = pivots.get(pivotIndex); // Add fields to the PivotTable pivot.addFieldToArea(PivotFieldType.ROW, "fruit"); pivot.addFieldToArea(PivotFieldType.COLUMN, "year"); pivot.addFieldToArea(PivotFieldType.DATA, "amount"); // Apply a style to the PivotTable pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10); // Modify a row field's display name PivotField rowField = pivot.getRowFields().get(0); rowField.setDisplayName("custom display name"); // Add a PivotFilter int index = pivot.getPivotFilters().add(0, PivotFilterType.COUNT); PivotFilter filter = pivot.getPivotFilters().get(index); filter.getAutoFilter().filterTop10(0, false, false, 2); // Add a PivotFormatCondition int formatIndex = pivot.getPivotFormatConditions().add(); PivotFormatCondition pfc = pivot.getPivotFormatConditions().get(formatIndex); FormatConditionCollection fcc = pfc.getFormatConditions(); fcc.addArea(pivot.getDataBodyRange()); int idx = fcc.addCondition(FormatConditionType.CELL_VALUE); FormatCondition fc = fcc.get(idx); fc.setFormula1("100"); fc.setOperator(OperatorType.GREATER_OR_EQUAL); fc.getStyle().setBackgroundColor(Color.getRed()); // Refresh and calculate PivotTable data pivot.refreshData(); pivot.calculateData(); ``` ### Usage Example ```java Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); Cells cells = sheet.getCells(); // Populate cells with data cells.get(0, 0).setValue("fruit"); cells.get(1, 0).setValue("grape"); // ... (rest of the data population) PivotTableCollection pivots = sheet.getPivotTables(); // ... (code to add and configure PivotTable as shown above) book.save("out.xlsx"); ``` ``` -------------------------------- ### Get Bind Start Row Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/webworksheet In data-binding mode, returns the starting row index for binding the grid to the data source. ```java public int getBindStartRow() ``` -------------------------------- ### Initialize GridWorkbookSettings Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/gridworkbooksettings Demonstrates how to create an instance of GridWorkbookSettings and apply it to a GridWeb object. This is useful for setting up workbook configurations before performing business logic. ```java GridWeb gridweb = new GridWeb(); GridWorkbookSettings gsettings = new GridWorkbookSettings(); gridweb.setSettings(gsettings); //do your business ``` -------------------------------- ### Create PDF Bookmarks with PdfBookmarkEntry Source: https://reference.aspose.com/cells/java/com.aspose.cells/pdfbookmarkentry This example demonstrates how to create a hierarchical PDF bookmark structure using PdfBookmarkEntry. It shows how to set text, destinations, and sub-entries for bookmarks, and then save the PDF with these bookmarks. ```java Workbook workbook = new Workbook(); workbook.getWorksheets().add(); workbook.getWorksheets().add(); Cell cellInPage1 = workbook.getWorksheets().get(0).getCells().get("A1"); Cell cellInPage2 = workbook.getWorksheets().get(1).getCells().get("A1"); Cell cellInPage3 = workbook.getWorksheets().get(2).getCells().get("A1"); cellInPage1.putValue("page1"); cellInPage2.putValue("page2"); cellInPage3.putValue("page3"); PdfBookmarkEntry pbeRoot = new PdfBookmarkEntry(); pbeRoot.setText("root"); // if pbeRoot.Text = null, all children of pbeRoot will be inserted on the top level in the bookmark. pbeRoot.setDestination(cellInPage1); pbeRoot.setSubEntry(new ArrayList()); pbeRoot.setOpen(false); PdfBookmarkEntry subPbe1 = new PdfBookmarkEntry(); subPbe1.setText("section1"); subPbe1.setDestination(cellInPage2); PdfBookmarkEntry subPbe2 = new PdfBookmarkEntry(); subPbe2.setText("section2"); subPbe2.setDestination(cellInPage3); pbeRoot.getSubEntry().add(subPbe1); pbeRoot.getSubEntry().add(subPbe2); PdfSaveOptions saveOptions = new PdfSaveOptions(); saveOptions.setBookmark(pbeRoot); workbook.save("output_bookmark.pdf", saveOptions); ``` -------------------------------- ### Get Bind Start Column Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/webworksheet In data-binding mode, returns the starting column index for binding the grid to the data source. ```java public int getBindStartColumn() ``` -------------------------------- ### Get Group Range Start Source: https://reference.aspose.com/cells/java/com.aspose.cells/sxrng Retrieves the start object for the group range. This method is part of the obsolete SxRng class. ```java public Object getStart() ``` -------------------------------- ### Render First Page to PNG Source: https://reference.aspose.com/cells/java/com.aspose.cells/sheetrender Example demonstrating how to load a workbook, set image options, and render the first page of a worksheet to a PNG image file. ```java //load the source file with images. Workbook wb = new Workbook("Book1.xlsx"); ImageOrPrintOptions imgOpt = new ImageOrPrintOptions(); //set output image type. imgOpt.setImageType(ImageType.PNG); //render the first sheet. SheetRender sr = new SheetRender(wb.getWorksheets().get(0), imgOpt); //output the first page of the sheet to image. sr.toImage(0, "output.png"); ``` -------------------------------- ### MainWeb Constructor Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/mainweb Initializes a new instance of the MainWeb control. ```java public MainWeb() ``` -------------------------------- ### Get Start Number Source: https://reference.aspose.com/cells/java/com.aspose.cells/autonumberedbulletvalue Retrieves the starting number for the bulleted list. Use this method to determine where the numbering sequence begins. ```java public int getStartAt() ``` -------------------------------- ### Get Cell by Offset Source: https://reference.aspose.com/cells/java/com.aspose.cells/range Gets a Cell object within this range based on row and column offsets from the start of the range. ```java public Cell get(int rowOffset, int columnOffset) ``` -------------------------------- ### Working with Cells Source: https://reference.aspose.com/cells/java/com.aspose.cells/cell This example demonstrates various operations on a cell, such as putting string, integer, and double values, setting formulas, and applying styles. ```APIDOC ## Working with Cells ### Description This example demonstrates various operations on a cell, such as putting string, integer, and double values, setting formulas, and applying styles. ### Code Example ```java Workbook excel = new Workbook(); Cells cells = excel.getWorksheets().get(0).getCells(); //Put a string into a cell Cell cell = cells.get(0, 0); cell.putValue("Hello"); String first = cell.getStringValue(); //Put an integer into a cell cell = cells.get("B1"); cell.putValue(12); int second = cell.getIntValue(); //Put a double into a cell cell = cells.get(0, 2); cell.putValue(-1.234); double third = cell.getDoubleValue(); //Put a formula into a cell cell = cells.get("D1"); cell.setFormula("=B1 + C1"); //Put a combined formula: "sum(average(b1,c1), b1)" to cell at b2 cell = cells.get("b2"); cell.setFormula("=sum(average(b1,c1), b1)"); //Set style of a cell Style style = cell.getStyle(); //Set background color style.setBackgroundColor(Color.getYellow()); //Set format of a cell style.getFont().setName("Courier New"); style.setVerticalAlignment(TextAlignmentType.TOP); cell.setStyle(style); ``` ``` -------------------------------- ### Create EbookLoadOptions Source: https://reference.aspose.com/cells/java/com.aspose.cells/ebookloadoptions Instantiate EbookLoadOptions to set options for loading ebook files. ```java Copypublic EbookLoadOptions() ``` -------------------------------- ### getValue() Source: https://reference.aspose.com/cells/java/com.aspose.cells/shapeguide Gets the current value of the shape guide. ```APIDOC ## getValue() ```java public double getValue() ``` Gets value of this guide **Returns:** double ``` -------------------------------- ### getTransparency() Source: https://reference.aspose.com/cells/java/com.aspose.cells/reflectioneffect Gets the degree of the starting reflection transparency. ```APIDOC ## getTransparency() ```java public double getTransparency() ``` Gets the degree of the starting reflection transparency as a value from 0.0 (opaque) through 1.0 (clear). **Returns:** double ``` -------------------------------- ### Example Usage of Floor Class Source: https://reference.aspose.com/cells/java/com.aspose.cells/floor Demonstrates how to instantiate a chart, access its floor object, and apply formatting to the floor using Aspose.Cells. ```APIDOC ## Example Usage of Floor Class ### Description This example shows how to set the border color and fill format of a 3-D chart's floor using Aspose.Cells. ### Code ```java //Instantiate the License class License license = new License(); //Pass only the name of the license file embedded in the assembly license.setLicense("Aspose.Cells.lic"); //Instantiate the workbook object Workbook workbook = new Workbook(); //Get cells collection Cells cells = workbook.getWorksheets().get(0).getCells(); //Put values in cells cells.get("A1").putValue(1); cells.get("A2").putValue(2); cells.get("A3").putValue(3); //get charts colletion ChartCollection charts = workbook.getWorksheets().get(0).getCharts(); //add a new chart int index = charts.add(ChartType.COLUMN_3_D_STACKED, 5, 0, 15, 5); //get the newly added chart Chart chart = charts.get(index); //set charts nseries chart.getNSeries().add("A1:A3", true); //Show data labels chart.getNSeries().get(0).getDataLabels().setShowValue(true); //Get chart's floor Floor floor = chart.getFloor(); //set floor's border as red floor.getBorder().setColor(com.aspose.cells.Color.getRed()); //set fill format floor.getFillFormat().setPresetColorGradient(GradientPresetType.CALM_WATER, GradientStyleType.DIAGONAL_DOWN, 2); //save the file workbook.save("dest.xls"); ``` ``` -------------------------------- ### getFirstPageNumber() Source: https://reference.aspose.com/cells/java/com.aspose.cells/pagesetup Gets the starting page number for printing the worksheet. ```APIDOC ## getFirstPageNumber() ### Description Represents the first page number that will be used when this sheet is printed. ### Method public int getFirstPageNumber() ### Returns int - The first page number. ``` -------------------------------- ### Initialize WebExtensionPropertyCollection Source: https://reference.aspose.com/cells/java/com.aspose.cells/webextensionpropertycollection Creates a new instance of the WebExtensionPropertyCollection class. ```java public WebExtensionPropertyCollection() ``` -------------------------------- ### Instantiate Workbook and Access Worksheet Source: https://reference.aspose.com/cells/java/com.aspose.cells/querytable Demonstrates how to instantiate a Workbook object and obtain a reference to the first worksheet. This is a common setup for interacting with Excel files. ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first worksheet Worksheet worksheet = workbook.getWorksheets().get(0); ``` -------------------------------- ### getStartIndex Source: https://reference.aspose.com/cells/java/com.aspose.cells/boxequationnode Gets the starting index of the characters represented by this node. ```APIDOC ## getStartIndex() ### Description Gets the start index of the characters. ### Method Signature ```java public int getStartIndex() ``` ### Returns * int ``` -------------------------------- ### Get Original Picture Height Source: https://reference.aspose.com/cells/java/com.aspose.cells/picture Retrieves the original height of the picture in pixels. This example demonstrates adding a picture and then getting its original height. ```java public int getOriginalHeight() ``` ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); Worksheet worksheet = workbook.getWorksheets().get(0); //Adding a picture at the location of a cell whose row and column indices are 1 in the worksheet. It is "B2" cell int imgIndex = worksheet.getPictures().add(1, 1, "example.jpeg"); //Get the inserted picture object Picture pic = worksheet.getPictures().get(imgIndex); //Gets the original height of the picture. int picHeight = pic.getOriginalHeight(); //Save the excel file. workbook.save("result.xlsx"); ``` -------------------------------- ### Create and Configure a Slicer for a Pivot Table Source: https://reference.aspose.com/cells/java/com.aspose.cells/slicer This snippet shows how to set up sample data, create a pivot table, and then add a slicer linked to a specific pivot field. It also demonstrates styling the slicer and deselecting an item. ```java Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); Cells cells = sheet.getCells(); cells.get(0, 0).setValue("fruit"); cells.get(1, 0).setValue("grape"); cells.get(2, 0).setValue("blueberry"); cells.get(3, 0).setValue("kiwi"); cells.get(4, 0).setValue("cherry"); cells.get(5, 0).setValue("grape"); cells.get(6, 0).setValue("blueberry"); cells.get(7, 0).setValue("kiwi"); cells.get(8, 0).setValue("cherry"); cells.get(0, 1).setValue("year"); cells.get(1, 1).setValue(2020); cells.get(2, 1).setValue(2020); cells.get(3, 1).setValue(2020); cells.get(4, 1).setValue(2020); cells.get(5, 1).setValue(2021); cells.get(6, 1).setValue(2021); cells.get(7, 1).setValue(2021); cells.get(8, 1).setValue(2021); cells.get(0, 2).setValue("amount"); cells.get(1, 2).setValue(50); cells.get(2, 2).setValue(60); cells.get(3, 2).setValue(70); cells.get(4, 2).setValue(80); cells.get(5, 2).setValue(90); cells.get(6, 2).setValue(100); cells.get(7, 2).setValue(110); cells.get(8, 2).setValue(120); PivotTableCollection pivots = sheet.getPivotTables(); int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable"); PivotTable pivot = pivots.get(pivotIndex); pivot.addFieldToArea(PivotFieldType.ROW, "fruit"); pivot.addFieldToArea(PivotFieldType.COLUMN, "year"); pivot.addFieldToArea(PivotFieldType.DATA, "amount"); pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10); pivot.refreshData(); pivot.calculateData(); SlicerCollection slicers = sheet.getSlicers(); int slicerIndex = slicers.add(pivot, "E12", "fruit"); Slicer slicer = slicers.get(slicerIndex); slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_2); SlicerCacheItemCollection items = slicer.getSlicerCache().getSlicerCacheItems(); SlicerCacheItem item = items.get(0); item.setSelected(false); //do your business book.save("out.xlsx"); ``` -------------------------------- ### Creating and Configuring a Label Source: https://reference.aspose.com/cells/java/com.aspose.cells/label This example demonstrates how to create a new Workbook, add a label to a worksheet, set its caption, placement, and fill color, and then save the workbook. ```APIDOC ## Creating and Configuring a Label ### Description This example demonstrates how to create a new Workbook, add a label to a worksheet, set its caption, placement, and fill color, and then save the workbook. ### Method ```java //Create a new Workbook. Workbook workbook = new Workbook(); //Get the first worksheet in the workbook. Worksheet sheet = workbook.getWorksheets().get(0); //Add a new label to the worksheet. Label label = sheet.getShapes().addLabel(2, 0, 2, 0, 60, 120); //Set the caption of the label. label.setText("This is a Label"); //Set the Placement Type, the way the //label is attached to the cells. label.setPlacement(PlacementType.FREE_FLOATING); //Set the fill color of the label. label.getFill().setFillType(FillType.SOLID); label.getFill().getSolidFill().setColor(Color.getYellow()); //Saves the file. workbook.save("tstlabel.xls"); ``` ``` -------------------------------- ### Get Default Font Name - Java Source: https://reference.aspose.com/cells/java/com.aspose.gridweb/gridworksheetcollection Gets the control's default font name. Example shows setting the default font name. ```java GridWeb GridWeb1=new GridWeb(); GridWeb1.setDefaultFontName("Arial"); ``` -------------------------------- ### PivotTable Usage Example Source: https://reference.aspose.com/cells/java/com.aspose.cells/pivottable This example demonstrates how to create a pivot table, add fields to different areas, apply styles, and set up filters and conditional formatting. ```APIDOC ## PivotTable Creation and Configuration ### Description This code snippet illustrates the process of creating a new pivot table in an Excel worksheet using Aspose.Cells. It covers setting up the source data, defining the pivot table's location and name, adding row, column, and data fields, applying a style, customizing field display names, and implementing pivot filters and conditional formatting. Finally, it demonstrates how to calculate the pivot table data with refresh options and save the workbook. ### Method ```java // Java Code Example Workbook book = new Workbook(); Worksheet sheet = book.getWorksheets().get(0); Cells cells = sheet.getCells(); cells.get(0, 0).setValue("fruit"); cells.get(1, 0).setValue("grape"); cells.get(2, 0).setValue("blueberry"); cells.get(3, 0).setValue("kiwi"); cells.get(4, 0).setValue("cherry"); cells.get(5, 0).setValue("grape"); cells.get(6, 0).setValue("blueberry"); cells.get(7, 0).setValue("kiwi"); cells.get(8, 0).setValue("cherry"); cells.get(0, 1).setValue("year"); cells.get(1, 1).setValue(2020); cells.get(2, 1).setValue(2020); cells.get(3, 1).setValue(2020); cells.get(4, 1).setValue(2020); cells.get(5, 1).setValue(2021); cells.get(6, 1).setValue(2021); cells.get(7, 1).setValue(2021); cells.get(8, 1).setValue(2021); cells.get(0, 2).setValue("amount"); cells.get(1, 2).setValue(50); cells.get(2, 2).setValue(60); cells.get(3, 2).setValue(70); cells.get(4, 2).setValue(80); cells.get(5, 2).setValue(90); cells.get(6, 2).setValue(100); cells.get(7, 2).setValue(110); cells.get(8, 2).setValue(120); PivotTableCollection pivots = sheet.getPivotTables(); int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable"); PivotTable pivot = pivots.get(pivotIndex); pivot.addFieldToArea(PivotFieldType.ROW, "fruit"); pivot.addFieldToArea(PivotFieldType.COLUMN, "year"); pivot.addFieldToArea(PivotFieldType.DATA, "amount"); pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10); //Change PivotField's attributes PivotField rowField = pivot.getRowFields().get(0); rowField.setDisplayName("custom display name"); //Add PivotFilter int index = pivot.getPivotFilters().add(0, PivotFilterType.COUNT); PivotFilter filter = pivot.getPivotFilters().get(index); filter.getAutoFilter().filterTop10(0, false, false, 2); //Add PivotFormatCondition int formatIndex = pivot.getPivotFormatConditions().add(); PivotFormatCondition pfc = pivot.getPivotFormatConditions().get(formatIndex); FormatConditionCollection fcc = pfc.getFormatConditions(); fcc.addArea(pivot.getDataBodyRange()); int idx = fcc.addCondition(FormatConditionType.CELL_VALUE); FormatCondition fc = fcc.get(idx); fc.setFormula1("100"); fc.setOperator(OperatorType.GREATER_OR_EQUAL); fc.getStyle().setBackgroundColor(Color.getRed()); PivotTableCalculateOption calculateOption = new PivotTableCalculateOption(); calculateOption.setRefreshData(true); calculateOption.setRefreshCharts(true); pivot.calculateData(calculateOption); //do your business book.save("out.xlsx"); ``` ``` -------------------------------- ### Get Original Picture Height in CM Source: https://reference.aspose.com/cells/java/com.aspose.cells/picture Retrieves the original height of the picture in centimeters. This example shows how to add a picture and then get its height in CM. ```java public double getOriginalHeightCM() ``` ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); Worksheet worksheet = workbook.getWorksheets().get(0); //Adding a picture at the location of a cell whose row and column indices are 1 in the worksheet. It is "B2" cell int imgIndex = worksheet.getPictures().add(1, 1, "example.jpeg"); //Get the inserted picture object Picture pic = worksheet.getPictures().get(imgIndex); //Gets the original height of the picture. double picHeightCM = pic.getOriginalHeightCM(); //Save the excel file. workbook.save("result.xlsx"); ``` -------------------------------- ### VbaModuleCollection Example Source: https://reference.aspose.com/cells/java/com.aspose.cells/vbamodulecollection This example demonstrates how to initialize a VBA project, add a new module, and save the workbook. ```APIDOC ## VbaModuleCollection Example ### Description This example demonstrates how to initialize a VBA project, add a new module, and save the workbook. ### Code ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); // Init VBA project. VbaProject vbaProject = workbook.getVbaProject(); // Add a new module. vbaProject.getModules().add(VbaModuleType.CLASS, "test"); //Saving the Excel file workbook.save("book1.xlsm"); ``` ``` -------------------------------- ### Get Start Number of the Group Source: https://reference.aspose.com/cells/java/com.aspose.cells/pivotnumbericrangegroupsettings Retrieve the starting number of the numeric range group using the getStart() method. This defines the lower bound of the group. ```java public double getStart() ``` -------------------------------- ### Initialize and Save VBA Project Source: https://reference.aspose.com/cells/java/com.aspose.cells/vbaproject Demonstrates how to instantiate a Workbook, access its VBA project, and save the workbook. This is useful for creating or modifying Excel files with VBA content. ```java //Instantiating a Workbook object Workbook workbook = new Workbook(); // Init VBA project. VbaProject vbaProject = workbook.getVbaProject(); //Saving the Excel file workbook.save("book1.xlsm"); ``` -------------------------------- ### getStartRow() Source: https://reference.aspose.com/cells/java/com.aspose.cells/verticalpagebreak Gets the start row index of the vertical page break. ```APIDOC ## Method getStartRow() ```java public int getStartRow() ``` Gets the start row index of the vertical page break. **Returns:** int ``` -------------------------------- ### ShapeGuideCollection() Source: https://reference.aspose.com/cells/java/com.aspose.cells/shapeguidecollection Initializes a new instance of the ShapeGuideCollection class. ```APIDOC ## ShapeGuideCollection() ### Description Initializes a new instance of the ShapeGuideCollection class. ### Constructor ```java public ShapeGuideCollection() ``` ``` -------------------------------- ### getStartDate() Source: https://reference.aspose.com/cells/java/com.aspose.cells/timeline Gets the start date of the timespan scrolling position of this Timeline. ```APIDOC ## getStartDate() ### Description Gets the start date of the timespan scrolling position of this Timeline. ### Returns - DateTime: The start date of the timeline. ``` -------------------------------- ### getStartDate() Source: https://reference.aspose.com/cells/java/com.aspose.cells/timeline Gets the start date of the timespan scrolling position of this Timeline. ```APIDOC ## getStartDate() ### Description Gets the start date of the timespan scrolling position of this Timeline. ### Method ```java public DateTime getStartDate() ``` ### Returns - **DateTime** - The start date. ```